commit
135022a14f
19
.eslintrc.json
Normal file
19
.eslintrc.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"commonjs": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"airbnb-base"
|
||||||
|
],
|
||||||
|
"globals": {
|
||||||
|
"Atomics": "readonly",
|
||||||
|
"SharedArrayBuffer": "readonly"
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2018
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
}
|
||||||
|
}
|
||||||
1
node_modules/.bin/acorn
generated
vendored
Symbolic link
1
node_modules/.bin/acorn
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../acorn/bin/acorn
|
||||||
1
node_modules/.bin/eslint
generated
vendored
Symbolic link
1
node_modules/.bin/eslint
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../eslint/bin/eslint.js
|
||||||
1
node_modules/.bin/esparse
generated
vendored
Symbolic link
1
node_modules/.bin/esparse
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../esprima/bin/esparse.js
|
||||||
1
node_modules/.bin/esvalidate
generated
vendored
Symbolic link
1
node_modules/.bin/esvalidate
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../esprima/bin/esvalidate.js
|
||||||
1
node_modules/.bin/js-yaml
generated
vendored
Symbolic link
1
node_modules/.bin/js-yaml
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../js-yaml/bin/js-yaml.js
|
||||||
1
node_modules/.bin/json5
generated
vendored
Symbolic link
1
node_modules/.bin/json5
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../json5/lib/cli.js
|
||||||
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../mkdirp/bin/cmd.js
|
||||||
1
node_modules/.bin/node-which
generated
vendored
Symbolic link
1
node_modules/.bin/node-which
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../which/bin/node-which
|
||||||
1
node_modules/.bin/rimraf
generated
vendored
Symbolic link
1
node_modules/.bin/rimraf
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../rimraf/bin.js
|
||||||
1
node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/.bin/semver
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../semver/bin/semver.js
|
||||||
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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
Normal file
19
node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# @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/next/babel-code-frame.html) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/code-frame
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/code-frame --dev
|
||||||
|
```
|
||||||
167
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
167
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.codeFrameColumns = codeFrameColumns;
|
||||||
|
exports.default = _default;
|
||||||
|
|
||||||
|
var _highlight = _interopRequireWildcard(require("@babel/highlight"));
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
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).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, markerLine].join("");
|
||||||
|
} else {
|
||||||
|
return ` ${maybeHighlight(defs.gutter, gutter)}${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);
|
||||||
|
}
|
||||||
57
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
57
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"_from": "@babel/code-frame@^7.0.0",
|
||||||
|
"_id": "@babel/code-frame@7.10.4",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
|
||||||
|
"_location": "/@babel/code-frame",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@babel/code-frame@^7.0.0",
|
||||||
|
"name": "@babel/code-frame",
|
||||||
|
"escapedName": "@babel%2fcode-frame",
|
||||||
|
"scope": "@babel",
|
||||||
|
"rawSpec": "^7.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^7.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/eslint"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
|
||||||
|
"_shasum": "168da1a36e90da68ae8d49c0f1b48c7c6249213a",
|
||||||
|
"_spec": "@babel/code-frame@^7.0.0",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/eslint",
|
||||||
|
"author": {
|
||||||
|
"name": "Sebastian McKenzie",
|
||||||
|
"email": "sebmck@gmail.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/babel/babel/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/highlight": "^7.10.4"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||||
|
"devDependencies": {
|
||||||
|
"chalk": "^2.0.0",
|
||||||
|
"strip-ansi": "^4.0.0"
|
||||||
|
},
|
||||||
|
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||||
|
"homepage": "https://babeljs.io/",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"name": "@babel/code-frame",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/babel/babel.git",
|
||||||
|
"directory": "packages/babel-code-frame"
|
||||||
|
},
|
||||||
|
"version": "7.10.4"
|
||||||
|
}
|
||||||
22
node_modules/@babel/helper-validator-identifier/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-validator-identifier/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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
Normal file
19
node_modules/@babel/helper-validator-identifier/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# @babel/helper-validator-identifier
|
||||||
|
|
||||||
|
> Validate identifier/keywords name
|
||||||
|
|
||||||
|
See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/next/babel-helper-validator-identifier.html) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/helper-validator-identifier
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/helper-validator-identifier --dev
|
||||||
|
```
|
||||||
77
node_modules/@babel/helper-validator-identifier/lib/identifier.js
generated
vendored
Normal file
77
node_modules/@babel/helper-validator-identifier/lib/identifier.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.isIdentifierStart = isIdentifierStart;
|
||||||
|
exports.isIdentifierChar = isIdentifierChar;
|
||||||
|
exports.isIdentifierName = isIdentifierName;
|
||||||
|
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\u08a0-\u08b4\u08b6-\u08c7\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\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\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-\u170c\u170e-\u1711\u1720-\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-\u1b4b\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-\u2c2e\u2c30-\u2c5e\u2c60-\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-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\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\u08d3-\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\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\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-\u0ecd\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-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\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-\u1df9\u1dfb-\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, 157, 310, 10, 21, 11, 7, 153, 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, 107, 20, 28, 22, 13, 52, 76, 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, 85, 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, 230, 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, 35, 56, 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, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 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, 8952, 286, 50, 2, 18, 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, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 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, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
||||||
|
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, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 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, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 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, 262, 6, 10, 9, 419, 13, 1495, 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, _Array$from = Array.from(name); _i < _Array$from.length; _i++) {
|
||||||
|
const char = _Array$from[_i];
|
||||||
|
const cp = char.codePointAt(0);
|
||||||
|
|
||||||
|
if (isFirst) {
|
||||||
|
if (!isIdentifierStart(cp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
isFirst = false;
|
||||||
|
} else if (!isIdentifierChar(cp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return !isFirst;
|
||||||
|
}
|
||||||
57
node_modules/@babel/helper-validator-identifier/lib/index.js
generated
vendored
Normal file
57
node_modules/@babel/helper-validator-identifier/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isIdentifierName", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _identifier.isIdentifierName;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isIdentifierChar", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _identifier.isIdentifierChar;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isIdentifierStart", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _identifier.isIdentifierStart;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isKeyword", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _keyword.isKeyword;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var _identifier = require("./identifier");
|
||||||
|
|
||||||
|
var _keyword = require("./keyword");
|
||||||
38
node_modules/@babel/helper-validator-identifier/lib/keyword.js
generated
vendored
Normal file
38
node_modules/@babel/helper-validator-identifier/lib/keyword.js
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.isReservedWord = isReservedWord;
|
||||||
|
exports.isStrictReservedWord = isStrictReservedWord;
|
||||||
|
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
||||||
|
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
||||||
|
exports.isKeyword = isKeyword;
|
||||||
|
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);
|
||||||
|
}
|
||||||
51
node_modules/@babel/helper-validator-identifier/package.json
generated
vendored
Normal file
51
node_modules/@babel/helper-validator-identifier/package.json
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"_from": "@babel/helper-validator-identifier@^7.10.4",
|
||||||
|
"_id": "@babel/helper-validator-identifier@7.10.4",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==",
|
||||||
|
"_location": "/@babel/helper-validator-identifier",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@babel/helper-validator-identifier@^7.10.4",
|
||||||
|
"name": "@babel/helper-validator-identifier",
|
||||||
|
"escapedName": "@babel%2fhelper-validator-identifier",
|
||||||
|
"scope": "@babel",
|
||||||
|
"rawSpec": "^7.10.4",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^7.10.4"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/@babel/highlight"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
|
||||||
|
"_shasum": "a78c7a7251e01f616512d31b10adcf52ada5e0d2",
|
||||||
|
"_spec": "@babel/helper-validator-identifier@^7.10.4",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/@babel/highlight",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/babel/babel/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Validate identifier/keywords name",
|
||||||
|
"devDependencies": {
|
||||||
|
"charcodes": "^0.2.0",
|
||||||
|
"unicode-13.0.0": "^0.8.0"
|
||||||
|
},
|
||||||
|
"exports": "./lib/index.js",
|
||||||
|
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||||
|
"homepage": "https://github.com/babel/babel#readme",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./lib/index.js",
|
||||||
|
"name": "@babel/helper-validator-identifier",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/babel/babel.git",
|
||||||
|
"directory": "packages/babel-helper-validator-identifier"
|
||||||
|
},
|
||||||
|
"version": "7.10.4"
|
||||||
|
}
|
||||||
75
node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js
generated
vendored
Normal file
75
node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Always use the latest available version of Unicode!
|
||||||
|
// https://tc39.github.io/ecma262/#sec-conformance
|
||||||
|
const version = "13.0.0";
|
||||||
|
|
||||||
|
const start = require("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-" +
|
||||||
|
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
Normal file
22
node_modules/@babel/highlight/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
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
Normal file
19
node_modules/@babel/highlight/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# @babel/highlight
|
||||||
|
|
||||||
|
> Syntax highlight JavaScript strings for output in terminals.
|
||||||
|
|
||||||
|
See our website [@babel/highlight](https://babeljs.io/docs/en/next/babel-highlight.html) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/highlight
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/highlight --dev
|
||||||
|
```
|
||||||
107
node_modules/@babel/highlight/lib/index.js
generated
vendored
Normal file
107
node_modules/@babel/highlight/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.shouldHighlight = shouldHighlight;
|
||||||
|
exports.getChalk = getChalk;
|
||||||
|
exports.default = highlight;
|
||||||
|
|
||||||
|
var _jsTokens = _interopRequireWildcard(require("js-tokens"));
|
||||||
|
|
||||||
|
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
|
||||||
|
|
||||||
|
var _chalk = _interopRequireDefault(require("chalk"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
function getDefs(chalk) {
|
||||||
|
return {
|
||||||
|
keyword: chalk.cyan,
|
||||||
|
capitalized: chalk.yellow,
|
||||||
|
jsx_tag: 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 JSX_TAG = /^[a-z][\w-]*$/i;
|
||||||
|
const BRACKET = /^[()[\]{}]$/;
|
||||||
|
|
||||||
|
function getTokenType(match) {
|
||||||
|
const [offset, text] = match.slice(-2);
|
||||||
|
const token = (0, _jsTokens.matchToToken)(match);
|
||||||
|
|
||||||
|
if (token.type === "name") {
|
||||||
|
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isReservedWord)(token.value)) {
|
||||||
|
return "keyword";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
|
||||||
|
return "jsx_tag";
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
function highlightTokens(defs, text) {
|
||||||
|
return text.replace(_jsTokens.default, function (...args) {
|
||||||
|
const type = getTokenType(args);
|
||||||
|
const colorize = defs[type];
|
||||||
|
|
||||||
|
if (colorize) {
|
||||||
|
return args[0].split(NEWLINE).map(str => colorize(str)).join("\n");
|
||||||
|
} else {
|
||||||
|
return args[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldHighlight(options) {
|
||||||
|
return _chalk.default.supportsColor || options.forceColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getChalk(options) {
|
||||||
|
let chalk = _chalk.default;
|
||||||
|
|
||||||
|
if (options.forceColor) {
|
||||||
|
chalk = new _chalk.default.constructor({
|
||||||
|
enabled: true,
|
||||||
|
level: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return chalk;
|
||||||
|
}
|
||||||
|
|
||||||
|
function highlight(code, options = {}) {
|
||||||
|
if (shouldHighlight(options)) {
|
||||||
|
const chalk = getChalk(options);
|
||||||
|
const defs = getDefs(chalk);
|
||||||
|
return highlightTokens(defs, code);
|
||||||
|
} else {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
228
node_modules/@babel/highlight/node_modules/chalk/index.js
generated
vendored
Normal file
228
node_modules/@babel/highlight/node_modules/chalk/index.js
generated
vendored
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
'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
Normal file
93
node_modules/@babel/highlight/node_modules/chalk/index.js.flow
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
// @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
Normal file
9
node_modules/@babel/highlight/node_modules/chalk/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
103
node_modules/@babel/highlight/node_modules/chalk/package.json
generated
vendored
Normal file
103
node_modules/@babel/highlight/node_modules/chalk/package.json
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"_from": "chalk@^2.0.0",
|
||||||
|
"_id": "chalk@2.4.2",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||||
|
"_location": "/@babel/highlight/chalk",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "chalk@^2.0.0",
|
||||||
|
"name": "chalk",
|
||||||
|
"escapedName": "chalk",
|
||||||
|
"rawSpec": "^2.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^2.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/@babel/highlight"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||||
|
"_shasum": "cd42541677a54333cf541a49108c1432b44c9424",
|
||||||
|
"_spec": "chalk@^2.0.0",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/@babel/highlight",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/chalk/chalk/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^3.2.1",
|
||||||
|
"escape-string-regexp": "^1.0.5",
|
||||||
|
"supports-color": "^5.3.0"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Terminal string styling done right",
|
||||||
|
"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": "*"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"templates.js",
|
||||||
|
"types/index.d.ts",
|
||||||
|
"index.js.flow"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/chalk/chalk#readme",
|
||||||
|
"keywords": [
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"colors",
|
||||||
|
"terminal",
|
||||||
|
"console",
|
||||||
|
"cli",
|
||||||
|
"string",
|
||||||
|
"str",
|
||||||
|
"ansi",
|
||||||
|
"style",
|
||||||
|
"styles",
|
||||||
|
"tty",
|
||||||
|
"formatting",
|
||||||
|
"rgb",
|
||||||
|
"256",
|
||||||
|
"shell",
|
||||||
|
"xterm",
|
||||||
|
"log",
|
||||||
|
"logging",
|
||||||
|
"command-line",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "chalk",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/chalk/chalk.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "matcha benchmark.js",
|
||||||
|
"coveralls": "nyc report --reporter=text-lcov | coveralls",
|
||||||
|
"test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava"
|
||||||
|
},
|
||||||
|
"types": "types/index.d.ts",
|
||||||
|
"version": "2.4.2",
|
||||||
|
"xo": {
|
||||||
|
"envs": [
|
||||||
|
"node",
|
||||||
|
"mocha"
|
||||||
|
],
|
||||||
|
"ignores": [
|
||||||
|
"test/_flow.js"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
314
node_modules/@babel/highlight/node_modules/chalk/readme.md
generated
vendored
Normal file
314
node_modules/@babel/highlight/node_modules/chalk/readme.md
generated
vendored
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
<h1 align="center">
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
> Terminal string styling done right
|
||||||
|
|
||||||
|
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo) [](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
Normal file
128
node_modules/@babel/highlight/node_modules/chalk/templates.js
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
'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
Normal file
97
node_modules/@babel/highlight/node_modules/chalk/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
// 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
|
||||||
62
node_modules/@babel/highlight/package.json
generated
vendored
Normal file
62
node_modules/@babel/highlight/package.json
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"_from": "@babel/highlight@^7.10.4",
|
||||||
|
"_id": "@babel/highlight@7.10.4",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
|
||||||
|
"_location": "/@babel/highlight",
|
||||||
|
"_phantomChildren": {
|
||||||
|
"ansi-styles": "3.2.1",
|
||||||
|
"escape-string-regexp": "1.0.5",
|
||||||
|
"supports-color": "5.5.0"
|
||||||
|
},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@babel/highlight@^7.10.4",
|
||||||
|
"name": "@babel/highlight",
|
||||||
|
"escapedName": "@babel%2fhighlight",
|
||||||
|
"scope": "@babel",
|
||||||
|
"rawSpec": "^7.10.4",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^7.10.4"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/@babel/code-frame"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
|
||||||
|
"_shasum": "7d1bdfd65753538fabe6c38596cdb76d9ac60143",
|
||||||
|
"_spec": "@babel/highlight@^7.10.4",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/@babel/code-frame",
|
||||||
|
"author": {
|
||||||
|
"name": "suchipi",
|
||||||
|
"email": "me@suchipi.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/babel/babel/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/helper-validator-identifier": "^7.10.4",
|
||||||
|
"chalk": "^2.0.0",
|
||||||
|
"js-tokens": "^4.0.0"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Syntax highlight JavaScript strings for output in terminals.",
|
||||||
|
"devDependencies": {
|
||||||
|
"strip-ansi": "^4.0.0"
|
||||||
|
},
|
||||||
|
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||||
|
"homepage": "https://babeljs.io/",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"name": "@babel/highlight",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/babel/babel.git",
|
||||||
|
"directory": "packages/babel-highlight"
|
||||||
|
},
|
||||||
|
"version": "7.10.4"
|
||||||
|
}
|
||||||
4
node_modules/@eslint/eslintrc/CHANGELOG.md
generated
vendored
Normal file
4
node_modules/@eslint/eslintrc/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
v0.1.3 - September 1, 2020
|
||||||
|
|
||||||
|
* [`8647a61`](https://github.com/eslint/eslintrc/commit/8647a61991fe121f923d33e96232475209b78210) Fix: version number and eslint-release version (refs #6) (Nicholas C. Zakas)
|
||||||
|
|
||||||
21
node_modules/@eslint/eslintrc/LICENSE
generated
vendored
Normal file
21
node_modules/@eslint/eslintrc/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 ESLint
|
||||||
|
|
||||||
|
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.
|
||||||
21
node_modules/@eslint/eslintrc/README.md
generated
vendored
Normal file
21
node_modules/@eslint/eslintrc/README.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# ESLintRC Library
|
||||||
|
|
||||||
|
This repository contains the legacy ESLintRC configuration file format for ESLint.
|
||||||
|
|
||||||
|
**Note:** This package is not intended for use outside of the ESLint ecosystem. It is ESLint-specific and not intended for use in other programs.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
You can install the package as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install @eslint/eslintrc --save-dev
|
||||||
|
|
||||||
|
# or
|
||||||
|
|
||||||
|
yarn add @eslint/eslintrc -D
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT License
|
||||||
39
node_modules/@eslint/eslintrc/conf/category-list.json
generated
vendored
Normal file
39
node_modules/@eslint/eslintrc/conf/category-list.json
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"categories": [
|
||||||
|
{ "name": "Possible Errors", "description": "These rules relate to possible syntax or logic errors in JavaScript code:" },
|
||||||
|
{ "name": "Best Practices", "description": "These rules relate to better ways of doing things to help you avoid problems:" },
|
||||||
|
{ "name": "Strict Mode", "description": "These rules relate to strict mode directives:" },
|
||||||
|
{ "name": "Variables", "description": "These rules relate to variable declarations:" },
|
||||||
|
{ "name": "Stylistic Issues", "description": "These rules relate to style guidelines, and are therefore quite subjective:" },
|
||||||
|
{ "name": "ECMAScript 6", "description": "These rules relate to ES6, also known as ES2015:" }
|
||||||
|
],
|
||||||
|
"deprecated": {
|
||||||
|
"name": "Deprecated",
|
||||||
|
"description": "These rules have been deprecated in accordance with the <a href=\"/docs/user-guide/rule-deprecation\">deprecation policy</a>, and replaced by newer rules:",
|
||||||
|
"rules": []
|
||||||
|
},
|
||||||
|
"removed": {
|
||||||
|
"name": "Removed",
|
||||||
|
"description": "These rules from older versions of ESLint (before the <a href=\"/docs/user-guide/rule-deprecation\">deprecation policy</a> existed) have been replaced by newer rules:",
|
||||||
|
"rules": [
|
||||||
|
{ "removed": "generator-star", "replacedBy": ["generator-star-spacing"] },
|
||||||
|
{ "removed": "global-strict", "replacedBy": ["strict"] },
|
||||||
|
{ "removed": "no-arrow-condition", "replacedBy": ["no-confusing-arrow", "no-constant-condition"] },
|
||||||
|
{ "removed": "no-comma-dangle", "replacedBy": ["comma-dangle"] },
|
||||||
|
{ "removed": "no-empty-class", "replacedBy": ["no-empty-character-class"] },
|
||||||
|
{ "removed": "no-empty-label", "replacedBy": ["no-labels"] },
|
||||||
|
{ "removed": "no-extra-strict", "replacedBy": ["strict"] },
|
||||||
|
{ "removed": "no-reserved-keys", "replacedBy": ["quote-props"] },
|
||||||
|
{ "removed": "no-space-before-semi", "replacedBy": ["semi-spacing"] },
|
||||||
|
{ "removed": "no-wrap-func", "replacedBy": ["no-extra-parens"] },
|
||||||
|
{ "removed": "space-after-function-name", "replacedBy": ["space-before-function-paren"] },
|
||||||
|
{ "removed": "space-after-keywords", "replacedBy": ["keyword-spacing"] },
|
||||||
|
{ "removed": "space-before-function-parentheses", "replacedBy": ["space-before-function-paren"] },
|
||||||
|
{ "removed": "space-before-keywords", "replacedBy": ["keyword-spacing"] },
|
||||||
|
{ "removed": "space-in-brackets", "replacedBy": ["object-curly-spacing", "array-bracket-spacing"] },
|
||||||
|
{ "removed": "space-return-throw-case", "replacedBy": ["keyword-spacing"] },
|
||||||
|
{ "removed": "space-unary-word-ops", "replacedBy": ["space-unary-ops"] },
|
||||||
|
{ "removed": "spaced-line-comment", "replacedBy": ["spaced-comment"] }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
81
node_modules/@eslint/eslintrc/conf/config-schema.js
generated
vendored
Normal file
81
node_modules/@eslint/eslintrc/conf/config-schema.js
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Defines a schema for configs.
|
||||||
|
* @author Sylvan Mably
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const baseConfigProperties = {
|
||||||
|
$schema: { type: "string" },
|
||||||
|
env: { type: "object" },
|
||||||
|
extends: { $ref: "#/definitions/stringOrStrings" },
|
||||||
|
globals: { type: "object" },
|
||||||
|
overrides: {
|
||||||
|
type: "array",
|
||||||
|
items: { $ref: "#/definitions/overrideConfig" },
|
||||||
|
additionalItems: false
|
||||||
|
},
|
||||||
|
parser: { type: ["string", "null"] },
|
||||||
|
parserOptions: { type: "object" },
|
||||||
|
plugins: { type: "array" },
|
||||||
|
processor: { type: "string" },
|
||||||
|
rules: { type: "object" },
|
||||||
|
settings: { type: "object" },
|
||||||
|
noInlineConfig: { type: "boolean" },
|
||||||
|
reportUnusedDisableDirectives: { type: "boolean" },
|
||||||
|
|
||||||
|
ecmaFeatures: { type: "object" } // deprecated; logs a warning when used
|
||||||
|
};
|
||||||
|
|
||||||
|
const configSchema = {
|
||||||
|
definitions: {
|
||||||
|
stringOrStrings: {
|
||||||
|
oneOf: [
|
||||||
|
{ type: "string" },
|
||||||
|
{
|
||||||
|
type: "array",
|
||||||
|
items: { type: "string" },
|
||||||
|
additionalItems: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
stringOrStringsRequired: {
|
||||||
|
oneOf: [
|
||||||
|
{ type: "string" },
|
||||||
|
{
|
||||||
|
type: "array",
|
||||||
|
items: { type: "string" },
|
||||||
|
additionalItems: false,
|
||||||
|
minItems: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Config at top-level.
|
||||||
|
objectConfig: {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
root: { type: "boolean" },
|
||||||
|
ignorePatterns: { $ref: "#/definitions/stringOrStrings" },
|
||||||
|
...baseConfigProperties
|
||||||
|
},
|
||||||
|
additionalProperties: false
|
||||||
|
},
|
||||||
|
|
||||||
|
// Config in `overrides`.
|
||||||
|
overrideConfig: {
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
excludedFiles: { $ref: "#/definitions/stringOrStrings" },
|
||||||
|
files: { $ref: "#/definitions/stringOrStringsRequired" },
|
||||||
|
...baseConfigProperties
|
||||||
|
},
|
||||||
|
required: ["files"],
|
||||||
|
additionalProperties: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
$ref: "#/definitions/objectConfig"
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = configSchema;
|
||||||
31
node_modules/@eslint/eslintrc/conf/default-cli-options.js
generated
vendored
Normal file
31
node_modules/@eslint/eslintrc/conf/default-cli-options.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Default CLIEngineOptions.
|
||||||
|
* @author Ian VanSchooten
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
configFile: null,
|
||||||
|
baseConfig: false,
|
||||||
|
rulePaths: [],
|
||||||
|
useEslintrc: true,
|
||||||
|
envs: [],
|
||||||
|
globals: [],
|
||||||
|
extensions: null,
|
||||||
|
ignore: true,
|
||||||
|
ignorePath: void 0,
|
||||||
|
cache: false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* in order to honor the cacheFile option if specified
|
||||||
|
* this option should not have a default value otherwise
|
||||||
|
* it will always be used
|
||||||
|
*/
|
||||||
|
cacheLocation: "",
|
||||||
|
cacheFile: ".eslintcache",
|
||||||
|
fix: false,
|
||||||
|
allowInlineConfig: true,
|
||||||
|
reportUnusedDisableDirectives: void 0,
|
||||||
|
globInputPaths: true
|
||||||
|
};
|
||||||
179
node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
Normal file
179
node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Defines environment settings and globals.
|
||||||
|
* @author Elan Shanker
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const globals = require("globals");
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Helpers
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the object that has difference.
|
||||||
|
* @param {Record<string,boolean>} current The newer object.
|
||||||
|
* @param {Record<string,boolean>} prev The older object.
|
||||||
|
* @returns {Record<string,boolean>} The difference object.
|
||||||
|
*/
|
||||||
|
function getDiff(current, prev) {
|
||||||
|
const retv = {};
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(current)) {
|
||||||
|
if (!Object.hasOwnProperty.call(prev, key)) {
|
||||||
|
retv[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retv;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...
|
||||||
|
const newGlobals2017 = {
|
||||||
|
Atomics: false,
|
||||||
|
SharedArrayBuffer: false
|
||||||
|
};
|
||||||
|
const newGlobals2020 = {
|
||||||
|
BigInt: false,
|
||||||
|
BigInt64Array: false,
|
||||||
|
BigUint64Array: false,
|
||||||
|
globalThis: false
|
||||||
|
};
|
||||||
|
|
||||||
|
const newGlobals2021 = {
|
||||||
|
FinalizationRegistry: false,
|
||||||
|
WeakRef: false
|
||||||
|
};
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Public Interface
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** @type {Map<string, import("../lib/shared/types").Environment>} */
|
||||||
|
module.exports = new Map(Object.entries({
|
||||||
|
|
||||||
|
// Language
|
||||||
|
builtin: {
|
||||||
|
globals: globals.es5
|
||||||
|
},
|
||||||
|
es6: {
|
||||||
|
globals: newGlobals2015,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
es2015: {
|
||||||
|
globals: newGlobals2015,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
es2017: {
|
||||||
|
globals: { ...newGlobals2015, ...newGlobals2017 },
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
es2020: {
|
||||||
|
globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 11
|
||||||
|
}
|
||||||
|
},
|
||||||
|
es2021: {
|
||||||
|
globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Platforms
|
||||||
|
browser: {
|
||||||
|
globals: globals.browser
|
||||||
|
},
|
||||||
|
node: {
|
||||||
|
globals: globals.node,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaFeatures: {
|
||||||
|
globalReturn: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"shared-node-browser": {
|
||||||
|
globals: globals["shared-node-browser"]
|
||||||
|
},
|
||||||
|
worker: {
|
||||||
|
globals: globals.worker
|
||||||
|
},
|
||||||
|
serviceworker: {
|
||||||
|
globals: globals.serviceworker
|
||||||
|
},
|
||||||
|
|
||||||
|
// Frameworks
|
||||||
|
commonjs: {
|
||||||
|
globals: globals.commonjs,
|
||||||
|
parserOptions: {
|
||||||
|
ecmaFeatures: {
|
||||||
|
globalReturn: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
amd: {
|
||||||
|
globals: globals.amd
|
||||||
|
},
|
||||||
|
mocha: {
|
||||||
|
globals: globals.mocha
|
||||||
|
},
|
||||||
|
jasmine: {
|
||||||
|
globals: globals.jasmine
|
||||||
|
},
|
||||||
|
jest: {
|
||||||
|
globals: globals.jest
|
||||||
|
},
|
||||||
|
phantomjs: {
|
||||||
|
globals: globals.phantomjs
|
||||||
|
},
|
||||||
|
jquery: {
|
||||||
|
globals: globals.jquery
|
||||||
|
},
|
||||||
|
qunit: {
|
||||||
|
globals: globals.qunit
|
||||||
|
},
|
||||||
|
prototypejs: {
|
||||||
|
globals: globals.prototypejs
|
||||||
|
},
|
||||||
|
shelljs: {
|
||||||
|
globals: globals.shelljs
|
||||||
|
},
|
||||||
|
meteor: {
|
||||||
|
globals: globals.meteor
|
||||||
|
},
|
||||||
|
mongo: {
|
||||||
|
globals: globals.mongo
|
||||||
|
},
|
||||||
|
protractor: {
|
||||||
|
globals: globals.protractor
|
||||||
|
},
|
||||||
|
applescript: {
|
||||||
|
globals: globals.applescript
|
||||||
|
},
|
||||||
|
nashorn: {
|
||||||
|
globals: globals.nashorn
|
||||||
|
},
|
||||||
|
atomtest: {
|
||||||
|
globals: globals.atomtest
|
||||||
|
},
|
||||||
|
embertest: {
|
||||||
|
globals: globals.embertest
|
||||||
|
},
|
||||||
|
webextensions: {
|
||||||
|
globals: globals.webextensions
|
||||||
|
},
|
||||||
|
greasemonkey: {
|
||||||
|
globals: globals.greasemonkey
|
||||||
|
}
|
||||||
|
}));
|
||||||
32
node_modules/@eslint/eslintrc/conf/eslint-all.js
generated
vendored
Normal file
32
node_modules/@eslint/eslintrc/conf/eslint-all.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Config to enable all rules.
|
||||||
|
* @author Robert Fletcher
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// FIXME: "../lib/rules" doesn't exist in this package
|
||||||
|
const builtInRules = require("../lib/rules");
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Helpers
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const allRules = {};
|
||||||
|
|
||||||
|
for (const [ruleId, rule] of builtInRules) {
|
||||||
|
if (!rule.meta.deprecated) {
|
||||||
|
allRules[ruleId] = "error";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Public Interface
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** @type {import("../lib/shared/types").ConfigData} */
|
||||||
|
module.exports = { rules: allRules };
|
||||||
72
node_modules/@eslint/eslintrc/conf/eslint-recommended.js
generated
vendored
Normal file
72
node_modules/@eslint/eslintrc/conf/eslint-recommended.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Configuration applied when a user configuration extends from
|
||||||
|
* eslint:recommended.
|
||||||
|
* @author Nicholas C. Zakas
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/* eslint sort-keys: ["error", "asc"] */
|
||||||
|
|
||||||
|
/** @type {import("../lib/shared/types").ConfigData} */
|
||||||
|
module.exports = {
|
||||||
|
rules: {
|
||||||
|
"constructor-super": "error",
|
||||||
|
"for-direction": "error",
|
||||||
|
"getter-return": "error",
|
||||||
|
"no-async-promise-executor": "error",
|
||||||
|
"no-case-declarations": "error",
|
||||||
|
"no-class-assign": "error",
|
||||||
|
"no-compare-neg-zero": "error",
|
||||||
|
"no-cond-assign": "error",
|
||||||
|
"no-const-assign": "error",
|
||||||
|
"no-constant-condition": "error",
|
||||||
|
"no-control-regex": "error",
|
||||||
|
"no-debugger": "error",
|
||||||
|
"no-delete-var": "error",
|
||||||
|
"no-dupe-args": "error",
|
||||||
|
"no-dupe-class-members": "error",
|
||||||
|
"no-dupe-else-if": "error",
|
||||||
|
"no-dupe-keys": "error",
|
||||||
|
"no-duplicate-case": "error",
|
||||||
|
"no-empty": "error",
|
||||||
|
"no-empty-character-class": "error",
|
||||||
|
"no-empty-pattern": "error",
|
||||||
|
"no-ex-assign": "error",
|
||||||
|
"no-extra-boolean-cast": "error",
|
||||||
|
"no-extra-semi": "error",
|
||||||
|
"no-fallthrough": "error",
|
||||||
|
"no-func-assign": "error",
|
||||||
|
"no-global-assign": "error",
|
||||||
|
"no-import-assign": "error",
|
||||||
|
"no-inner-declarations": "error",
|
||||||
|
"no-invalid-regexp": "error",
|
||||||
|
"no-irregular-whitespace": "error",
|
||||||
|
"no-misleading-character-class": "error",
|
||||||
|
"no-mixed-spaces-and-tabs": "error",
|
||||||
|
"no-new-symbol": "error",
|
||||||
|
"no-obj-calls": "error",
|
||||||
|
"no-octal": "error",
|
||||||
|
"no-prototype-builtins": "error",
|
||||||
|
"no-redeclare": "error",
|
||||||
|
"no-regex-spaces": "error",
|
||||||
|
"no-self-assign": "error",
|
||||||
|
"no-setter-return": "error",
|
||||||
|
"no-shadow-restricted-names": "error",
|
||||||
|
"no-sparse-arrays": "error",
|
||||||
|
"no-this-before-super": "error",
|
||||||
|
"no-undef": "error",
|
||||||
|
"no-unexpected-multiline": "error",
|
||||||
|
"no-unreachable": "error",
|
||||||
|
"no-unsafe-finally": "error",
|
||||||
|
"no-unsafe-negation": "error",
|
||||||
|
"no-unused-labels": "error",
|
||||||
|
"no-unused-vars": "error",
|
||||||
|
"no-useless-catch": "error",
|
||||||
|
"no-useless-escape": "error",
|
||||||
|
"no-with": "error",
|
||||||
|
"require-yield": "error",
|
||||||
|
"use-isnan": "error",
|
||||||
|
"valid-typeof": "error"
|
||||||
|
}
|
||||||
|
};
|
||||||
22
node_modules/@eslint/eslintrc/conf/replacements.json
generated
vendored
Normal file
22
node_modules/@eslint/eslintrc/conf/replacements.json
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"generator-star": ["generator-star-spacing"],
|
||||||
|
"global-strict": ["strict"],
|
||||||
|
"no-arrow-condition": ["no-confusing-arrow", "no-constant-condition"],
|
||||||
|
"no-comma-dangle": ["comma-dangle"],
|
||||||
|
"no-empty-class": ["no-empty-character-class"],
|
||||||
|
"no-empty-label": ["no-labels"],
|
||||||
|
"no-extra-strict": ["strict"],
|
||||||
|
"no-reserved-keys": ["quote-props"],
|
||||||
|
"no-space-before-semi": ["semi-spacing"],
|
||||||
|
"no-wrap-func": ["no-extra-parens"],
|
||||||
|
"space-after-function-name": ["space-before-function-paren"],
|
||||||
|
"space-after-keywords": ["keyword-spacing"],
|
||||||
|
"space-before-function-parentheses": ["space-before-function-paren"],
|
||||||
|
"space-before-keywords": ["keyword-spacing"],
|
||||||
|
"space-in-brackets": ["object-curly-spacing", "array-bracket-spacing", "computed-property-spacing"],
|
||||||
|
"space-return-throw-case": ["keyword-spacing"],
|
||||||
|
"space-unary-word-ops": ["space-unary-ops"],
|
||||||
|
"spaced-line-comment": ["spaced-comment"]
|
||||||
|
}
|
||||||
|
}
|
||||||
501
node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
Normal file
501
node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
Normal file
@ -0,0 +1,501 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview `CascadingConfigArrayFactory` class.
|
||||||
|
*
|
||||||
|
* `CascadingConfigArrayFactory` class has a responsibility:
|
||||||
|
*
|
||||||
|
* 1. Handles cascading of config files.
|
||||||
|
*
|
||||||
|
* It provides two methods:
|
||||||
|
*
|
||||||
|
* - `getConfigArrayForFile(filePath)`
|
||||||
|
* Get the corresponded configuration of a given file. This method doesn't
|
||||||
|
* throw even if the given file didn't exist.
|
||||||
|
* - `clearCache()`
|
||||||
|
* Clear the internal cache. You have to call this method when
|
||||||
|
* `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends
|
||||||
|
* on the additional plugins. (`CLIEngine#addPlugin()` method calls this.)
|
||||||
|
*
|
||||||
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const os = require("os");
|
||||||
|
const path = require("path");
|
||||||
|
const ConfigValidator = require("./shared/config-validator");
|
||||||
|
const { emitDeprecationWarning } = require("./shared/deprecation-warnings");
|
||||||
|
const { ConfigArrayFactory } = require("./config-array-factory");
|
||||||
|
const { ConfigArray, ConfigDependency, IgnorePattern } = require("./config-array");
|
||||||
|
const debug = require("debug")("eslintrc:cascading-config-array-factory");
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Helpers
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Define types for VSCode IntelliSense.
|
||||||
|
/** @typedef {import("../shared/types").ConfigData} ConfigData */
|
||||||
|
/** @typedef {import("../shared/types").Parser} Parser */
|
||||||
|
/** @typedef {import("../shared/types").Plugin} Plugin */
|
||||||
|
/** @typedef {ReturnType<ConfigArrayFactory["create"]>} ConfigArray */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} CascadingConfigArrayFactoryOptions
|
||||||
|
* @property {Map<string,Plugin>} [additionalPluginPool] The map for additional plugins.
|
||||||
|
* @property {ConfigData} [baseConfig] The config by `baseConfig` option.
|
||||||
|
* @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files.
|
||||||
|
* @property {string} [cwd] The base directory to start lookup.
|
||||||
|
* @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.
|
||||||
|
* @property {string[]} [rulePaths] The value of `--rulesdir` option.
|
||||||
|
* @property {string} [specificConfigPath] The value of `--config` option.
|
||||||
|
* @property {boolean} [useEslintrc] if `false` then it doesn't load config files.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} CascadingConfigArrayFactoryInternalSlots
|
||||||
|
* @property {ConfigArray} baseConfigArray The config array of `baseConfig` option.
|
||||||
|
* @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`.
|
||||||
|
* @property {ConfigArray} cliConfigArray The config array of CLI options.
|
||||||
|
* @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`.
|
||||||
|
* @property {ConfigArrayFactory} configArrayFactory The factory for config arrays.
|
||||||
|
* @property {Map<string, ConfigArray>} configCache The cache from directory paths to config arrays.
|
||||||
|
* @property {string} cwd The base directory to start lookup.
|
||||||
|
* @property {WeakMap<ConfigArray, ConfigArray>} finalizeCache The cache from config arrays to finalized config arrays.
|
||||||
|
* @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.
|
||||||
|
* @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`.
|
||||||
|
* @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`.
|
||||||
|
* @property {boolean} useEslintrc if `false` then it doesn't load config files.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {WeakMap<CascadingConfigArrayFactory, CascadingConfigArrayFactoryInternalSlots>} */
|
||||||
|
const internalSlotsMap = new WeakMap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the config array from `baseConfig` and `rulePaths`.
|
||||||
|
* @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.
|
||||||
|
* @returns {ConfigArray} The config array of the base configs.
|
||||||
|
*/
|
||||||
|
function createBaseConfigArray({
|
||||||
|
configArrayFactory,
|
||||||
|
baseConfigData,
|
||||||
|
rulePaths,
|
||||||
|
cwd,
|
||||||
|
loadRules
|
||||||
|
}) {
|
||||||
|
const baseConfigArray = configArrayFactory.create(
|
||||||
|
baseConfigData,
|
||||||
|
{ name: "BaseConfig" }
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the config array element for the default ignore patterns.
|
||||||
|
* This element has `ignorePattern` property that ignores the default
|
||||||
|
* patterns in the current working directory.
|
||||||
|
*/
|
||||||
|
baseConfigArray.unshift(configArrayFactory.create(
|
||||||
|
{ ignorePatterns: IgnorePattern.DefaultPatterns },
|
||||||
|
{ name: "DefaultIgnorePattern" }
|
||||||
|
)[0]);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load rules `--rulesdir` option as a pseudo plugin.
|
||||||
|
* Use a pseudo plugin to define rules of `--rulesdir`, so we can validate
|
||||||
|
* the rule's options with only information in the config array.
|
||||||
|
*/
|
||||||
|
if (rulePaths && rulePaths.length > 0) {
|
||||||
|
baseConfigArray.push({
|
||||||
|
type: "config",
|
||||||
|
name: "--rulesdir",
|
||||||
|
filePath: "",
|
||||||
|
plugins: {
|
||||||
|
"": new ConfigDependency({
|
||||||
|
definition: {
|
||||||
|
rules: rulePaths.reduce(
|
||||||
|
(map, rulesPath) => Object.assign(
|
||||||
|
map,
|
||||||
|
loadRules(rulesPath, cwd)
|
||||||
|
),
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
filePath: "",
|
||||||
|
id: "",
|
||||||
|
importerName: "--rulesdir",
|
||||||
|
importerPath: ""
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseConfigArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the config array from CLI options.
|
||||||
|
* @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.
|
||||||
|
* @returns {ConfigArray} The config array of the base configs.
|
||||||
|
*/
|
||||||
|
function createCLIConfigArray({
|
||||||
|
cliConfigData,
|
||||||
|
configArrayFactory,
|
||||||
|
cwd,
|
||||||
|
ignorePath,
|
||||||
|
specificConfigPath
|
||||||
|
}) {
|
||||||
|
const cliConfigArray = configArrayFactory.create(
|
||||||
|
cliConfigData,
|
||||||
|
{ name: "CLIOptions" }
|
||||||
|
);
|
||||||
|
|
||||||
|
cliConfigArray.unshift(
|
||||||
|
...(ignorePath
|
||||||
|
? configArrayFactory.loadESLintIgnore(ignorePath)
|
||||||
|
: configArrayFactory.loadDefaultESLintIgnore())
|
||||||
|
);
|
||||||
|
|
||||||
|
if (specificConfigPath) {
|
||||||
|
cliConfigArray.unshift(
|
||||||
|
...configArrayFactory.loadFile(
|
||||||
|
specificConfigPath,
|
||||||
|
{ name: "--config", basePath: cwd }
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cliConfigArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error type when there are files matched by a glob, but all of them have been ignored.
|
||||||
|
*/
|
||||||
|
class ConfigurationNotFoundError extends Error {
|
||||||
|
|
||||||
|
// eslint-disable-next-line jsdoc/require-description
|
||||||
|
/**
|
||||||
|
* @param {string} directoryPath The directory path.
|
||||||
|
*/
|
||||||
|
constructor(directoryPath) {
|
||||||
|
super(`No ESLint configuration found in ${directoryPath}.`);
|
||||||
|
this.messageTemplate = "no-config-found";
|
||||||
|
this.messageData = { directoryPath };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides the functionality that enumerates every file which is
|
||||||
|
* matched by given glob patterns and that configuration.
|
||||||
|
*/
|
||||||
|
class CascadingConfigArrayFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize this enumerator.
|
||||||
|
* @param {CascadingConfigArrayFactoryOptions} options The options.
|
||||||
|
*/
|
||||||
|
constructor({
|
||||||
|
additionalPluginPool = new Map(),
|
||||||
|
baseConfig: baseConfigData = null,
|
||||||
|
cliConfig: cliConfigData = null,
|
||||||
|
cwd = process.cwd(),
|
||||||
|
ignorePath,
|
||||||
|
resolvePluginsRelativeTo,
|
||||||
|
rulePaths = [],
|
||||||
|
specificConfigPath = null,
|
||||||
|
useEslintrc = true,
|
||||||
|
builtInRules = new Map(),
|
||||||
|
loadRules,
|
||||||
|
resolver
|
||||||
|
} = {}) {
|
||||||
|
const configArrayFactory = new ConfigArrayFactory({
|
||||||
|
additionalPluginPool,
|
||||||
|
cwd,
|
||||||
|
resolvePluginsRelativeTo,
|
||||||
|
builtInRules,
|
||||||
|
resolver
|
||||||
|
});
|
||||||
|
|
||||||
|
internalSlotsMap.set(this, {
|
||||||
|
baseConfigArray: createBaseConfigArray({
|
||||||
|
baseConfigData,
|
||||||
|
configArrayFactory,
|
||||||
|
cwd,
|
||||||
|
rulePaths,
|
||||||
|
loadRules,
|
||||||
|
resolver
|
||||||
|
}),
|
||||||
|
baseConfigData,
|
||||||
|
cliConfigArray: createCLIConfigArray({
|
||||||
|
cliConfigData,
|
||||||
|
configArrayFactory,
|
||||||
|
cwd,
|
||||||
|
ignorePath,
|
||||||
|
specificConfigPath
|
||||||
|
}),
|
||||||
|
cliConfigData,
|
||||||
|
configArrayFactory,
|
||||||
|
configCache: new Map(),
|
||||||
|
cwd,
|
||||||
|
finalizeCache: new WeakMap(),
|
||||||
|
ignorePath,
|
||||||
|
rulePaths,
|
||||||
|
specificConfigPath,
|
||||||
|
useEslintrc
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path to the current working directory.
|
||||||
|
* This is used by tests.
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
get cwd() {
|
||||||
|
const { cwd } = internalSlotsMap.get(this);
|
||||||
|
|
||||||
|
return cwd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the config array of a given file.
|
||||||
|
* If `filePath` was not given, it returns the config which contains only
|
||||||
|
* `baseConfigData` and `cliConfigData`.
|
||||||
|
* @param {string} [filePath] The file path to a file.
|
||||||
|
* @param {Object} [options] The options.
|
||||||
|
* @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`.
|
||||||
|
* @returns {ConfigArray} The config array of the file.
|
||||||
|
*/
|
||||||
|
getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) {
|
||||||
|
const {
|
||||||
|
baseConfigArray,
|
||||||
|
cliConfigArray,
|
||||||
|
cwd
|
||||||
|
} = internalSlotsMap.get(this);
|
||||||
|
|
||||||
|
if (!filePath) {
|
||||||
|
return new ConfigArray(...baseConfigArray, ...cliConfigArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
const directoryPath = path.dirname(path.resolve(cwd, filePath));
|
||||||
|
|
||||||
|
debug(`Load config files for ${directoryPath}.`);
|
||||||
|
|
||||||
|
return this._finalizeConfigArray(
|
||||||
|
this._loadConfigInAncestors(directoryPath),
|
||||||
|
directoryPath,
|
||||||
|
ignoreNotFoundError
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the config data to override all configs.
|
||||||
|
* Require to call `clearCache()` method after this method is called.
|
||||||
|
* @param {ConfigData} configData The config data to override all configs.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
setOverrideConfig(configData) {
|
||||||
|
const slots = internalSlotsMap.get(this);
|
||||||
|
|
||||||
|
slots.cliConfigData = configData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear config cache.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
clearCache() {
|
||||||
|
const slots = internalSlotsMap.get(this);
|
||||||
|
|
||||||
|
slots.baseConfigArray = createBaseConfigArray(slots);
|
||||||
|
slots.cliConfigArray = createCLIConfigArray(slots);
|
||||||
|
slots.configCache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load and normalize config files from the ancestor directories.
|
||||||
|
* @param {string} directoryPath The path to a leaf directory.
|
||||||
|
* @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.
|
||||||
|
* @returns {ConfigArray} The loaded config.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {
|
||||||
|
const {
|
||||||
|
baseConfigArray,
|
||||||
|
configArrayFactory,
|
||||||
|
configCache,
|
||||||
|
cwd,
|
||||||
|
useEslintrc
|
||||||
|
} = internalSlotsMap.get(this);
|
||||||
|
|
||||||
|
if (!useEslintrc) {
|
||||||
|
return baseConfigArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
let configArray = configCache.get(directoryPath);
|
||||||
|
|
||||||
|
// Hit cache.
|
||||||
|
if (configArray) {
|
||||||
|
debug(`Cache hit: ${directoryPath}.`);
|
||||||
|
return configArray;
|
||||||
|
}
|
||||||
|
debug(`No cache found: ${directoryPath}.`);
|
||||||
|
|
||||||
|
const homePath = os.homedir();
|
||||||
|
|
||||||
|
// Consider this is root.
|
||||||
|
if (directoryPath === homePath && cwd !== homePath) {
|
||||||
|
debug("Stop traversing because of considered root.");
|
||||||
|
if (configsExistInSubdirs) {
|
||||||
|
const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath);
|
||||||
|
|
||||||
|
if (filePath) {
|
||||||
|
emitDeprecationWarning(
|
||||||
|
filePath,
|
||||||
|
"ESLINT_PERSONAL_CONFIG_SUPPRESS"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this._cacheConfig(directoryPath, baseConfigArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the config on this directory.
|
||||||
|
try {
|
||||||
|
configArray = configArrayFactory.loadInDirectory(directoryPath);
|
||||||
|
} catch (error) {
|
||||||
|
/* istanbul ignore next */
|
||||||
|
if (error.code === "EACCES") {
|
||||||
|
debug("Stop traversing because of 'EACCES' error.");
|
||||||
|
return this._cacheConfig(directoryPath, baseConfigArray);
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configArray.length > 0 && configArray.isRoot()) {
|
||||||
|
debug("Stop traversing because of 'root:true'.");
|
||||||
|
configArray.unshift(...baseConfigArray);
|
||||||
|
return this._cacheConfig(directoryPath, configArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load from the ancestors and merge it.
|
||||||
|
const parentPath = path.dirname(directoryPath);
|
||||||
|
const parentConfigArray = parentPath && parentPath !== directoryPath
|
||||||
|
? this._loadConfigInAncestors(
|
||||||
|
parentPath,
|
||||||
|
configsExistInSubdirs || configArray.length > 0
|
||||||
|
)
|
||||||
|
: baseConfigArray;
|
||||||
|
|
||||||
|
if (configArray.length > 0) {
|
||||||
|
configArray.unshift(...parentConfigArray);
|
||||||
|
} else {
|
||||||
|
configArray = parentConfigArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache and return.
|
||||||
|
return this._cacheConfig(directoryPath, configArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Freeze and cache a given config.
|
||||||
|
* @param {string} directoryPath The path to a directory as a cache key.
|
||||||
|
* @param {ConfigArray} configArray The config array as a cache value.
|
||||||
|
* @returns {ConfigArray} The `configArray` (frozen).
|
||||||
|
*/
|
||||||
|
_cacheConfig(directoryPath, configArray) {
|
||||||
|
const { configCache } = internalSlotsMap.get(this);
|
||||||
|
|
||||||
|
Object.freeze(configArray);
|
||||||
|
configCache.set(directoryPath, configArray);
|
||||||
|
|
||||||
|
return configArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finalize a given config array.
|
||||||
|
* Concatenate `--config` and other CLI options.
|
||||||
|
* @param {ConfigArray} configArray The parent config array.
|
||||||
|
* @param {string} directoryPath The path to the leaf directory to find config files.
|
||||||
|
* @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.
|
||||||
|
* @returns {ConfigArray} The loaded config.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {
|
||||||
|
const {
|
||||||
|
cliConfigArray,
|
||||||
|
configArrayFactory,
|
||||||
|
finalizeCache,
|
||||||
|
useEslintrc
|
||||||
|
} = internalSlotsMap.get(this);
|
||||||
|
|
||||||
|
let finalConfigArray = finalizeCache.get(configArray);
|
||||||
|
|
||||||
|
if (!finalConfigArray) {
|
||||||
|
finalConfigArray = configArray;
|
||||||
|
|
||||||
|
// Load the personal config if there are no regular config files.
|
||||||
|
if (
|
||||||
|
useEslintrc &&
|
||||||
|
configArray.every(c => !c.filePath) &&
|
||||||
|
cliConfigArray.every(c => !c.filePath) // `--config` option can be a file.
|
||||||
|
) {
|
||||||
|
const homePath = os.homedir();
|
||||||
|
|
||||||
|
debug("Loading the config file of the home directory:", homePath);
|
||||||
|
|
||||||
|
const personalConfigArray = configArrayFactory.loadInDirectory(
|
||||||
|
homePath,
|
||||||
|
{ name: "PersonalConfig" }
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
personalConfigArray.length > 0 &&
|
||||||
|
!directoryPath.startsWith(homePath)
|
||||||
|
) {
|
||||||
|
const lastElement =
|
||||||
|
personalConfigArray[personalConfigArray.length - 1];
|
||||||
|
|
||||||
|
emitDeprecationWarning(
|
||||||
|
lastElement.filePath,
|
||||||
|
"ESLINT_PERSONAL_CONFIG_LOAD"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
finalConfigArray = finalConfigArray.concat(personalConfigArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply CLI options.
|
||||||
|
if (cliConfigArray.length > 0) {
|
||||||
|
finalConfigArray = finalConfigArray.concat(cliConfigArray);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate rule settings and environments.
|
||||||
|
const validator = new ConfigValidator({
|
||||||
|
builtInRules: configArrayFactory.builtInRules
|
||||||
|
});
|
||||||
|
|
||||||
|
validator.validateConfigArray(finalConfigArray);
|
||||||
|
|
||||||
|
// Cache it.
|
||||||
|
Object.freeze(finalConfigArray);
|
||||||
|
finalizeCache.set(configArray, finalConfigArray);
|
||||||
|
|
||||||
|
debug(
|
||||||
|
"Configuration was determined: %o on %s",
|
||||||
|
finalConfigArray,
|
||||||
|
directoryPath
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// At least one element (the default ignore patterns) exists.
|
||||||
|
if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) {
|
||||||
|
throw new ConfigurationNotFoundError(directoryPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return finalConfigArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Public Interface
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
module.exports = { CascadingConfigArrayFactory };
|
||||||
1080
node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
Normal file
1080
node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
524
node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
Normal file
524
node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
Normal file
@ -0,0 +1,524 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview `ConfigArray` class.
|
||||||
|
*
|
||||||
|
* `ConfigArray` class expresses the full of a configuration. It has the entry
|
||||||
|
* config file, base config files that were extended, loaded parsers, and loaded
|
||||||
|
* plugins.
|
||||||
|
*
|
||||||
|
* `ConfigArray` class provides three properties and two methods.
|
||||||
|
*
|
||||||
|
* - `pluginEnvironments`
|
||||||
|
* - `pluginProcessors`
|
||||||
|
* - `pluginRules`
|
||||||
|
* The `Map` objects that contain the members of all plugins that this
|
||||||
|
* config array contains. Those map objects don't have mutation methods.
|
||||||
|
* Those keys are the member ID such as `pluginId/memberName`.
|
||||||
|
* - `isRoot()`
|
||||||
|
* If `true` then this configuration has `root:true` property.
|
||||||
|
* - `extractConfig(filePath)`
|
||||||
|
* Extract the final configuration for a given file. This means merging
|
||||||
|
* every config array element which that `criteria` property matched. The
|
||||||
|
* `filePath` argument must be an absolute path.
|
||||||
|
*
|
||||||
|
* `ConfigArrayFactory` provides the loading logic of config files.
|
||||||
|
*
|
||||||
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const { ExtractedConfig } = require("./extracted-config");
|
||||||
|
const { IgnorePattern } = require("./ignore-pattern");
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Helpers
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Define types for VSCode IntelliSense.
|
||||||
|
/** @typedef {import("../../shared/types").Environment} Environment */
|
||||||
|
/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
|
||||||
|
/** @typedef {import("../../shared/types").RuleConf} RuleConf */
|
||||||
|
/** @typedef {import("../../shared/types").Rule} Rule */
|
||||||
|
/** @typedef {import("../../shared/types").Plugin} Plugin */
|
||||||
|
/** @typedef {import("../../shared/types").Processor} Processor */
|
||||||
|
/** @typedef {import("./config-dependency").DependentParser} DependentParser */
|
||||||
|
/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
|
||||||
|
/** @typedef {import("./override-tester")["OverrideTester"]} OverrideTester */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ConfigArrayElement
|
||||||
|
* @property {string} name The name of this config element.
|
||||||
|
* @property {string} filePath The path to the source file of this config element.
|
||||||
|
* @property {InstanceType<OverrideTester>|null} criteria The tester for the `files` and `excludedFiles` of this config element.
|
||||||
|
* @property {Record<string, boolean>|undefined} env The environment settings.
|
||||||
|
* @property {Record<string, GlobalConf>|undefined} globals The global variable settings.
|
||||||
|
* @property {IgnorePattern|undefined} ignorePattern The ignore patterns.
|
||||||
|
* @property {boolean|undefined} noInlineConfig The flag that disables directive comments.
|
||||||
|
* @property {DependentParser|undefined} parser The parser loader.
|
||||||
|
* @property {Object|undefined} parserOptions The parser options.
|
||||||
|
* @property {Record<string, DependentPlugin>|undefined} plugins The plugin loaders.
|
||||||
|
* @property {string|undefined} processor The processor name to refer plugin's processor.
|
||||||
|
* @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.
|
||||||
|
* @property {boolean|undefined} root The flag to express root.
|
||||||
|
* @property {Record<string, RuleConf>|undefined} rules The rule settings
|
||||||
|
* @property {Object|undefined} settings The shared settings.
|
||||||
|
* @property {"config" | "ignore" | "implicit-processor"} type The element type.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ConfigArrayInternalSlots
|
||||||
|
* @property {Map<string, ExtractedConfig>} cache The cache to extract configs.
|
||||||
|
* @property {ReadonlyMap<string, Environment>|null} envMap The map from environment ID to environment definition.
|
||||||
|
* @property {ReadonlyMap<string, Processor>|null} processorMap The map from processor ID to environment definition.
|
||||||
|
* @property {ReadonlyMap<string, Rule>|null} ruleMap The map from rule ID to rule definition.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {WeakMap<ConfigArray, ConfigArrayInternalSlots>} */
|
||||||
|
const internalSlotsMap = new class extends WeakMap {
|
||||||
|
get(key) {
|
||||||
|
let value = super.get(key);
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
value = {
|
||||||
|
cache: new Map(),
|
||||||
|
envMap: null,
|
||||||
|
processorMap: null,
|
||||||
|
ruleMap: null
|
||||||
|
};
|
||||||
|
super.set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the indices which are matched to a given file.
|
||||||
|
* @param {ConfigArrayElement[]} elements The elements.
|
||||||
|
* @param {string} filePath The path to a target file.
|
||||||
|
* @returns {number[]} The indices.
|
||||||
|
*/
|
||||||
|
function getMatchedIndices(elements, filePath) {
|
||||||
|
const indices = [];
|
||||||
|
|
||||||
|
for (let i = elements.length - 1; i >= 0; --i) {
|
||||||
|
const element = elements[i];
|
||||||
|
|
||||||
|
if (!element.criteria || (filePath && element.criteria.test(filePath))) {
|
||||||
|
indices.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indices;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a value is a non-null object.
|
||||||
|
* @param {any} x The value to check.
|
||||||
|
* @returns {boolean} `true` if the value is a non-null object.
|
||||||
|
*/
|
||||||
|
function isNonNullObject(x) {
|
||||||
|
return typeof x === "object" && x !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge two objects.
|
||||||
|
*
|
||||||
|
* Assign every property values of `y` to `x` if `x` doesn't have the property.
|
||||||
|
* If `x`'s property value is an object, it does recursive.
|
||||||
|
* @param {Object} target The destination to merge
|
||||||
|
* @param {Object|undefined} source The source to merge.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function mergeWithoutOverwrite(target, source) {
|
||||||
|
if (!isNonNullObject(source)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key of Object.keys(source)) {
|
||||||
|
if (key === "__proto__") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNonNullObject(target[key])) {
|
||||||
|
mergeWithoutOverwrite(target[key], source[key]);
|
||||||
|
} else if (target[key] === void 0) {
|
||||||
|
if (isNonNullObject(source[key])) {
|
||||||
|
target[key] = Array.isArray(source[key]) ? [] : {};
|
||||||
|
mergeWithoutOverwrite(target[key], source[key]);
|
||||||
|
} else if (source[key] !== void 0) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error for plugin conflicts.
|
||||||
|
*/
|
||||||
|
class PluginConflictError extends Error {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize this error object.
|
||||||
|
* @param {string} pluginId The plugin ID.
|
||||||
|
* @param {{filePath:string, importerName:string}[]} plugins The resolved plugins.
|
||||||
|
*/
|
||||||
|
constructor(pluginId, plugins) {
|
||||||
|
super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`);
|
||||||
|
this.messageTemplate = "plugin-conflict";
|
||||||
|
this.messageData = { pluginId, plugins };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge plugins.
|
||||||
|
* `target`'s definition is prior to `source`'s.
|
||||||
|
* @param {Record<string, DependentPlugin>} target The destination to merge
|
||||||
|
* @param {Record<string, DependentPlugin>|undefined} source The source to merge.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function mergePlugins(target, source) {
|
||||||
|
if (!isNonNullObject(source)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key of Object.keys(source)) {
|
||||||
|
if (key === "__proto__") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const targetValue = target[key];
|
||||||
|
const sourceValue = source[key];
|
||||||
|
|
||||||
|
// Adopt the plugin which was found at first.
|
||||||
|
if (targetValue === void 0) {
|
||||||
|
if (sourceValue.error) {
|
||||||
|
throw sourceValue.error;
|
||||||
|
}
|
||||||
|
target[key] = sourceValue;
|
||||||
|
} else if (sourceValue.filePath !== targetValue.filePath) {
|
||||||
|
throw new PluginConflictError(key, [
|
||||||
|
{
|
||||||
|
filePath: targetValue.filePath,
|
||||||
|
importerName: targetValue.importerName
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filePath: sourceValue.filePath,
|
||||||
|
importerName: sourceValue.importerName
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge rule configs.
|
||||||
|
* `target`'s definition is prior to `source`'s.
|
||||||
|
* @param {Record<string, Array>} target The destination to merge
|
||||||
|
* @param {Record<string, RuleConf>|undefined} source The source to merge.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function mergeRuleConfigs(target, source) {
|
||||||
|
if (!isNonNullObject(source)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key of Object.keys(source)) {
|
||||||
|
if (key === "__proto__") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const targetDef = target[key];
|
||||||
|
const sourceDef = source[key];
|
||||||
|
|
||||||
|
// Adopt the rule config which was found at first.
|
||||||
|
if (targetDef === void 0) {
|
||||||
|
if (Array.isArray(sourceDef)) {
|
||||||
|
target[key] = [...sourceDef];
|
||||||
|
} else {
|
||||||
|
target[key] = [sourceDef];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the first found rule config is severity only and the current rule
|
||||||
|
* config has options, merge the severity and the options.
|
||||||
|
*/
|
||||||
|
} else if (
|
||||||
|
targetDef.length === 1 &&
|
||||||
|
Array.isArray(sourceDef) &&
|
||||||
|
sourceDef.length >= 2
|
||||||
|
) {
|
||||||
|
targetDef.push(...sourceDef.slice(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the extracted config.
|
||||||
|
* @param {ConfigArray} instance The config elements.
|
||||||
|
* @param {number[]} indices The indices to use.
|
||||||
|
* @returns {ExtractedConfig} The extracted config.
|
||||||
|
*/
|
||||||
|
function createConfig(instance, indices) {
|
||||||
|
const config = new ExtractedConfig();
|
||||||
|
const ignorePatterns = [];
|
||||||
|
|
||||||
|
// Merge elements.
|
||||||
|
for (const index of indices) {
|
||||||
|
const element = instance[index];
|
||||||
|
|
||||||
|
// Adopt the parser which was found at first.
|
||||||
|
if (!config.parser && element.parser) {
|
||||||
|
if (element.parser.error) {
|
||||||
|
throw element.parser.error;
|
||||||
|
}
|
||||||
|
config.parser = element.parser;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt the processor which was found at first.
|
||||||
|
if (!config.processor && element.processor) {
|
||||||
|
config.processor = element.processor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt the noInlineConfig which was found at first.
|
||||||
|
if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) {
|
||||||
|
config.noInlineConfig = element.noInlineConfig;
|
||||||
|
config.configNameOfNoInlineConfig = element.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adopt the reportUnusedDisableDirectives which was found at first.
|
||||||
|
if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) {
|
||||||
|
config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect ignorePatterns
|
||||||
|
if (element.ignorePattern) {
|
||||||
|
ignorePatterns.push(element.ignorePattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge others.
|
||||||
|
mergeWithoutOverwrite(config.env, element.env);
|
||||||
|
mergeWithoutOverwrite(config.globals, element.globals);
|
||||||
|
mergeWithoutOverwrite(config.parserOptions, element.parserOptions);
|
||||||
|
mergeWithoutOverwrite(config.settings, element.settings);
|
||||||
|
mergePlugins(config.plugins, element.plugins);
|
||||||
|
mergeRuleConfigs(config.rules, element.rules);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the predicate function for ignore patterns.
|
||||||
|
if (ignorePatterns.length > 0) {
|
||||||
|
config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse());
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collect definitions.
|
||||||
|
* @template T, U
|
||||||
|
* @param {string} pluginId The plugin ID for prefix.
|
||||||
|
* @param {Record<string,T>} defs The definitions to collect.
|
||||||
|
* @param {Map<string, U>} map The map to output.
|
||||||
|
* @param {function(T): U} [normalize] The normalize function for each value.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function collect(pluginId, defs, map, normalize) {
|
||||||
|
if (defs) {
|
||||||
|
const prefix = pluginId && `${pluginId}/`;
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(defs)) {
|
||||||
|
map.set(
|
||||||
|
`${prefix}${key}`,
|
||||||
|
normalize ? normalize(value) : value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a rule definition.
|
||||||
|
* @param {Function|Rule} rule The rule definition to normalize.
|
||||||
|
* @returns {Rule} The normalized rule definition.
|
||||||
|
*/
|
||||||
|
function normalizePluginRule(rule) {
|
||||||
|
return typeof rule === "function" ? { create: rule } : rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the mutation methods from a given map.
|
||||||
|
* @param {Map<any, any>} map The map object to delete.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function deleteMutationMethods(map) {
|
||||||
|
Object.defineProperties(map, {
|
||||||
|
clear: { configurable: true, value: void 0 },
|
||||||
|
delete: { configurable: true, value: void 0 },
|
||||||
|
set: { configurable: true, value: void 0 }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.
|
||||||
|
* @param {ConfigArrayElement[]} elements The config elements.
|
||||||
|
* @param {ConfigArrayInternalSlots} slots The internal slots.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function initPluginMemberMaps(elements, slots) {
|
||||||
|
const processed = new Set();
|
||||||
|
|
||||||
|
slots.envMap = new Map();
|
||||||
|
slots.processorMap = new Map();
|
||||||
|
slots.ruleMap = new Map();
|
||||||
|
|
||||||
|
for (const element of elements) {
|
||||||
|
if (!element.plugins) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const [pluginId, value] of Object.entries(element.plugins)) {
|
||||||
|
const plugin = value.definition;
|
||||||
|
|
||||||
|
if (!plugin || processed.has(pluginId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
processed.add(pluginId);
|
||||||
|
|
||||||
|
collect(pluginId, plugin.environments, slots.envMap);
|
||||||
|
collect(pluginId, plugin.processors, slots.processorMap);
|
||||||
|
collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteMutationMethods(slots.envMap);
|
||||||
|
deleteMutationMethods(slots.processorMap);
|
||||||
|
deleteMutationMethods(slots.ruleMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.
|
||||||
|
* @param {ConfigArray} instance The config elements.
|
||||||
|
* @returns {ConfigArrayInternalSlots} The extracted config.
|
||||||
|
*/
|
||||||
|
function ensurePluginMemberMaps(instance) {
|
||||||
|
const slots = internalSlotsMap.get(instance);
|
||||||
|
|
||||||
|
if (!slots.ruleMap) {
|
||||||
|
initPluginMemberMaps(instance, slots);
|
||||||
|
}
|
||||||
|
|
||||||
|
return slots;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Public Interface
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Config Array.
|
||||||
|
*
|
||||||
|
* `ConfigArray` instance contains all settings, parsers, and plugins.
|
||||||
|
* You need to call `ConfigArray#extractConfig(filePath)` method in order to
|
||||||
|
* extract, merge and get only the config data which is related to an arbitrary
|
||||||
|
* file.
|
||||||
|
* @extends {Array<ConfigArrayElement>}
|
||||||
|
*/
|
||||||
|
class ConfigArray extends Array {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plugin environments.
|
||||||
|
* The returned map cannot be mutated.
|
||||||
|
* @type {ReadonlyMap<string, Environment>} The plugin environments.
|
||||||
|
*/
|
||||||
|
get pluginEnvironments() {
|
||||||
|
return ensurePluginMemberMaps(this).envMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plugin processors.
|
||||||
|
* The returned map cannot be mutated.
|
||||||
|
* @type {ReadonlyMap<string, Processor>} The plugin processors.
|
||||||
|
*/
|
||||||
|
get pluginProcessors() {
|
||||||
|
return ensurePluginMemberMaps(this).processorMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plugin rules.
|
||||||
|
* The returned map cannot be mutated.
|
||||||
|
* @returns {ReadonlyMap<string, Rule>} The plugin rules.
|
||||||
|
*/
|
||||||
|
get pluginRules() {
|
||||||
|
return ensurePluginMemberMaps(this).ruleMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this config has `root` flag.
|
||||||
|
* @returns {boolean} `true` if this config array is root.
|
||||||
|
*/
|
||||||
|
isRoot() {
|
||||||
|
for (let i = this.length - 1; i >= 0; --i) {
|
||||||
|
const root = this[i].root;
|
||||||
|
|
||||||
|
if (typeof root === "boolean") {
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the config data which is related to a given file.
|
||||||
|
* @param {string} filePath The absolute path to the target file.
|
||||||
|
* @returns {ExtractedConfig} The extracted config data.
|
||||||
|
*/
|
||||||
|
extractConfig(filePath) {
|
||||||
|
const { cache } = internalSlotsMap.get(this);
|
||||||
|
const indices = getMatchedIndices(this, filePath);
|
||||||
|
const cacheKey = indices.join(",");
|
||||||
|
|
||||||
|
if (!cache.has(cacheKey)) {
|
||||||
|
cache.set(cacheKey, createConfig(this, indices));
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache.get(cacheKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a given path is an additional lint target.
|
||||||
|
* @param {string} filePath The absolute path to the target file.
|
||||||
|
* @returns {boolean} `true` if the file is an additional lint target.
|
||||||
|
*/
|
||||||
|
isAdditionalTargetPath(filePath) {
|
||||||
|
for (const { criteria, type } of this) {
|
||||||
|
if (
|
||||||
|
type === "config" &&
|
||||||
|
criteria &&
|
||||||
|
!criteria.endsWithWildcard &&
|
||||||
|
criteria.test(filePath)
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const exportObject = {
|
||||||
|
ConfigArray,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the used extracted configs.
|
||||||
|
* CLIEngine will use this method to collect used deprecated rules.
|
||||||
|
* @param {ConfigArray} instance The config array object to get.
|
||||||
|
* @returns {ExtractedConfig[]} The used extracted configs.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
getUsedExtractedConfigs(instance) {
|
||||||
|
const { cache } = internalSlotsMap.get(instance);
|
||||||
|
|
||||||
|
return Array.from(cache.values());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = exportObject;
|
||||||
116
node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
Normal file
116
node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview `ConfigDependency` class.
|
||||||
|
*
|
||||||
|
* `ConfigDependency` class expresses a loaded parser or plugin.
|
||||||
|
*
|
||||||
|
* If the parser or plugin was loaded successfully, it has `definition` property
|
||||||
|
* and `filePath` property. Otherwise, it has `error` property.
|
||||||
|
*
|
||||||
|
* When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it
|
||||||
|
* omits `definition` property.
|
||||||
|
*
|
||||||
|
* `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers
|
||||||
|
* or plugins.
|
||||||
|
*
|
||||||
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const util = require("util");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class is to store parsers or plugins.
|
||||||
|
* This class hides the loaded object from `JSON.stringify()` and `console.log`.
|
||||||
|
* @template T
|
||||||
|
*/
|
||||||
|
class ConfigDependency {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize this instance.
|
||||||
|
* @param {Object} data The dependency data.
|
||||||
|
* @param {T} [data.definition] The dependency if the loading succeeded.
|
||||||
|
* @param {Error} [data.error] The error object if the loading failed.
|
||||||
|
* @param {string} [data.filePath] The actual path to the dependency if the loading succeeded.
|
||||||
|
* @param {string} data.id The ID of this dependency.
|
||||||
|
* @param {string} data.importerName The name of the config file which loads this dependency.
|
||||||
|
* @param {string} data.importerPath The path to the config file which loads this dependency.
|
||||||
|
*/
|
||||||
|
constructor({
|
||||||
|
definition = null,
|
||||||
|
error = null,
|
||||||
|
filePath = null,
|
||||||
|
id,
|
||||||
|
importerName,
|
||||||
|
importerPath
|
||||||
|
}) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The loaded dependency if the loading succeeded.
|
||||||
|
* @type {T|null}
|
||||||
|
*/
|
||||||
|
this.definition = definition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error object if the loading failed.
|
||||||
|
* @type {Error|null}
|
||||||
|
*/
|
||||||
|
this.error = error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The loaded dependency if the loading succeeded.
|
||||||
|
* @type {string|null}
|
||||||
|
*/
|
||||||
|
this.filePath = filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of this dependency.
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
this.id = id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the config file which loads this dependency.
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
this.importerName = importerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path to the config file which loads this dependency.
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
this.importerPath = importerPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line jsdoc/require-description
|
||||||
|
/**
|
||||||
|
* @returns {Object} a JSON compatible object.
|
||||||
|
*/
|
||||||
|
toJSON() {
|
||||||
|
const obj = this[util.inspect.custom]();
|
||||||
|
|
||||||
|
// Display `error.message` (`Error#message` is unenumerable).
|
||||||
|
if (obj.error instanceof Error) {
|
||||||
|
obj.error = { ...obj.error, message: obj.error.message };
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line jsdoc/require-description
|
||||||
|
/**
|
||||||
|
* @returns {Object} an object to display by `console.log()`.
|
||||||
|
*/
|
||||||
|
[util.inspect.custom]() {
|
||||||
|
const {
|
||||||
|
definition: _ignore, // eslint-disable-line no-unused-vars
|
||||||
|
...obj
|
||||||
|
} = this;
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @typedef {ConfigDependency<import("../../shared/types").Parser>} DependentParser */
|
||||||
|
/** @typedef {ConfigDependency<import("../../shared/types").Plugin>} DependentPlugin */
|
||||||
|
|
||||||
|
module.exports = { ConfigDependency };
|
||||||
146
node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
Normal file
146
node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview `ExtractedConfig` class.
|
||||||
|
*
|
||||||
|
* `ExtractedConfig` class expresses a final configuration for a specific file.
|
||||||
|
*
|
||||||
|
* It provides one method.
|
||||||
|
*
|
||||||
|
* - `toCompatibleObjectAsConfigFileContent()`
|
||||||
|
* Convert this configuration to the compatible object as the content of
|
||||||
|
* config files. It converts the loaded parser and plugins to strings.
|
||||||
|
* `CLIEngine#getConfigForFile(filePath)` method uses this method.
|
||||||
|
*
|
||||||
|
* `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance.
|
||||||
|
*
|
||||||
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const { IgnorePattern } = require("./ignore-pattern");
|
||||||
|
|
||||||
|
// For VSCode intellisense
|
||||||
|
/** @typedef {import("../../shared/types").ConfigData} ConfigData */
|
||||||
|
/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
|
||||||
|
/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */
|
||||||
|
/** @typedef {import("./config-dependency").DependentParser} DependentParser */
|
||||||
|
/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if `xs` starts with `ys`.
|
||||||
|
* @template T
|
||||||
|
* @param {T[]} xs The array to check.
|
||||||
|
* @param {T[]} ys The array that may be the first part of `xs`.
|
||||||
|
* @returns {boolean} `true` if `xs` starts with `ys`.
|
||||||
|
*/
|
||||||
|
function startsWith(xs, ys) {
|
||||||
|
return xs.length >= ys.length && ys.every((y, i) => y === xs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class for extracted config data.
|
||||||
|
*/
|
||||||
|
class ExtractedConfig {
|
||||||
|
constructor() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The config name what `noInlineConfig` setting came from.
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
this.configNameOfNoInlineConfig = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Environments.
|
||||||
|
* @type {Record<string, boolean>}
|
||||||
|
*/
|
||||||
|
this.env = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global variables.
|
||||||
|
* @type {Record<string, GlobalConf>}
|
||||||
|
*/
|
||||||
|
this.globals = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The glob patterns that ignore to lint.
|
||||||
|
* @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined}
|
||||||
|
*/
|
||||||
|
this.ignores = void 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The flag that disables directive comments.
|
||||||
|
* @type {boolean|undefined}
|
||||||
|
*/
|
||||||
|
this.noInlineConfig = void 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parser definition.
|
||||||
|
* @type {DependentParser|null}
|
||||||
|
*/
|
||||||
|
this.parser = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options for the parser.
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
this.parserOptions = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin definitions.
|
||||||
|
* @type {Record<string, DependentPlugin>}
|
||||||
|
*/
|
||||||
|
this.plugins = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processor ID.
|
||||||
|
* @type {string|null}
|
||||||
|
*/
|
||||||
|
this.processor = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The flag that reports unused `eslint-disable` directive comments.
|
||||||
|
* @type {boolean|undefined}
|
||||||
|
*/
|
||||||
|
this.reportUnusedDisableDirectives = void 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rule settings.
|
||||||
|
* @type {Record<string, [SeverityConf, ...any[]]>}
|
||||||
|
*/
|
||||||
|
this.rules = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shared settings.
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
this.settings = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert this config to the compatible object as a config file content.
|
||||||
|
* @returns {ConfigData} The converted object.
|
||||||
|
*/
|
||||||
|
toCompatibleObjectAsConfigFileContent() {
|
||||||
|
const {
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
configNameOfNoInlineConfig: _ignore1,
|
||||||
|
processor: _ignore2,
|
||||||
|
/* eslint-enable no-unused-vars */
|
||||||
|
ignores,
|
||||||
|
...config
|
||||||
|
} = this;
|
||||||
|
|
||||||
|
config.parser = config.parser && config.parser.filePath;
|
||||||
|
config.plugins = Object.keys(config.plugins).filter(Boolean).reverse();
|
||||||
|
config.ignorePatterns = ignores ? ignores.patterns : [];
|
||||||
|
|
||||||
|
// Strip the default patterns from `ignorePatterns`.
|
||||||
|
if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) {
|
||||||
|
config.ignorePatterns =
|
||||||
|
config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { ExtractedConfig };
|
||||||
237
node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
Normal file
237
node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview `IgnorePattern` class.
|
||||||
|
*
|
||||||
|
* `IgnorePattern` class has the set of glob patterns and the base path.
|
||||||
|
*
|
||||||
|
* It provides two static methods.
|
||||||
|
*
|
||||||
|
* - `IgnorePattern.createDefaultIgnore(cwd)`
|
||||||
|
* Create the default predicate function.
|
||||||
|
* - `IgnorePattern.createIgnore(ignorePatterns)`
|
||||||
|
* Create the predicate function from multiple `IgnorePattern` objects.
|
||||||
|
*
|
||||||
|
* It provides two properties and a method.
|
||||||
|
*
|
||||||
|
* - `patterns`
|
||||||
|
* The glob patterns that ignore to lint.
|
||||||
|
* - `basePath`
|
||||||
|
* The base path of the glob patterns. If absolute paths existed in the
|
||||||
|
* glob patterns, those are handled as relative paths to the base path.
|
||||||
|
* - `getPatternsRelativeTo(basePath)`
|
||||||
|
* Get `patterns` as modified for a given base path. It modifies the
|
||||||
|
* absolute paths in the patterns as prepending the difference of two base
|
||||||
|
* paths.
|
||||||
|
*
|
||||||
|
* `ConfigArrayFactory` creates `IgnorePattern` objects when it processes
|
||||||
|
* `ignorePatterns` properties.
|
||||||
|
*
|
||||||
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const assert = require("assert");
|
||||||
|
const path = require("path");
|
||||||
|
const ignore = require("ignore");
|
||||||
|
const debug = require("debug")("eslint:ignore-pattern");
|
||||||
|
|
||||||
|
/** @typedef {ReturnType<import("ignore").default>} Ignore */
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Helpers
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the path to the common ancestor directory of given paths.
|
||||||
|
* @param {string[]} sourcePaths The paths to calculate the common ancestor.
|
||||||
|
* @returns {string} The path to the common ancestor directory.
|
||||||
|
*/
|
||||||
|
function getCommonAncestorPath(sourcePaths) {
|
||||||
|
let result = sourcePaths[0];
|
||||||
|
|
||||||
|
for (let i = 1; i < sourcePaths.length; ++i) {
|
||||||
|
const a = result;
|
||||||
|
const b = sourcePaths[i];
|
||||||
|
|
||||||
|
// Set the shorter one (it's the common ancestor if one includes the other).
|
||||||
|
result = a.length < b.length ? a : b;
|
||||||
|
|
||||||
|
// Set the common ancestor.
|
||||||
|
for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) {
|
||||||
|
if (a[j] !== b[j]) {
|
||||||
|
result = a.slice(0, lastSepPos);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (a[j] === path.sep) {
|
||||||
|
lastSepPos = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let resolvedResult = result || path.sep;
|
||||||
|
|
||||||
|
// if Windows common ancestor is root of drive must have trailing slash to be absolute.
|
||||||
|
if (resolvedResult && resolvedResult.endsWith(":") && process.platform === "win32") {
|
||||||
|
resolvedResult += path.sep;
|
||||||
|
}
|
||||||
|
return resolvedResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make relative path.
|
||||||
|
* @param {string} from The source path to get relative path.
|
||||||
|
* @param {string} to The destination path to get relative path.
|
||||||
|
* @returns {string} The relative path.
|
||||||
|
*/
|
||||||
|
function relative(from, to) {
|
||||||
|
const relPath = path.relative(from, to);
|
||||||
|
|
||||||
|
if (path.sep === "/") {
|
||||||
|
return relPath;
|
||||||
|
}
|
||||||
|
return relPath.split(path.sep).join("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the trailing slash if existed.
|
||||||
|
* @param {string} filePath The path to check.
|
||||||
|
* @returns {string} The trailing slash if existed.
|
||||||
|
*/
|
||||||
|
function dirSuffix(filePath) {
|
||||||
|
const isDir = (
|
||||||
|
filePath.endsWith(path.sep) ||
|
||||||
|
(process.platform === "win32" && filePath.endsWith("/"))
|
||||||
|
);
|
||||||
|
|
||||||
|
return isDir ? "/" : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
const DefaultPatterns = Object.freeze(["/**/node_modules/*"]);
|
||||||
|
const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]);
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Public
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class IgnorePattern {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default patterns.
|
||||||
|
* @type {string[]}
|
||||||
|
*/
|
||||||
|
static get DefaultPatterns() {
|
||||||
|
return DefaultPatterns;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the default predicate function.
|
||||||
|
* @param {string} cwd The current working directory.
|
||||||
|
* @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}}
|
||||||
|
* The preficate function.
|
||||||
|
* The first argument is an absolute path that is checked.
|
||||||
|
* The second argument is the flag to not ignore dotfiles.
|
||||||
|
* If the predicate function returned `true`, it means the path should be ignored.
|
||||||
|
*/
|
||||||
|
static createDefaultIgnore(cwd) {
|
||||||
|
return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the predicate function from multiple `IgnorePattern` objects.
|
||||||
|
* @param {IgnorePattern[]} ignorePatterns The list of ignore patterns.
|
||||||
|
* @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}}
|
||||||
|
* The preficate function.
|
||||||
|
* The first argument is an absolute path that is checked.
|
||||||
|
* The second argument is the flag to not ignore dotfiles.
|
||||||
|
* If the predicate function returned `true`, it means the path should be ignored.
|
||||||
|
*/
|
||||||
|
static createIgnore(ignorePatterns) {
|
||||||
|
debug("Create with: %o", ignorePatterns);
|
||||||
|
|
||||||
|
const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));
|
||||||
|
const patterns = [].concat(
|
||||||
|
...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))
|
||||||
|
);
|
||||||
|
const ig = ignore().add([...DotPatterns, ...patterns]);
|
||||||
|
const dotIg = ignore().add(patterns);
|
||||||
|
|
||||||
|
debug(" processed: %o", { basePath, patterns });
|
||||||
|
|
||||||
|
return Object.assign(
|
||||||
|
(filePath, dot = false) => {
|
||||||
|
assert(path.isAbsolute(filePath), "'filePath' should be an absolute path.");
|
||||||
|
const relPathRaw = relative(basePath, filePath);
|
||||||
|
const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath));
|
||||||
|
const adoptedIg = dot ? dotIg : ig;
|
||||||
|
const result = relPath !== "" && adoptedIg.ignores(relPath);
|
||||||
|
|
||||||
|
debug("Check", { filePath, dot, relativePath: relPath, result });
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
{ basePath, patterns }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a new `IgnorePattern` instance.
|
||||||
|
* @param {string[]} patterns The glob patterns that ignore to lint.
|
||||||
|
* @param {string} basePath The base path of `patterns`.
|
||||||
|
*/
|
||||||
|
constructor(patterns, basePath) {
|
||||||
|
assert(path.isAbsolute(basePath), "'basePath' should be an absolute path.");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The glob patterns that ignore to lint.
|
||||||
|
* @type {string[]}
|
||||||
|
*/
|
||||||
|
this.patterns = patterns;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base path of `patterns`.
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
this.basePath = basePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`.
|
||||||
|
*
|
||||||
|
* It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility.
|
||||||
|
* It's `false` as-is for `ignorePatterns` property in config files.
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.loose = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get `patterns` as modified for a given base path. It modifies the
|
||||||
|
* absolute paths in the patterns as prepending the difference of two base
|
||||||
|
* paths.
|
||||||
|
* @param {string} newBasePath The base path.
|
||||||
|
* @returns {string[]} Modifired patterns.
|
||||||
|
*/
|
||||||
|
getPatternsRelativeTo(newBasePath) {
|
||||||
|
assert(path.isAbsolute(newBasePath), "'newBasePath' should be an absolute path.");
|
||||||
|
const { basePath, loose, patterns } = this;
|
||||||
|
|
||||||
|
if (newBasePath === basePath) {
|
||||||
|
return patterns;
|
||||||
|
}
|
||||||
|
const prefix = `/${relative(newBasePath, basePath)}`;
|
||||||
|
|
||||||
|
return patterns.map(pattern => {
|
||||||
|
const negative = pattern.startsWith("!");
|
||||||
|
const head = negative ? "!" : "";
|
||||||
|
const body = negative ? pattern.slice(1) : pattern;
|
||||||
|
|
||||||
|
if (body.startsWith("/") || body.startsWith("../")) {
|
||||||
|
return `${head}${prefix}${body}`;
|
||||||
|
}
|
||||||
|
return loose ? pattern : `${head}${prefix}/**/${body}`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { IgnorePattern };
|
||||||
20
node_modules/@eslint/eslintrc/lib/config-array/index.js
generated
vendored
Normal file
20
node_modules/@eslint/eslintrc/lib/config-array/index.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview `ConfigArray` class.
|
||||||
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const { ConfigArray, getUsedExtractedConfigs } = require("./config-array");
|
||||||
|
const { ConfigDependency } = require("./config-dependency");
|
||||||
|
const { ExtractedConfig } = require("./extracted-config");
|
||||||
|
const { IgnorePattern } = require("./ignore-pattern");
|
||||||
|
const { OverrideTester } = require("./override-tester");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
ConfigArray,
|
||||||
|
ConfigDependency,
|
||||||
|
ExtractedConfig,
|
||||||
|
IgnorePattern,
|
||||||
|
OverrideTester,
|
||||||
|
getUsedExtractedConfigs
|
||||||
|
};
|
||||||
223
node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
Normal file
223
node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview `OverrideTester` class.
|
||||||
|
*
|
||||||
|
* `OverrideTester` class handles `files` property and `excludedFiles` property
|
||||||
|
* of `overrides` config.
|
||||||
|
*
|
||||||
|
* It provides one method.
|
||||||
|
*
|
||||||
|
* - `test(filePath)`
|
||||||
|
* Test if a file path matches the pair of `files` property and
|
||||||
|
* `excludedFiles` property. The `filePath` argument must be an absolute
|
||||||
|
* path.
|
||||||
|
*
|
||||||
|
* `ConfigArrayFactory` creates `OverrideTester` objects when it processes
|
||||||
|
* `overrides` properties.
|
||||||
|
*
|
||||||
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const assert = require("assert");
|
||||||
|
const path = require("path");
|
||||||
|
const util = require("util");
|
||||||
|
const { Minimatch } = require("minimatch");
|
||||||
|
const minimatchOpts = { dot: true, matchBase: true };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} Pattern
|
||||||
|
* @property {InstanceType<Minimatch>[] | null} includes The positive matchers.
|
||||||
|
* @property {InstanceType<Minimatch>[] | null} excludes The negative matchers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a given pattern to an array.
|
||||||
|
* @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns.
|
||||||
|
* @returns {string[]|null} Normalized patterns.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function normalizePatterns(patterns) {
|
||||||
|
if (Array.isArray(patterns)) {
|
||||||
|
return patterns.filter(Boolean);
|
||||||
|
}
|
||||||
|
if (typeof patterns === "string" && patterns) {
|
||||||
|
return [patterns];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the matchers of given patterns.
|
||||||
|
* @param {string[]} patterns The patterns.
|
||||||
|
* @returns {InstanceType<Minimatch>[] | null} The matchers.
|
||||||
|
*/
|
||||||
|
function toMatcher(patterns) {
|
||||||
|
if (patterns.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return patterns.map(pattern => {
|
||||||
|
if (/^\.[/\\]/u.test(pattern)) {
|
||||||
|
return new Minimatch(
|
||||||
|
pattern.slice(2),
|
||||||
|
|
||||||
|
// `./*.js` should not match with `subdir/foo.js`
|
||||||
|
{ ...minimatchOpts, matchBase: false }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return new Minimatch(pattern, minimatchOpts);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a given matcher to string.
|
||||||
|
* @param {Pattern} matchers The matchers.
|
||||||
|
* @returns {string} The string expression of the matcher.
|
||||||
|
*/
|
||||||
|
function patternToJson({ includes, excludes }) {
|
||||||
|
return {
|
||||||
|
includes: includes && includes.map(m => m.pattern),
|
||||||
|
excludes: excludes && excludes.map(m => m.pattern)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The class to test given paths are matched by the patterns.
|
||||||
|
*/
|
||||||
|
class OverrideTester {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a tester with given criteria.
|
||||||
|
* If there are no criteria, returns `null`.
|
||||||
|
* @param {string|string[]} files The glob patterns for included files.
|
||||||
|
* @param {string|string[]} excludedFiles The glob patterns for excluded files.
|
||||||
|
* @param {string} basePath The path to the base directory to test paths.
|
||||||
|
* @returns {OverrideTester|null} The created instance or `null`.
|
||||||
|
*/
|
||||||
|
static create(files, excludedFiles, basePath) {
|
||||||
|
const includePatterns = normalizePatterns(files);
|
||||||
|
const excludePatterns = normalizePatterns(excludedFiles);
|
||||||
|
let endsWithWildcard = false;
|
||||||
|
|
||||||
|
if (includePatterns.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rejects absolute paths or relative paths to parents.
|
||||||
|
for (const pattern of includePatterns) {
|
||||||
|
if (path.isAbsolute(pattern) || pattern.includes("..")) {
|
||||||
|
throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);
|
||||||
|
}
|
||||||
|
if (pattern.endsWith("*")) {
|
||||||
|
endsWithWildcard = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const pattern of excludePatterns) {
|
||||||
|
if (path.isAbsolute(pattern) || pattern.includes("..")) {
|
||||||
|
throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const includes = toMatcher(includePatterns);
|
||||||
|
const excludes = toMatcher(excludePatterns);
|
||||||
|
|
||||||
|
return new OverrideTester(
|
||||||
|
[{ includes, excludes }],
|
||||||
|
basePath,
|
||||||
|
endsWithWildcard
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combine two testers by logical and.
|
||||||
|
* If either of the testers was `null`, returns the other tester.
|
||||||
|
* The `basePath` property of the two must be the same value.
|
||||||
|
* @param {OverrideTester|null} a A tester.
|
||||||
|
* @param {OverrideTester|null} b Another tester.
|
||||||
|
* @returns {OverrideTester|null} Combined tester.
|
||||||
|
*/
|
||||||
|
static and(a, b) {
|
||||||
|
if (!b) {
|
||||||
|
return a && new OverrideTester(
|
||||||
|
a.patterns,
|
||||||
|
a.basePath,
|
||||||
|
a.endsWithWildcard
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!a) {
|
||||||
|
return new OverrideTester(
|
||||||
|
b.patterns,
|
||||||
|
b.basePath,
|
||||||
|
b.endsWithWildcard
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.strictEqual(a.basePath, b.basePath);
|
||||||
|
return new OverrideTester(
|
||||||
|
a.patterns.concat(b.patterns),
|
||||||
|
a.basePath,
|
||||||
|
a.endsWithWildcard || b.endsWithWildcard
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize this instance.
|
||||||
|
* @param {Pattern[]} patterns The matchers.
|
||||||
|
* @param {string} basePath The base path.
|
||||||
|
* @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`.
|
||||||
|
*/
|
||||||
|
constructor(patterns, basePath, endsWithWildcard = false) {
|
||||||
|
|
||||||
|
/** @type {Pattern[]} */
|
||||||
|
this.patterns = patterns;
|
||||||
|
|
||||||
|
/** @type {string} */
|
||||||
|
this.basePath = basePath;
|
||||||
|
|
||||||
|
/** @type {boolean} */
|
||||||
|
this.endsWithWildcard = endsWithWildcard;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if a given path is matched or not.
|
||||||
|
* @param {string} filePath The absolute path to the target file.
|
||||||
|
* @returns {boolean} `true` if the path was matched.
|
||||||
|
*/
|
||||||
|
test(filePath) {
|
||||||
|
if (typeof filePath !== "string" || !path.isAbsolute(filePath)) {
|
||||||
|
throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`);
|
||||||
|
}
|
||||||
|
const relativePath = path.relative(this.basePath, filePath);
|
||||||
|
|
||||||
|
return this.patterns.every(({ includes, excludes }) => (
|
||||||
|
(!includes || includes.some(m => m.match(relativePath))) &&
|
||||||
|
(!excludes || !excludes.some(m => m.match(relativePath)))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line jsdoc/require-description
|
||||||
|
/**
|
||||||
|
* @returns {Object} a JSON compatible object.
|
||||||
|
*/
|
||||||
|
toJSON() {
|
||||||
|
if (this.patterns.length === 1) {
|
||||||
|
return {
|
||||||
|
...patternToJson(this.patterns[0]),
|
||||||
|
basePath: this.basePath
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
AND: this.patterns.map(patternToJson),
|
||||||
|
basePath: this.basePath
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line jsdoc/require-description
|
||||||
|
/**
|
||||||
|
* @returns {Object} an object to display by `console.log()`.
|
||||||
|
*/
|
||||||
|
[util.inspect.custom]() {
|
||||||
|
return this.toJSON();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { OverrideTester };
|
||||||
51
node_modules/@eslint/eslintrc/lib/index.js
generated
vendored
Normal file
51
node_modules/@eslint/eslintrc/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Package exports for @eslint/eslintrc
|
||||||
|
* @author Nicholas C. Zakas
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const {
|
||||||
|
ConfigArrayFactory,
|
||||||
|
createContext: createConfigArrayFactoryContext
|
||||||
|
} = require("./config-array-factory");
|
||||||
|
|
||||||
|
const { CascadingConfigArrayFactory } = require("./cascading-config-array-factory");
|
||||||
|
const { ModuleResolver } = require("./shared/relative-module-resolver");
|
||||||
|
const { ConfigArray, getUsedExtractedConfigs } = require("./config-array");
|
||||||
|
const { ConfigDependency } = require("./config-array/config-dependency");
|
||||||
|
const { ExtractedConfig } = require("./config-array/extracted-config");
|
||||||
|
const { IgnorePattern } = require("./config-array/ignore-pattern");
|
||||||
|
const { OverrideTester } = require("./config-array/override-tester");
|
||||||
|
const ConfigOps = require("./shared/config-ops");
|
||||||
|
const ConfigValidator = require("./shared/config-validator");
|
||||||
|
const naming = require("./shared/naming");
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Exports
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
Legacy: {
|
||||||
|
ConfigArray,
|
||||||
|
createConfigArrayFactoryContext,
|
||||||
|
CascadingConfigArrayFactory,
|
||||||
|
ConfigArrayFactory,
|
||||||
|
ConfigDependency,
|
||||||
|
ExtractedConfig,
|
||||||
|
IgnorePattern,
|
||||||
|
OverrideTester,
|
||||||
|
getUsedExtractedConfigs,
|
||||||
|
|
||||||
|
// shared
|
||||||
|
ConfigOps,
|
||||||
|
ConfigValidator,
|
||||||
|
ModuleResolver,
|
||||||
|
naming
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
34
node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
Normal file
34
node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview The instance of Ajv validator.
|
||||||
|
* @author Evgeny Poberezkin
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const Ajv = require("ajv"),
|
||||||
|
metaSchema = require("ajv/lib/refs/json-schema-draft-04.json");
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Public Interface
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
module.exports = (additionalOptions = {}) => {
|
||||||
|
const ajv = new Ajv({
|
||||||
|
meta: false,
|
||||||
|
useDefaults: true,
|
||||||
|
validateSchema: false,
|
||||||
|
missingRefs: "ignore",
|
||||||
|
verbose: true,
|
||||||
|
schemaId: "auto",
|
||||||
|
...additionalOptions
|
||||||
|
});
|
||||||
|
|
||||||
|
ajv.addMetaSchema(metaSchema);
|
||||||
|
// eslint-disable-next-line no-underscore-dangle
|
||||||
|
ajv._opts.defaultMeta = metaSchema.id;
|
||||||
|
|
||||||
|
return ajv;
|
||||||
|
};
|
||||||
130
node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
Normal file
130
node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Config file operations. This file must be usable in the browser,
|
||||||
|
* so no Node-specific code can be here.
|
||||||
|
* @author Nicholas C. Zakas
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Private
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const RULE_SEVERITY_STRINGS = ["off", "warn", "error"],
|
||||||
|
RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => {
|
||||||
|
map[value] = index;
|
||||||
|
return map;
|
||||||
|
}, {}),
|
||||||
|
VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"];
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Public Interface
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes the severity value of a rule's configuration to a number
|
||||||
|
* @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally
|
||||||
|
* received from the user. A valid config value is either 0, 1, 2, the string "off" (treated the same as 0),
|
||||||
|
* the string "warn" (treated the same as 1), the string "error" (treated the same as 2), or an array
|
||||||
|
* whose first element is one of the above values. Strings are matched case-insensitively.
|
||||||
|
* @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0.
|
||||||
|
*/
|
||||||
|
getRuleSeverity(ruleConfig) {
|
||||||
|
const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
|
||||||
|
|
||||||
|
if (severityValue === 0 || severityValue === 1 || severityValue === 2) {
|
||||||
|
return severityValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof severityValue === "string") {
|
||||||
|
return RULE_SEVERITY[severityValue.toLowerCase()] || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts old-style severity settings (0, 1, 2) into new-style
|
||||||
|
* severity settings (off, warn, error) for all rules. Assumption is that severity
|
||||||
|
* values have already been validated as correct.
|
||||||
|
* @param {Object} config The config object to normalize.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
normalizeToStrings(config) {
|
||||||
|
|
||||||
|
if (config.rules) {
|
||||||
|
Object.keys(config.rules).forEach(ruleId => {
|
||||||
|
const ruleConfig = config.rules[ruleId];
|
||||||
|
|
||||||
|
if (typeof ruleConfig === "number") {
|
||||||
|
config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0];
|
||||||
|
} else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === "number") {
|
||||||
|
ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the severity for the given rule configuration represents an error.
|
||||||
|
* @param {int|string|Array} ruleConfig The configuration for an individual rule.
|
||||||
|
* @returns {boolean} True if the rule represents an error, false if not.
|
||||||
|
*/
|
||||||
|
isErrorSeverity(ruleConfig) {
|
||||||
|
return module.exports.getRuleSeverity(ruleConfig) === 2;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether a given config has valid severity or not.
|
||||||
|
* @param {number|string|Array} ruleConfig The configuration for an individual rule.
|
||||||
|
* @returns {boolean} `true` if the configuration has valid severity.
|
||||||
|
*/
|
||||||
|
isValidSeverity(ruleConfig) {
|
||||||
|
let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;
|
||||||
|
|
||||||
|
if (typeof severity === "string") {
|
||||||
|
severity = severity.toLowerCase();
|
||||||
|
}
|
||||||
|
return VALID_SEVERITIES.indexOf(severity) !== -1;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether every rule of a given config has valid severity or not.
|
||||||
|
* @param {Object} config The configuration for rules.
|
||||||
|
* @returns {boolean} `true` if the configuration has valid severity.
|
||||||
|
*/
|
||||||
|
isEverySeverityValid(config) {
|
||||||
|
return Object.keys(config).every(ruleId => this.isValidSeverity(config[ruleId]));
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes a value for a global in a config
|
||||||
|
* @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in
|
||||||
|
* a global directive comment
|
||||||
|
* @returns {("readable"|"writeable"|"off")} The value normalized as a string
|
||||||
|
* @throws Error if global value is invalid
|
||||||
|
*/
|
||||||
|
normalizeConfigGlobal(configuredValue) {
|
||||||
|
switch (configuredValue) {
|
||||||
|
case "off":
|
||||||
|
return "off";
|
||||||
|
|
||||||
|
case true:
|
||||||
|
case "true":
|
||||||
|
case "writeable":
|
||||||
|
case "writable":
|
||||||
|
return "writable";
|
||||||
|
|
||||||
|
case null:
|
||||||
|
case false:
|
||||||
|
case "false":
|
||||||
|
case "readable":
|
||||||
|
case "readonly":
|
||||||
|
return "readonly";
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
324
node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
Normal file
324
node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
Normal file
@ -0,0 +1,324 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Validates configs.
|
||||||
|
* @author Brandon Mills
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const
|
||||||
|
util = require("util"),
|
||||||
|
configSchema = require("../../conf/config-schema"),
|
||||||
|
BuiltInEnvironments = require("../../conf/environments"),
|
||||||
|
ConfigOps = require("./config-ops"),
|
||||||
|
{ emitDeprecationWarning } = require("./deprecation-warnings");
|
||||||
|
|
||||||
|
const ajv = require("./ajv")();
|
||||||
|
const ruleValidators = new WeakMap();
|
||||||
|
const noop = Function.prototype;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Private
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
let validateSchema;
|
||||||
|
const severityMap = {
|
||||||
|
error: 2,
|
||||||
|
warn: 1,
|
||||||
|
off: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
const validated = new WeakSet();
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Exports
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
module.exports = class ConfigValidator {
|
||||||
|
constructor({ builtInRules = new Map() } = {}) {
|
||||||
|
this.builtInRules = builtInRules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a complete options schema for a rule.
|
||||||
|
* @param {{create: Function, schema: (Array|null)}} rule A new-style rule object
|
||||||
|
* @returns {Object} JSON Schema for the rule's options.
|
||||||
|
*/
|
||||||
|
getRuleOptionsSchema(rule) {
|
||||||
|
if (!rule) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const schema = rule.schema || rule.meta && rule.meta.schema;
|
||||||
|
|
||||||
|
// Given a tuple of schemas, insert warning level at the beginning
|
||||||
|
if (Array.isArray(schema)) {
|
||||||
|
if (schema.length) {
|
||||||
|
return {
|
||||||
|
type: "array",
|
||||||
|
items: schema,
|
||||||
|
minItems: 0,
|
||||||
|
maxItems: schema.length
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
type: "array",
|
||||||
|
minItems: 0,
|
||||||
|
maxItems: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Given a full schema, leave it alone
|
||||||
|
return schema || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.
|
||||||
|
* @param {options} options The given options for the rule.
|
||||||
|
* @returns {number|string} The rule's severity value
|
||||||
|
*/
|
||||||
|
validateRuleSeverity(options) {
|
||||||
|
const severity = Array.isArray(options) ? options[0] : options;
|
||||||
|
const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity;
|
||||||
|
|
||||||
|
if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) {
|
||||||
|
return normSeverity;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the non-severity options passed to a rule, based on its schema.
|
||||||
|
* @param {{create: Function}} rule The rule to validate
|
||||||
|
* @param {Array} localOptions The options for the rule, excluding severity
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
validateRuleSchema(rule, localOptions) {
|
||||||
|
if (!ruleValidators.has(rule)) {
|
||||||
|
const schema = this.getRuleOptionsSchema(rule);
|
||||||
|
|
||||||
|
if (schema) {
|
||||||
|
ruleValidators.set(rule, ajv.compile(schema));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const validateRule = ruleValidators.get(rule);
|
||||||
|
|
||||||
|
if (validateRule) {
|
||||||
|
validateRule(localOptions);
|
||||||
|
if (validateRule.errors) {
|
||||||
|
throw new Error(validateRule.errors.map(
|
||||||
|
error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`
|
||||||
|
).join(""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a rule's options against its schema.
|
||||||
|
* @param {{create: Function}|null} rule The rule that the config is being validated for
|
||||||
|
* @param {string} ruleId The rule's unique name.
|
||||||
|
* @param {Array|number} options The given options for the rule.
|
||||||
|
* @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,
|
||||||
|
* no source is prepended to the message.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
validateRuleOptions(rule, ruleId, options, source = null) {
|
||||||
|
try {
|
||||||
|
const severity = this.validateRuleSeverity(options);
|
||||||
|
|
||||||
|
if (severity !== 0) {
|
||||||
|
this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`;
|
||||||
|
|
||||||
|
if (typeof source === "string") {
|
||||||
|
throw new Error(`${source}:\n\t${enhancedMessage}`);
|
||||||
|
} else {
|
||||||
|
throw new Error(enhancedMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates an environment object
|
||||||
|
* @param {Object} environment The environment config object to validate.
|
||||||
|
* @param {string} source The name of the configuration source to report in any errors.
|
||||||
|
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
validateEnvironment(
|
||||||
|
environment,
|
||||||
|
source,
|
||||||
|
getAdditionalEnv = noop
|
||||||
|
) {
|
||||||
|
|
||||||
|
// not having an environment is ok
|
||||||
|
if (!environment) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.keys(environment).forEach(id => {
|
||||||
|
const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null;
|
||||||
|
|
||||||
|
if (!env) {
|
||||||
|
const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`;
|
||||||
|
|
||||||
|
throw new Error(message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a rules config object
|
||||||
|
* @param {Object} rulesConfig The rules config object to validate.
|
||||||
|
* @param {string} source The name of the configuration source to report in any errors.
|
||||||
|
* @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
validateRules(
|
||||||
|
rulesConfig,
|
||||||
|
source,
|
||||||
|
getAdditionalRule = noop
|
||||||
|
) {
|
||||||
|
if (!rulesConfig) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.keys(rulesConfig).forEach(id => {
|
||||||
|
const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null;
|
||||||
|
|
||||||
|
this.validateRuleOptions(rule, id, rulesConfig[id], source);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a `globals` section of a config file
|
||||||
|
* @param {Object} globalsConfig The `globals` section
|
||||||
|
* @param {string|null} source The name of the configuration source to report in the event of an error.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
validateGlobals(globalsConfig, source = null) {
|
||||||
|
if (!globalsConfig) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.entries(globalsConfig)
|
||||||
|
.forEach(([configuredGlobal, configuredValue]) => {
|
||||||
|
try {
|
||||||
|
ConfigOps.normalizeConfigGlobal(configuredValue);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate `processor` configuration.
|
||||||
|
* @param {string|undefined} processorName The processor name.
|
||||||
|
* @param {string} source The name of config file.
|
||||||
|
* @param {function(id:string): Processor} getProcessor The getter of defined processors.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
validateProcessor(processorName, source, getProcessor) {
|
||||||
|
if (processorName && !getProcessor(processorName)) {
|
||||||
|
throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats an array of schema validation errors.
|
||||||
|
* @param {Array} errors An array of error messages to format.
|
||||||
|
* @returns {string} Formatted error message
|
||||||
|
*/
|
||||||
|
formatErrors(errors) {
|
||||||
|
return errors.map(error => {
|
||||||
|
if (error.keyword === "additionalProperties") {
|
||||||
|
const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty;
|
||||||
|
|
||||||
|
return `Unexpected top-level property "${formattedPropertyPath}"`;
|
||||||
|
}
|
||||||
|
if (error.keyword === "type") {
|
||||||
|
const formattedField = error.dataPath.slice(1);
|
||||||
|
const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema;
|
||||||
|
const formattedValue = JSON.stringify(error.data);
|
||||||
|
|
||||||
|
return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath;
|
||||||
|
|
||||||
|
return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`;
|
||||||
|
}).map(message => `\t- ${message}.\n`).join("");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the top level properties of the config object.
|
||||||
|
* @param {Object} config The config object to validate.
|
||||||
|
* @param {string} source The name of the configuration source to report in any errors.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
validateConfigSchema(config, source = null) {
|
||||||
|
validateSchema = this.validateSchema || ajv.compile(configSchema);
|
||||||
|
|
||||||
|
if (!validateSchema(config)) {
|
||||||
|
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
|
||||||
|
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates an entire config object.
|
||||||
|
* @param {Object} config The config object to validate.
|
||||||
|
* @param {string} source The name of the configuration source to report in any errors.
|
||||||
|
* @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||||
|
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
validate(config, source, getAdditionalRule, getAdditionalEnv) {
|
||||||
|
this.validateConfigSchema(config, source);
|
||||||
|
this.validateRules(config.rules, source, getAdditionalRule);
|
||||||
|
this.validateEnvironment(config.env, source, getAdditionalEnv);
|
||||||
|
this.validateGlobals(config.globals, source);
|
||||||
|
|
||||||
|
for (const override of config.overrides || []) {
|
||||||
|
this.validateRules(override.rules, source, getAdditionalRule);
|
||||||
|
this.validateEnvironment(override.env, source, getAdditionalEnv);
|
||||||
|
this.validateGlobals(config.globals, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate config array object.
|
||||||
|
* @param {ConfigArray} configArray The config array to validate.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
validateConfigArray(configArray) {
|
||||||
|
const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments);
|
||||||
|
const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors);
|
||||||
|
const getPluginRule = Map.prototype.get.bind(configArray.pluginRules);
|
||||||
|
|
||||||
|
// Validate.
|
||||||
|
for (const element of configArray) {
|
||||||
|
if (validated.has(element)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
validated.add(element);
|
||||||
|
|
||||||
|
this.validateEnvironment(element.env, element.name, getPluginEnv);
|
||||||
|
this.validateGlobals(element.globals, element.name);
|
||||||
|
this.validateProcessor(element.processor, element.name, getPluginProcessor);
|
||||||
|
this.validateRules(element.rules, element.name, getPluginRule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
56
node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
Normal file
56
node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Provide the function that emits deprecation warnings.
|
||||||
|
* @author Toru Nagashima <http://github.com/mysticatea>
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
const lodash = require("lodash");
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Private
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Defitions for deprecation warnings.
|
||||||
|
const deprecationWarningMessages = {
|
||||||
|
ESLINT_LEGACY_ECMAFEATURES:
|
||||||
|
"The 'ecmaFeatures' config file property is deprecated and has no effect.",
|
||||||
|
ESLINT_PERSONAL_CONFIG_LOAD:
|
||||||
|
"'~/.eslintrc.*' config files have been deprecated. " +
|
||||||
|
"Please use a config file per project or the '--config' option.",
|
||||||
|
ESLINT_PERSONAL_CONFIG_SUPPRESS:
|
||||||
|
"'~/.eslintrc.*' config files have been deprecated. " +
|
||||||
|
"Please remove it or add 'root:true' to the config files in your " +
|
||||||
|
"projects in order to avoid loading '~/.eslintrc.*' accidentally."
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted
|
||||||
|
* for each unique file path, but repeated invocations with the same file path have no effect.
|
||||||
|
* No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.
|
||||||
|
* @param {string} source The name of the configuration source to report the warning for.
|
||||||
|
* @param {string} errorCode The warning message to show.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
const emitDeprecationWarning = lodash.memoize((source, errorCode) => {
|
||||||
|
const rel = path.relative(process.cwd(), source);
|
||||||
|
const message = deprecationWarningMessages[errorCode];
|
||||||
|
|
||||||
|
process.emitWarning(
|
||||||
|
`${message} (found in "${rel}")`,
|
||||||
|
"DeprecationWarning",
|
||||||
|
errorCode
|
||||||
|
);
|
||||||
|
}, (...args) => JSON.stringify(args));
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Public Interface
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
emitDeprecationWarning
|
||||||
|
};
|
||||||
97
node_modules/@eslint/eslintrc/lib/shared/naming.js
generated
vendored
Normal file
97
node_modules/@eslint/eslintrc/lib/shared/naming.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview Common helpers for naming of plugins, formatters and configs
|
||||||
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const NAMESPACE_REGEX = /^@.*\//iu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Brings package name to correct format based on prefix
|
||||||
|
* @param {string} name The name of the package.
|
||||||
|
* @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter"
|
||||||
|
* @returns {string} Normalized name of the package
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function normalizePackageName(name, prefix) {
|
||||||
|
let normalizedName = name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On Windows, name can come in with Windows slashes instead of Unix slashes.
|
||||||
|
* Normalize to Unix first to avoid errors later on.
|
||||||
|
* https://github.com/eslint/eslint/issues/5644
|
||||||
|
*/
|
||||||
|
if (normalizedName.includes("\\")) {
|
||||||
|
normalizedName = normalizedName.replace(/\\/gu, "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (normalizedName.charAt(0) === "@") {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* it's a scoped package
|
||||||
|
* package name is the prefix, or just a username
|
||||||
|
*/
|
||||||
|
const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"),
|
||||||
|
scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u");
|
||||||
|
|
||||||
|
if (scopedPackageShortcutRegex.test(normalizedName)) {
|
||||||
|
normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`);
|
||||||
|
} else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* for scoped packages, insert the prefix after the first / unless
|
||||||
|
* the path is already @scope/eslint or @scope/eslint-xxx-yyy
|
||||||
|
*/
|
||||||
|
normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`);
|
||||||
|
}
|
||||||
|
} else if (!normalizedName.startsWith(`${prefix}-`)) {
|
||||||
|
normalizedName = `${prefix}-${normalizedName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return normalizedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the prefix from a fullname.
|
||||||
|
* @param {string} fullname The term which may have the prefix.
|
||||||
|
* @param {string} prefix The prefix to remove.
|
||||||
|
* @returns {string} The term without prefix.
|
||||||
|
*/
|
||||||
|
function getShorthandName(fullname, prefix) {
|
||||||
|
if (fullname[0] === "@") {
|
||||||
|
let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname);
|
||||||
|
|
||||||
|
if (matchResult) {
|
||||||
|
return matchResult[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname);
|
||||||
|
if (matchResult) {
|
||||||
|
return `${matchResult[1]}/${matchResult[2]}`;
|
||||||
|
}
|
||||||
|
} else if (fullname.startsWith(`${prefix}-`)) {
|
||||||
|
return fullname.slice(prefix.length + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fullname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the scope (namespace) of a term.
|
||||||
|
* @param {string} term The term which may have the namespace.
|
||||||
|
* @returns {string} The namespace of the term if it has one.
|
||||||
|
*/
|
||||||
|
function getNamespaceFromTerm(term) {
|
||||||
|
const match = term.match(NAMESPACE_REGEX);
|
||||||
|
|
||||||
|
return match ? match[0] : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Public Interface
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
normalizePackageName,
|
||||||
|
getShorthandName,
|
||||||
|
getNamespaceFromTerm
|
||||||
|
};
|
||||||
44
node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
Normal file
44
node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* Utility for resolving a module relative to another module
|
||||||
|
* @author Teddy Katz
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Module = require("module");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* `Module.createRequire` is added in v12.2.0. It supports URL as well.
|
||||||
|
* We only support the case where the argument is a filepath, not a URL.
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line node/no-unsupported-features/node-builtins, node/no-deprecated-api
|
||||||
|
const createRequire = Module.createRequire || Module.createRequireFromPath;
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves a Node module relative to another module
|
||||||
|
* @param {string} moduleName The name of a Node module, or a path to a Node module.
|
||||||
|
* @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be
|
||||||
|
* a file rather than a directory, but the file need not actually exist.
|
||||||
|
* @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`
|
||||||
|
*/
|
||||||
|
resolve(moduleName, relativeToPath) {
|
||||||
|
try {
|
||||||
|
return createRequire(relativeToPath).resolve(moduleName);
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
// This `if` block is for older Node.js than 12.0.0. We can remove this block in the future.
|
||||||
|
if (
|
||||||
|
typeof error === "object" &&
|
||||||
|
error !== null &&
|
||||||
|
error.code === "MODULE_NOT_FOUND" &&
|
||||||
|
!error.requireStack &&
|
||||||
|
error.message.includes(moduleName)
|
||||||
|
) {
|
||||||
|
error.message += `\nRequire stack:\n- ${relativeToPath}`;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
90
node_modules/@eslint/eslintrc/package.json
generated
vendored
Normal file
90
node_modules/@eslint/eslintrc/package.json
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
{
|
||||||
|
"_from": "@eslint/eslintrc@^0.1.3",
|
||||||
|
"_id": "@eslint/eslintrc@0.1.3",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA==",
|
||||||
|
"_location": "/@eslint/eslintrc",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@eslint/eslintrc@^0.1.3",
|
||||||
|
"name": "@eslint/eslintrc",
|
||||||
|
"escapedName": "@eslint%2feslintrc",
|
||||||
|
"scope": "@eslint",
|
||||||
|
"rawSpec": "^0.1.3",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^0.1.3"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/eslint"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.3.tgz",
|
||||||
|
"_shasum": "7d1a2b2358552cc04834c0979bd4275362e37085",
|
||||||
|
"_spec": "@eslint/eslintrc@^0.1.3",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/eslint",
|
||||||
|
"author": {
|
||||||
|
"name": "Nicholas C. Zakas"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/eslint/eslintrc/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"ajv": "^6.12.4",
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"espree": "^7.3.0",
|
||||||
|
"globals": "^12.1.0",
|
||||||
|
"ignore": "^4.0.6",
|
||||||
|
"import-fresh": "^3.2.1",
|
||||||
|
"js-yaml": "^3.13.1",
|
||||||
|
"lodash": "^4.17.19",
|
||||||
|
"minimatch": "^3.0.4",
|
||||||
|
"strip-json-comments": "^3.1.1"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "The legacy ESLintRC config file format for ESLint",
|
||||||
|
"devDependencies": {
|
||||||
|
"chai": "^4.2.0",
|
||||||
|
"eslint": "^7.7.0",
|
||||||
|
"eslint-config-eslint": "^6.0.0",
|
||||||
|
"eslint-plugin-jsdoc": "^22.1.0",
|
||||||
|
"eslint-plugin-node": "^11.1.0",
|
||||||
|
"eslint-release": "^3.1.2",
|
||||||
|
"mocha": "^8.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^10.12.0 || >=12.0.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"conf",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/eslint/eslintrc#readme",
|
||||||
|
"keywords": [
|
||||||
|
"ESLint",
|
||||||
|
"ESLintRC",
|
||||||
|
"Configuration"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"name": "@eslint/eslintrc",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/eslint/eslintrc.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"generate-alpharelease": "eslint-generate-prerelease alpha",
|
||||||
|
"generate-betarelease": "eslint-generate-prerelease beta",
|
||||||
|
"generate-rcrelease": "eslint-generate-prerelease rc",
|
||||||
|
"generate-release": "eslint-generate-release",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"publish-release": "eslint-publish-release",
|
||||||
|
"test": "mocha tests/lib/shared"
|
||||||
|
},
|
||||||
|
"version": "0.1.3"
|
||||||
|
}
|
||||||
18
node_modules/@types/json5/README.md
generated
vendored
Normal file
18
node_modules/@types/json5/README.md
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Installation
|
||||||
|
> `npm install --save @types/json5`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for JSON5 (http://json5.org/).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/json5
|
||||||
|
|
||||||
|
Additional Details
|
||||||
|
* Last updated: Mon, 19 Sep 2016 17:28:59 GMT
|
||||||
|
* File structure: ProperModule
|
||||||
|
* Library Dependencies: none
|
||||||
|
* Module Dependencies: none
|
||||||
|
* Global values: json5
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by Jason Swearingen <https://jasonswearingen.github.io>.
|
||||||
44
node_modules/@types/json5/index.d.ts
generated
vendored
Normal file
44
node_modules/@types/json5/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// Type definitions for JSON5
|
||||||
|
// Project: http://json5.org/
|
||||||
|
// Definitions by: Jason Swearingen <https://jasonswearingen.github.io>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
|
||||||
|
//commonjs loader
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The following is the exact list of additions to JSON's syntax introduced by JSON5. All of these are optional, and all of these come from ES5.
|
||||||
|
|
||||||
|
Objects
|
||||||
|
|
||||||
|
Object keys can be unquoted if they're valid identifiers. Yes, even reserved keywords (like default) are valid unquoted keys in ES5 [§11.1.5, §7.6]. (More info)
|
||||||
|
|
||||||
|
(TODO: Unicode characters and escape sequences aren’t yet supported in this implementation.)
|
||||||
|
|
||||||
|
Objects can have trailing commas.
|
||||||
|
|
||||||
|
Arrays
|
||||||
|
|
||||||
|
Arrays can have trailing commas.
|
||||||
|
Strings
|
||||||
|
|
||||||
|
Strings can be single-quoted.
|
||||||
|
|
||||||
|
Strings can be split across multiple lines; just prefix each newline with a backslash. [ES5 §7.8.4]
|
||||||
|
|
||||||
|
Numbers
|
||||||
|
|
||||||
|
Numbers can be hexadecimal (base 16).
|
||||||
|
|
||||||
|
Numbers can begin or end with a (leading or trailing) decimal point.
|
||||||
|
|
||||||
|
Numbers can include Infinity, -Infinity, NaN, and -NaN.
|
||||||
|
|
||||||
|
Numbers can begin with an explicit plus sign.
|
||||||
|
|
||||||
|
Comments
|
||||||
|
|
||||||
|
Both inline (single-line) and block (multi-line) comments are allowed.
|
||||||
|
*/
|
||||||
|
declare var json5: JSON;
|
||||||
|
export = json5;
|
||||||
49
node_modules/@types/json5/package.json
generated
vendored
Normal file
49
node_modules/@types/json5/package.json
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"_from": "@types/json5@^0.0.29",
|
||||||
|
"_id": "@types/json5@0.0.29",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
|
||||||
|
"_location": "/@types/json5",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@types/json5@^0.0.29",
|
||||||
|
"name": "@types/json5",
|
||||||
|
"escapedName": "@types%2fjson5",
|
||||||
|
"scope": "@types",
|
||||||
|
"rawSpec": "^0.0.29",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^0.0.29"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/tsconfig-paths"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||||
|
"_shasum": "ee28707ae94e11d2b827bcbe5270bcea7f3e71ee",
|
||||||
|
"_spec": "@types/json5@^0.0.29",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/tsconfig-paths",
|
||||||
|
"author": {
|
||||||
|
"name": "Jason Swearingen",
|
||||||
|
"email": "https://jasonswearingen.github.io"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "TypeScript definitions for JSON5",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "",
|
||||||
|
"name": "@types/json5",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"typesPublisherContentHash": "1ed77f2bfd59d290798abf89db281c36565f4a78d97d4e9caab25319d54c6331",
|
||||||
|
"typings": "index.d.ts",
|
||||||
|
"version": "0.0.29"
|
||||||
|
}
|
||||||
25
node_modules/@types/json5/types-metadata.json
generated
vendored
Normal file
25
node_modules/@types/json5/types-metadata.json
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"authors": "Jason Swearingen <https://jasonswearingen.github.io>",
|
||||||
|
"definitionFilename": "index.d.ts",
|
||||||
|
"libraryDependencies": [],
|
||||||
|
"moduleDependencies": [],
|
||||||
|
"libraryMajorVersion": "0",
|
||||||
|
"libraryMinorVersion": "0",
|
||||||
|
"libraryName": "JSON5",
|
||||||
|
"typingsPackageName": "json5",
|
||||||
|
"projectName": "http://json5.org/",
|
||||||
|
"sourceRepoURL": "https://www.github.com/DefinitelyTyped/DefinitelyTyped",
|
||||||
|
"sourceBranch": "types-2.0",
|
||||||
|
"kind": "ProperModule",
|
||||||
|
"globals": [
|
||||||
|
"json5"
|
||||||
|
],
|
||||||
|
"declaredModules": [
|
||||||
|
"json5"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"hasPackageJson": false,
|
||||||
|
"contentHash": "1ed77f2bfd59d290798abf89db281c36565f4a78d97d4e9caab25319d54c6331"
|
||||||
|
}
|
||||||
19
node_modules/acorn-jsx/LICENSE
generated
vendored
Normal file
19
node_modules/acorn-jsx/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Copyright (C) 2012-2017 by Ingvar Stepanyan
|
||||||
|
|
||||||
|
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.
|
||||||
40
node_modules/acorn-jsx/README.md
generated
vendored
Normal file
40
node_modules/acorn-jsx/README.md
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Acorn-JSX
|
||||||
|
|
||||||
|
[](https://travis-ci.org/acornjs/acorn-jsx)
|
||||||
|
[](https://www.npmjs.org/package/acorn-jsx)
|
||||||
|
|
||||||
|
This is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
|
||||||
|
|
||||||
|
It was created as an experimental alternative, faster [React.js JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) parser. Later, it replaced the [official parser](https://github.com/facebookarchive/esprima) and these days is used by many prominent development tools.
|
||||||
|
|
||||||
|
## Transpiler
|
||||||
|
|
||||||
|
Please note that this tool only parses source code to JSX AST, which is useful for various language tools and services. If you want to transpile your code to regular ES5-compliant JavaScript with source map, check out [Babel](https://babeljs.io/) and [Buble](https://buble.surge.sh/) transpilers which use `acorn-jsx` under the hood.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Requiring this module provides you with an Acorn plugin that you can use like this:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var acorn = require("acorn");
|
||||||
|
var jsx = require("acorn-jsx");
|
||||||
|
acorn.Parser.extend(jsx()).parse("my(<jsx/>, 'code');");
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that official spec doesn't support mix of XML namespaces and object-style access in tag names (#27) like in `<namespace:Object.Property />`, so it was deprecated in `acorn-jsx@3.0`. If you still want to opt-in to support of such constructions, you can pass the following option:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
acorn.Parser.extend(jsx({ allowNamespacedObjects: true }))
|
||||||
|
```
|
||||||
|
|
||||||
|
Also, since most apps use pure React transformer, a new option was introduced that allows to prohibit namespaces completely:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
acorn.Parser.extend(jsx({ allowNamespaces: false }))
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that by default `allowNamespaces` is enabled for spec compliancy.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This plugin is issued under the [MIT license](./LICENSE).
|
||||||
488
node_modules/acorn-jsx/index.js
generated
vendored
Normal file
488
node_modules/acorn-jsx/index.js
generated
vendored
Normal file
@ -0,0 +1,488 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const XHTMLEntities = require('./xhtml');
|
||||||
|
|
||||||
|
const hexNumber = /^[\da-fA-F]+$/;
|
||||||
|
const decimalNumber = /^\d+$/;
|
||||||
|
|
||||||
|
// The map to `acorn-jsx` tokens from `acorn` namespace objects.
|
||||||
|
const acornJsxMap = new WeakMap();
|
||||||
|
|
||||||
|
// Get the original tokens for the given `acorn` namespace object.
|
||||||
|
function getJsxTokens(acorn) {
|
||||||
|
acorn = acorn.Parser.acorn || acorn;
|
||||||
|
let acornJsx = acornJsxMap.get(acorn);
|
||||||
|
if (!acornJsx) {
|
||||||
|
const tt = acorn.tokTypes;
|
||||||
|
const TokContext = acorn.TokContext;
|
||||||
|
const TokenType = acorn.TokenType;
|
||||||
|
const tc_oTag = new TokContext('<tag', false);
|
||||||
|
const tc_cTag = new TokContext('</tag', false);
|
||||||
|
const tc_expr = new TokContext('<tag>...</tag>', true, true);
|
||||||
|
const tokContexts = {
|
||||||
|
tc_oTag: tc_oTag,
|
||||||
|
tc_cTag: tc_cTag,
|
||||||
|
tc_expr: tc_expr
|
||||||
|
};
|
||||||
|
const tokTypes = {
|
||||||
|
jsxName: new TokenType('jsxName'),
|
||||||
|
jsxText: new TokenType('jsxText', {beforeExpr: true}),
|
||||||
|
jsxTagStart: new TokenType('jsxTagStart', {startsExpr: true}),
|
||||||
|
jsxTagEnd: new TokenType('jsxTagEnd')
|
||||||
|
};
|
||||||
|
|
||||||
|
tokTypes.jsxTagStart.updateContext = function() {
|
||||||
|
this.context.push(tc_expr); // treat as beginning of JSX expression
|
||||||
|
this.context.push(tc_oTag); // start opening tag context
|
||||||
|
this.exprAllowed = false;
|
||||||
|
};
|
||||||
|
tokTypes.jsxTagEnd.updateContext = function(prevType) {
|
||||||
|
let out = this.context.pop();
|
||||||
|
if (out === tc_oTag && prevType === tt.slash || out === tc_cTag) {
|
||||||
|
this.context.pop();
|
||||||
|
this.exprAllowed = this.curContext() === tc_expr;
|
||||||
|
} else {
|
||||||
|
this.exprAllowed = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
acornJsx = { tokContexts: tokContexts, tokTypes: tokTypes };
|
||||||
|
acornJsxMap.set(acorn, acornJsx);
|
||||||
|
}
|
||||||
|
|
||||||
|
return acornJsx;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transforms JSX element name to string.
|
||||||
|
|
||||||
|
function getQualifiedJSXName(object) {
|
||||||
|
if (!object)
|
||||||
|
return object;
|
||||||
|
|
||||||
|
if (object.type === 'JSXIdentifier')
|
||||||
|
return object.name;
|
||||||
|
|
||||||
|
if (object.type === 'JSXNamespacedName')
|
||||||
|
return object.namespace.name + ':' + object.name.name;
|
||||||
|
|
||||||
|
if (object.type === 'JSXMemberExpression')
|
||||||
|
return getQualifiedJSXName(object.object) + '.' +
|
||||||
|
getQualifiedJSXName(object.property);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = function(options) {
|
||||||
|
options = options || {};
|
||||||
|
return function(Parser) {
|
||||||
|
return plugin({
|
||||||
|
allowNamespaces: options.allowNamespaces !== false,
|
||||||
|
allowNamespacedObjects: !!options.allowNamespacedObjects
|
||||||
|
}, Parser);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// This is `tokTypes` of the peer dep.
|
||||||
|
// This can be different instances from the actual `tokTypes` this plugin uses.
|
||||||
|
Object.defineProperty(module.exports, "tokTypes", {
|
||||||
|
get: function get_tokTypes() {
|
||||||
|
return getJsxTokens(require("acorn")).tokTypes;
|
||||||
|
},
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function plugin(options, Parser) {
|
||||||
|
const acorn = Parser.acorn || require("acorn");
|
||||||
|
const acornJsx = getJsxTokens(acorn);
|
||||||
|
const tt = acorn.tokTypes;
|
||||||
|
const tok = acornJsx.tokTypes;
|
||||||
|
const tokContexts = acorn.tokContexts;
|
||||||
|
const tc_oTag = acornJsx.tokContexts.tc_oTag;
|
||||||
|
const tc_cTag = acornJsx.tokContexts.tc_cTag;
|
||||||
|
const tc_expr = acornJsx.tokContexts.tc_expr;
|
||||||
|
const isNewLine = acorn.isNewLine;
|
||||||
|
const isIdentifierStart = acorn.isIdentifierStart;
|
||||||
|
const isIdentifierChar = acorn.isIdentifierChar;
|
||||||
|
|
||||||
|
return class extends Parser {
|
||||||
|
// Expose actual `tokTypes` and `tokContexts` to other plugins.
|
||||||
|
static get acornJsx() {
|
||||||
|
return acornJsx;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reads inline JSX contents token.
|
||||||
|
jsx_readToken() {
|
||||||
|
let out = '', chunkStart = this.pos;
|
||||||
|
for (;;) {
|
||||||
|
if (this.pos >= this.input.length)
|
||||||
|
this.raise(this.start, 'Unterminated JSX contents');
|
||||||
|
let ch = this.input.charCodeAt(this.pos);
|
||||||
|
|
||||||
|
switch (ch) {
|
||||||
|
case 60: // '<'
|
||||||
|
case 123: // '{'
|
||||||
|
if (this.pos === this.start) {
|
||||||
|
if (ch === 60 && this.exprAllowed) {
|
||||||
|
++this.pos;
|
||||||
|
return this.finishToken(tok.jsxTagStart);
|
||||||
|
}
|
||||||
|
return this.getTokenFromCode(ch);
|
||||||
|
}
|
||||||
|
out += this.input.slice(chunkStart, this.pos);
|
||||||
|
return this.finishToken(tok.jsxText, out);
|
||||||
|
|
||||||
|
case 38: // '&'
|
||||||
|
out += this.input.slice(chunkStart, this.pos);
|
||||||
|
out += this.jsx_readEntity();
|
||||||
|
chunkStart = this.pos;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 62: // '>'
|
||||||
|
case 125: // '}'
|
||||||
|
this.raise(
|
||||||
|
this.pos,
|
||||||
|
"Unexpected token `" + this.input[this.pos] + "`. Did you mean `" +
|
||||||
|
(ch === 62 ? ">" : "}") + "` or " + "`{\"" + this.input[this.pos] + "\"}" + "`?"
|
||||||
|
);
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (isNewLine(ch)) {
|
||||||
|
out += this.input.slice(chunkStart, this.pos);
|
||||||
|
out += this.jsx_readNewLine(true);
|
||||||
|
chunkStart = this.pos;
|
||||||
|
} else {
|
||||||
|
++this.pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jsx_readNewLine(normalizeCRLF) {
|
||||||
|
let ch = this.input.charCodeAt(this.pos);
|
||||||
|
let out;
|
||||||
|
++this.pos;
|
||||||
|
if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
|
||||||
|
++this.pos;
|
||||||
|
out = normalizeCRLF ? '\n' : '\r\n';
|
||||||
|
} else {
|
||||||
|
out = String.fromCharCode(ch);
|
||||||
|
}
|
||||||
|
if (this.options.locations) {
|
||||||
|
++this.curLine;
|
||||||
|
this.lineStart = this.pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
jsx_readString(quote) {
|
||||||
|
let out = '', chunkStart = ++this.pos;
|
||||||
|
for (;;) {
|
||||||
|
if (this.pos >= this.input.length)
|
||||||
|
this.raise(this.start, 'Unterminated string constant');
|
||||||
|
let ch = this.input.charCodeAt(this.pos);
|
||||||
|
if (ch === quote) break;
|
||||||
|
if (ch === 38) { // '&'
|
||||||
|
out += this.input.slice(chunkStart, this.pos);
|
||||||
|
out += this.jsx_readEntity();
|
||||||
|
chunkStart = this.pos;
|
||||||
|
} else if (isNewLine(ch)) {
|
||||||
|
out += this.input.slice(chunkStart, this.pos);
|
||||||
|
out += this.jsx_readNewLine(false);
|
||||||
|
chunkStart = this.pos;
|
||||||
|
} else {
|
||||||
|
++this.pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out += this.input.slice(chunkStart, this.pos++);
|
||||||
|
return this.finishToken(tt.string, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
jsx_readEntity() {
|
||||||
|
let str = '', count = 0, entity;
|
||||||
|
let ch = this.input[this.pos];
|
||||||
|
if (ch !== '&')
|
||||||
|
this.raise(this.pos, 'Entity must start with an ampersand');
|
||||||
|
let startPos = ++this.pos;
|
||||||
|
while (this.pos < this.input.length && count++ < 10) {
|
||||||
|
ch = this.input[this.pos++];
|
||||||
|
if (ch === ';') {
|
||||||
|
if (str[0] === '#') {
|
||||||
|
if (str[1] === 'x') {
|
||||||
|
str = str.substr(2);
|
||||||
|
if (hexNumber.test(str))
|
||||||
|
entity = String.fromCharCode(parseInt(str, 16));
|
||||||
|
} else {
|
||||||
|
str = str.substr(1);
|
||||||
|
if (decimalNumber.test(str))
|
||||||
|
entity = String.fromCharCode(parseInt(str, 10));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
entity = XHTMLEntities[str];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
str += ch;
|
||||||
|
}
|
||||||
|
if (!entity) {
|
||||||
|
this.pos = startPos;
|
||||||
|
return '&';
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read a JSX identifier (valid tag or attribute name).
|
||||||
|
//
|
||||||
|
// Optimized version since JSX identifiers can't contain
|
||||||
|
// escape characters and so can be read as single slice.
|
||||||
|
// Also assumes that first character was already checked
|
||||||
|
// by isIdentifierStart in readToken.
|
||||||
|
|
||||||
|
jsx_readWord() {
|
||||||
|
let ch, start = this.pos;
|
||||||
|
do {
|
||||||
|
ch = this.input.charCodeAt(++this.pos);
|
||||||
|
} while (isIdentifierChar(ch) || ch === 45); // '-'
|
||||||
|
return this.finishToken(tok.jsxName, this.input.slice(start, this.pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse next token as JSX identifier
|
||||||
|
|
||||||
|
jsx_parseIdentifier() {
|
||||||
|
let node = this.startNode();
|
||||||
|
if (this.type === tok.jsxName)
|
||||||
|
node.name = this.value;
|
||||||
|
else if (this.type.keyword)
|
||||||
|
node.name = this.type.keyword;
|
||||||
|
else
|
||||||
|
this.unexpected();
|
||||||
|
this.next();
|
||||||
|
return this.finishNode(node, 'JSXIdentifier');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse namespaced identifier.
|
||||||
|
|
||||||
|
jsx_parseNamespacedName() {
|
||||||
|
let startPos = this.start, startLoc = this.startLoc;
|
||||||
|
let name = this.jsx_parseIdentifier();
|
||||||
|
if (!options.allowNamespaces || !this.eat(tt.colon)) return name;
|
||||||
|
var node = this.startNodeAt(startPos, startLoc);
|
||||||
|
node.namespace = name;
|
||||||
|
node.name = this.jsx_parseIdentifier();
|
||||||
|
return this.finishNode(node, 'JSXNamespacedName');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses element name in any form - namespaced, member
|
||||||
|
// or single identifier.
|
||||||
|
|
||||||
|
jsx_parseElementName() {
|
||||||
|
if (this.type === tok.jsxTagEnd) return '';
|
||||||
|
let startPos = this.start, startLoc = this.startLoc;
|
||||||
|
let node = this.jsx_parseNamespacedName();
|
||||||
|
if (this.type === tt.dot && node.type === 'JSXNamespacedName' && !options.allowNamespacedObjects) {
|
||||||
|
this.unexpected();
|
||||||
|
}
|
||||||
|
while (this.eat(tt.dot)) {
|
||||||
|
let newNode = this.startNodeAt(startPos, startLoc);
|
||||||
|
newNode.object = node;
|
||||||
|
newNode.property = this.jsx_parseIdentifier();
|
||||||
|
node = this.finishNode(newNode, 'JSXMemberExpression');
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses any type of JSX attribute value.
|
||||||
|
|
||||||
|
jsx_parseAttributeValue() {
|
||||||
|
switch (this.type) {
|
||||||
|
case tt.braceL:
|
||||||
|
let node = this.jsx_parseExpressionContainer();
|
||||||
|
if (node.expression.type === 'JSXEmptyExpression')
|
||||||
|
this.raise(node.start, 'JSX attributes must only be assigned a non-empty expression');
|
||||||
|
return node;
|
||||||
|
|
||||||
|
case tok.jsxTagStart:
|
||||||
|
case tt.string:
|
||||||
|
return this.parseExprAtom();
|
||||||
|
|
||||||
|
default:
|
||||||
|
this.raise(this.start, 'JSX value should be either an expression or a quoted JSX text');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// JSXEmptyExpression is unique type since it doesn't actually parse anything,
|
||||||
|
// and so it should start at the end of last read token (left brace) and finish
|
||||||
|
// at the beginning of the next one (right brace).
|
||||||
|
|
||||||
|
jsx_parseEmptyExpression() {
|
||||||
|
let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
|
||||||
|
return this.finishNodeAt(node, 'JSXEmptyExpression', this.start, this.startLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses JSX expression enclosed into curly brackets.
|
||||||
|
|
||||||
|
jsx_parseExpressionContainer() {
|
||||||
|
let node = this.startNode();
|
||||||
|
this.next();
|
||||||
|
node.expression = this.type === tt.braceR
|
||||||
|
? this.jsx_parseEmptyExpression()
|
||||||
|
: this.parseExpression();
|
||||||
|
this.expect(tt.braceR);
|
||||||
|
return this.finishNode(node, 'JSXExpressionContainer');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses following JSX attribute name-value pair.
|
||||||
|
|
||||||
|
jsx_parseAttribute() {
|
||||||
|
let node = this.startNode();
|
||||||
|
if (this.eat(tt.braceL)) {
|
||||||
|
this.expect(tt.ellipsis);
|
||||||
|
node.argument = this.parseMaybeAssign();
|
||||||
|
this.expect(tt.braceR);
|
||||||
|
return this.finishNode(node, 'JSXSpreadAttribute');
|
||||||
|
}
|
||||||
|
node.name = this.jsx_parseNamespacedName();
|
||||||
|
node.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null;
|
||||||
|
return this.finishNode(node, 'JSXAttribute');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses JSX opening tag starting after '<'.
|
||||||
|
|
||||||
|
jsx_parseOpeningElementAt(startPos, startLoc) {
|
||||||
|
let node = this.startNodeAt(startPos, startLoc);
|
||||||
|
node.attributes = [];
|
||||||
|
let nodeName = this.jsx_parseElementName();
|
||||||
|
if (nodeName) node.name = nodeName;
|
||||||
|
while (this.type !== tt.slash && this.type !== tok.jsxTagEnd)
|
||||||
|
node.attributes.push(this.jsx_parseAttribute());
|
||||||
|
node.selfClosing = this.eat(tt.slash);
|
||||||
|
this.expect(tok.jsxTagEnd);
|
||||||
|
return this.finishNode(node, nodeName ? 'JSXOpeningElement' : 'JSXOpeningFragment');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses JSX closing tag starting after '</'.
|
||||||
|
|
||||||
|
jsx_parseClosingElementAt(startPos, startLoc) {
|
||||||
|
let node = this.startNodeAt(startPos, startLoc);
|
||||||
|
let nodeName = this.jsx_parseElementName();
|
||||||
|
if (nodeName) node.name = nodeName;
|
||||||
|
this.expect(tok.jsxTagEnd);
|
||||||
|
return this.finishNode(node, nodeName ? 'JSXClosingElement' : 'JSXClosingFragment');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses entire JSX element, including it's opening tag
|
||||||
|
// (starting after '<'), attributes, contents and closing tag.
|
||||||
|
|
||||||
|
jsx_parseElementAt(startPos, startLoc) {
|
||||||
|
let node = this.startNodeAt(startPos, startLoc);
|
||||||
|
let children = [];
|
||||||
|
let openingElement = this.jsx_parseOpeningElementAt(startPos, startLoc);
|
||||||
|
let closingElement = null;
|
||||||
|
|
||||||
|
if (!openingElement.selfClosing) {
|
||||||
|
contents: for (;;) {
|
||||||
|
switch (this.type) {
|
||||||
|
case tok.jsxTagStart:
|
||||||
|
startPos = this.start; startLoc = this.startLoc;
|
||||||
|
this.next();
|
||||||
|
if (this.eat(tt.slash)) {
|
||||||
|
closingElement = this.jsx_parseClosingElementAt(startPos, startLoc);
|
||||||
|
break contents;
|
||||||
|
}
|
||||||
|
children.push(this.jsx_parseElementAt(startPos, startLoc));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tok.jsxText:
|
||||||
|
children.push(this.parseExprAtom());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tt.braceL:
|
||||||
|
children.push(this.jsx_parseExpressionContainer());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this.unexpected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
|
||||||
|
this.raise(
|
||||||
|
closingElement.start,
|
||||||
|
'Expected corresponding JSX closing tag for <' + getQualifiedJSXName(openingElement.name) + '>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let fragmentOrElement = openingElement.name ? 'Element' : 'Fragment';
|
||||||
|
|
||||||
|
node['opening' + fragmentOrElement] = openingElement;
|
||||||
|
node['closing' + fragmentOrElement] = closingElement;
|
||||||
|
node.children = children;
|
||||||
|
if (this.type === tt.relational && this.value === "<") {
|
||||||
|
this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag");
|
||||||
|
}
|
||||||
|
return this.finishNode(node, 'JSX' + fragmentOrElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse JSX text
|
||||||
|
|
||||||
|
jsx_parseText() {
|
||||||
|
let node = this.parseLiteral(this.value);
|
||||||
|
node.type = "JSXText";
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses entire JSX element from current position.
|
||||||
|
|
||||||
|
jsx_parseElement() {
|
||||||
|
let startPos = this.start, startLoc = this.startLoc;
|
||||||
|
this.next();
|
||||||
|
return this.jsx_parseElementAt(startPos, startLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
parseExprAtom(refShortHandDefaultPos) {
|
||||||
|
if (this.type === tok.jsxText)
|
||||||
|
return this.jsx_parseText();
|
||||||
|
else if (this.type === tok.jsxTagStart)
|
||||||
|
return this.jsx_parseElement();
|
||||||
|
else
|
||||||
|
return super.parseExprAtom(refShortHandDefaultPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
readToken(code) {
|
||||||
|
let context = this.curContext();
|
||||||
|
|
||||||
|
if (context === tc_expr) return this.jsx_readToken();
|
||||||
|
|
||||||
|
if (context === tc_oTag || context === tc_cTag) {
|
||||||
|
if (isIdentifierStart(code)) return this.jsx_readWord();
|
||||||
|
|
||||||
|
if (code == 62) {
|
||||||
|
++this.pos;
|
||||||
|
return this.finishToken(tok.jsxTagEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((code === 34 || code === 39) && context == tc_oTag)
|
||||||
|
return this.jsx_readString(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code === 60 && this.exprAllowed && this.input.charCodeAt(this.pos + 1) !== 33) {
|
||||||
|
++this.pos;
|
||||||
|
return this.finishToken(tok.jsxTagStart);
|
||||||
|
}
|
||||||
|
return super.readToken(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateContext(prevType) {
|
||||||
|
if (this.type == tt.braceL) {
|
||||||
|
var curContext = this.curContext();
|
||||||
|
if (curContext == tc_oTag) this.context.push(tokContexts.b_expr);
|
||||||
|
else if (curContext == tc_expr) this.context.push(tokContexts.b_tmpl);
|
||||||
|
else super.updateContext(prevType);
|
||||||
|
this.exprAllowed = true;
|
||||||
|
} else if (this.type === tt.slash && prevType === tok.jsxTagStart) {
|
||||||
|
this.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore
|
||||||
|
this.context.push(tc_cTag); // reconsider as closing tag context
|
||||||
|
this.exprAllowed = false;
|
||||||
|
} else {
|
||||||
|
return super.updateContext(prevType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
55
node_modules/acorn-jsx/package.json
generated
vendored
Normal file
55
node_modules/acorn-jsx/package.json
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"_from": "acorn-jsx@^5.2.0",
|
||||||
|
"_id": "acorn-jsx@5.3.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
|
||||||
|
"_location": "/acorn-jsx",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "acorn-jsx@^5.2.0",
|
||||||
|
"name": "acorn-jsx",
|
||||||
|
"escapedName": "acorn-jsx",
|
||||||
|
"rawSpec": "^5.2.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^5.2.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/espree"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
|
||||||
|
"_shasum": "fc8661e11b7ac1539c47dbfea2e72b3af34d267b",
|
||||||
|
"_spec": "acorn-jsx@^5.2.0",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/espree",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/acornjs/acorn-jsx/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Modern, fast React.js JSX parser",
|
||||||
|
"devDependencies": {
|
||||||
|
"acorn": "^8.0.1"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/acornjs/acorn-jsx",
|
||||||
|
"license": "MIT",
|
||||||
|
"maintainers": [
|
||||||
|
{
|
||||||
|
"name": "Ingvar Stepanyan",
|
||||||
|
"email": "me@rreverser.com",
|
||||||
|
"url": "http://rreverser.com/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "acorn-jsx",
|
||||||
|
"peerDependencies": {
|
||||||
|
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/acornjs/acorn-jsx.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "node test/run.js"
|
||||||
|
},
|
||||||
|
"version": "5.3.1"
|
||||||
|
}
|
||||||
255
node_modules/acorn-jsx/xhtml.js
generated
vendored
Normal file
255
node_modules/acorn-jsx/xhtml.js
generated
vendored
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
module.exports = {
|
||||||
|
quot: '\u0022',
|
||||||
|
amp: '&',
|
||||||
|
apos: '\u0027',
|
||||||
|
lt: '<',
|
||||||
|
gt: '>',
|
||||||
|
nbsp: '\u00A0',
|
||||||
|
iexcl: '\u00A1',
|
||||||
|
cent: '\u00A2',
|
||||||
|
pound: '\u00A3',
|
||||||
|
curren: '\u00A4',
|
||||||
|
yen: '\u00A5',
|
||||||
|
brvbar: '\u00A6',
|
||||||
|
sect: '\u00A7',
|
||||||
|
uml: '\u00A8',
|
||||||
|
copy: '\u00A9',
|
||||||
|
ordf: '\u00AA',
|
||||||
|
laquo: '\u00AB',
|
||||||
|
not: '\u00AC',
|
||||||
|
shy: '\u00AD',
|
||||||
|
reg: '\u00AE',
|
||||||
|
macr: '\u00AF',
|
||||||
|
deg: '\u00B0',
|
||||||
|
plusmn: '\u00B1',
|
||||||
|
sup2: '\u00B2',
|
||||||
|
sup3: '\u00B3',
|
||||||
|
acute: '\u00B4',
|
||||||
|
micro: '\u00B5',
|
||||||
|
para: '\u00B6',
|
||||||
|
middot: '\u00B7',
|
||||||
|
cedil: '\u00B8',
|
||||||
|
sup1: '\u00B9',
|
||||||
|
ordm: '\u00BA',
|
||||||
|
raquo: '\u00BB',
|
||||||
|
frac14: '\u00BC',
|
||||||
|
frac12: '\u00BD',
|
||||||
|
frac34: '\u00BE',
|
||||||
|
iquest: '\u00BF',
|
||||||
|
Agrave: '\u00C0',
|
||||||
|
Aacute: '\u00C1',
|
||||||
|
Acirc: '\u00C2',
|
||||||
|
Atilde: '\u00C3',
|
||||||
|
Auml: '\u00C4',
|
||||||
|
Aring: '\u00C5',
|
||||||
|
AElig: '\u00C6',
|
||||||
|
Ccedil: '\u00C7',
|
||||||
|
Egrave: '\u00C8',
|
||||||
|
Eacute: '\u00C9',
|
||||||
|
Ecirc: '\u00CA',
|
||||||
|
Euml: '\u00CB',
|
||||||
|
Igrave: '\u00CC',
|
||||||
|
Iacute: '\u00CD',
|
||||||
|
Icirc: '\u00CE',
|
||||||
|
Iuml: '\u00CF',
|
||||||
|
ETH: '\u00D0',
|
||||||
|
Ntilde: '\u00D1',
|
||||||
|
Ograve: '\u00D2',
|
||||||
|
Oacute: '\u00D3',
|
||||||
|
Ocirc: '\u00D4',
|
||||||
|
Otilde: '\u00D5',
|
||||||
|
Ouml: '\u00D6',
|
||||||
|
times: '\u00D7',
|
||||||
|
Oslash: '\u00D8',
|
||||||
|
Ugrave: '\u00D9',
|
||||||
|
Uacute: '\u00DA',
|
||||||
|
Ucirc: '\u00DB',
|
||||||
|
Uuml: '\u00DC',
|
||||||
|
Yacute: '\u00DD',
|
||||||
|
THORN: '\u00DE',
|
||||||
|
szlig: '\u00DF',
|
||||||
|
agrave: '\u00E0',
|
||||||
|
aacute: '\u00E1',
|
||||||
|
acirc: '\u00E2',
|
||||||
|
atilde: '\u00E3',
|
||||||
|
auml: '\u00E4',
|
||||||
|
aring: '\u00E5',
|
||||||
|
aelig: '\u00E6',
|
||||||
|
ccedil: '\u00E7',
|
||||||
|
egrave: '\u00E8',
|
||||||
|
eacute: '\u00E9',
|
||||||
|
ecirc: '\u00EA',
|
||||||
|
euml: '\u00EB',
|
||||||
|
igrave: '\u00EC',
|
||||||
|
iacute: '\u00ED',
|
||||||
|
icirc: '\u00EE',
|
||||||
|
iuml: '\u00EF',
|
||||||
|
eth: '\u00F0',
|
||||||
|
ntilde: '\u00F1',
|
||||||
|
ograve: '\u00F2',
|
||||||
|
oacute: '\u00F3',
|
||||||
|
ocirc: '\u00F4',
|
||||||
|
otilde: '\u00F5',
|
||||||
|
ouml: '\u00F6',
|
||||||
|
divide: '\u00F7',
|
||||||
|
oslash: '\u00F8',
|
||||||
|
ugrave: '\u00F9',
|
||||||
|
uacute: '\u00FA',
|
||||||
|
ucirc: '\u00FB',
|
||||||
|
uuml: '\u00FC',
|
||||||
|
yacute: '\u00FD',
|
||||||
|
thorn: '\u00FE',
|
||||||
|
yuml: '\u00FF',
|
||||||
|
OElig: '\u0152',
|
||||||
|
oelig: '\u0153',
|
||||||
|
Scaron: '\u0160',
|
||||||
|
scaron: '\u0161',
|
||||||
|
Yuml: '\u0178',
|
||||||
|
fnof: '\u0192',
|
||||||
|
circ: '\u02C6',
|
||||||
|
tilde: '\u02DC',
|
||||||
|
Alpha: '\u0391',
|
||||||
|
Beta: '\u0392',
|
||||||
|
Gamma: '\u0393',
|
||||||
|
Delta: '\u0394',
|
||||||
|
Epsilon: '\u0395',
|
||||||
|
Zeta: '\u0396',
|
||||||
|
Eta: '\u0397',
|
||||||
|
Theta: '\u0398',
|
||||||
|
Iota: '\u0399',
|
||||||
|
Kappa: '\u039A',
|
||||||
|
Lambda: '\u039B',
|
||||||
|
Mu: '\u039C',
|
||||||
|
Nu: '\u039D',
|
||||||
|
Xi: '\u039E',
|
||||||
|
Omicron: '\u039F',
|
||||||
|
Pi: '\u03A0',
|
||||||
|
Rho: '\u03A1',
|
||||||
|
Sigma: '\u03A3',
|
||||||
|
Tau: '\u03A4',
|
||||||
|
Upsilon: '\u03A5',
|
||||||
|
Phi: '\u03A6',
|
||||||
|
Chi: '\u03A7',
|
||||||
|
Psi: '\u03A8',
|
||||||
|
Omega: '\u03A9',
|
||||||
|
alpha: '\u03B1',
|
||||||
|
beta: '\u03B2',
|
||||||
|
gamma: '\u03B3',
|
||||||
|
delta: '\u03B4',
|
||||||
|
epsilon: '\u03B5',
|
||||||
|
zeta: '\u03B6',
|
||||||
|
eta: '\u03B7',
|
||||||
|
theta: '\u03B8',
|
||||||
|
iota: '\u03B9',
|
||||||
|
kappa: '\u03BA',
|
||||||
|
lambda: '\u03BB',
|
||||||
|
mu: '\u03BC',
|
||||||
|
nu: '\u03BD',
|
||||||
|
xi: '\u03BE',
|
||||||
|
omicron: '\u03BF',
|
||||||
|
pi: '\u03C0',
|
||||||
|
rho: '\u03C1',
|
||||||
|
sigmaf: '\u03C2',
|
||||||
|
sigma: '\u03C3',
|
||||||
|
tau: '\u03C4',
|
||||||
|
upsilon: '\u03C5',
|
||||||
|
phi: '\u03C6',
|
||||||
|
chi: '\u03C7',
|
||||||
|
psi: '\u03C8',
|
||||||
|
omega: '\u03C9',
|
||||||
|
thetasym: '\u03D1',
|
||||||
|
upsih: '\u03D2',
|
||||||
|
piv: '\u03D6',
|
||||||
|
ensp: '\u2002',
|
||||||
|
emsp: '\u2003',
|
||||||
|
thinsp: '\u2009',
|
||||||
|
zwnj: '\u200C',
|
||||||
|
zwj: '\u200D',
|
||||||
|
lrm: '\u200E',
|
||||||
|
rlm: '\u200F',
|
||||||
|
ndash: '\u2013',
|
||||||
|
mdash: '\u2014',
|
||||||
|
lsquo: '\u2018',
|
||||||
|
rsquo: '\u2019',
|
||||||
|
sbquo: '\u201A',
|
||||||
|
ldquo: '\u201C',
|
||||||
|
rdquo: '\u201D',
|
||||||
|
bdquo: '\u201E',
|
||||||
|
dagger: '\u2020',
|
||||||
|
Dagger: '\u2021',
|
||||||
|
bull: '\u2022',
|
||||||
|
hellip: '\u2026',
|
||||||
|
permil: '\u2030',
|
||||||
|
prime: '\u2032',
|
||||||
|
Prime: '\u2033',
|
||||||
|
lsaquo: '\u2039',
|
||||||
|
rsaquo: '\u203A',
|
||||||
|
oline: '\u203E',
|
||||||
|
frasl: '\u2044',
|
||||||
|
euro: '\u20AC',
|
||||||
|
image: '\u2111',
|
||||||
|
weierp: '\u2118',
|
||||||
|
real: '\u211C',
|
||||||
|
trade: '\u2122',
|
||||||
|
alefsym: '\u2135',
|
||||||
|
larr: '\u2190',
|
||||||
|
uarr: '\u2191',
|
||||||
|
rarr: '\u2192',
|
||||||
|
darr: '\u2193',
|
||||||
|
harr: '\u2194',
|
||||||
|
crarr: '\u21B5',
|
||||||
|
lArr: '\u21D0',
|
||||||
|
uArr: '\u21D1',
|
||||||
|
rArr: '\u21D2',
|
||||||
|
dArr: '\u21D3',
|
||||||
|
hArr: '\u21D4',
|
||||||
|
forall: '\u2200',
|
||||||
|
part: '\u2202',
|
||||||
|
exist: '\u2203',
|
||||||
|
empty: '\u2205',
|
||||||
|
nabla: '\u2207',
|
||||||
|
isin: '\u2208',
|
||||||
|
notin: '\u2209',
|
||||||
|
ni: '\u220B',
|
||||||
|
prod: '\u220F',
|
||||||
|
sum: '\u2211',
|
||||||
|
minus: '\u2212',
|
||||||
|
lowast: '\u2217',
|
||||||
|
radic: '\u221A',
|
||||||
|
prop: '\u221D',
|
||||||
|
infin: '\u221E',
|
||||||
|
ang: '\u2220',
|
||||||
|
and: '\u2227',
|
||||||
|
or: '\u2228',
|
||||||
|
cap: '\u2229',
|
||||||
|
cup: '\u222A',
|
||||||
|
'int': '\u222B',
|
||||||
|
there4: '\u2234',
|
||||||
|
sim: '\u223C',
|
||||||
|
cong: '\u2245',
|
||||||
|
asymp: '\u2248',
|
||||||
|
ne: '\u2260',
|
||||||
|
equiv: '\u2261',
|
||||||
|
le: '\u2264',
|
||||||
|
ge: '\u2265',
|
||||||
|
sub: '\u2282',
|
||||||
|
sup: '\u2283',
|
||||||
|
nsub: '\u2284',
|
||||||
|
sube: '\u2286',
|
||||||
|
supe: '\u2287',
|
||||||
|
oplus: '\u2295',
|
||||||
|
otimes: '\u2297',
|
||||||
|
perp: '\u22A5',
|
||||||
|
sdot: '\u22C5',
|
||||||
|
lceil: '\u2308',
|
||||||
|
rceil: '\u2309',
|
||||||
|
lfloor: '\u230A',
|
||||||
|
rfloor: '\u230B',
|
||||||
|
lang: '\u2329',
|
||||||
|
rang: '\u232A',
|
||||||
|
loz: '\u25CA',
|
||||||
|
spades: '\u2660',
|
||||||
|
clubs: '\u2663',
|
||||||
|
hearts: '\u2665',
|
||||||
|
diams: '\u2666'
|
||||||
|
};
|
||||||
620
node_modules/acorn/CHANGELOG.md
generated
vendored
Normal file
620
node_modules/acorn/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,620 @@
|
|||||||
|
## 7.4.0 (2020-08-03)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Add support for logical assignment operators.
|
||||||
|
|
||||||
|
Add support for numeric separators.
|
||||||
|
|
||||||
|
## 7.3.1 (2020-06-11)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Make the string in the `version` export match the actual library version.
|
||||||
|
|
||||||
|
## 7.3.0 (2020-06-11)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Add support for optional chaining (`?.`).
|
||||||
|
|
||||||
|
## 7.2.0 (2020-05-09)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix precedence issue in parsing of async arrow functions.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Add support for nullish coalescing.
|
||||||
|
|
||||||
|
Add support for `import.meta`.
|
||||||
|
|
||||||
|
Support `export * as ...` syntax.
|
||||||
|
|
||||||
|
Upgrade to Unicode 13.
|
||||||
|
|
||||||
|
## 6.4.1 (2020-03-09)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||||
|
|
||||||
|
## 7.1.1 (2020-03-01)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Treat `\8` and `\9` as invalid escapes in template strings.
|
||||||
|
|
||||||
|
Allow unicode escapes in property names that are keywords.
|
||||||
|
|
||||||
|
Don't error on an exponential operator expression as argument to `await`.
|
||||||
|
|
||||||
|
More carefully check for valid UTF16 surrogate pairs in regexp validator.
|
||||||
|
|
||||||
|
## 7.1.0 (2019-09-24)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Disallow trailing object literal commas when ecmaVersion is less than 5.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on.
|
||||||
|
|
||||||
|
## 7.0.0 (2019-08-13)
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression).
|
||||||
|
|
||||||
|
Makes 10 (ES2019) the default value for the `ecmaVersion` option.
|
||||||
|
|
||||||
|
## 6.3.0 (2019-08-12)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
`sourceType: "module"` can now be used even when `ecmaVersion` is less than 6, to parse module-style code that otherwise conforms to an older standard.
|
||||||
|
|
||||||
|
## 6.2.1 (2019-07-21)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such.
|
||||||
|
|
||||||
|
Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances.
|
||||||
|
|
||||||
|
## 6.2.0 (2019-07-04)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Improve valid assignment checking in `for`/`in` and `for`/`of` loops.
|
||||||
|
|
||||||
|
Disallow binding `let` in patterns.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Support bigint syntax with `ecmaVersion` >= 11.
|
||||||
|
|
||||||
|
Support dynamic `import` syntax with `ecmaVersion` >= 11.
|
||||||
|
|
||||||
|
Upgrade to Unicode version 12.
|
||||||
|
|
||||||
|
## 6.1.1 (2019-02-27)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix bug that caused parsing default exports of with names to fail.
|
||||||
|
|
||||||
|
## 6.1.0 (2019-02-08)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix scope checking when redefining a `var` as a lexical binding.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
|
||||||
|
|
||||||
|
## 6.0.7 (2019-02-04)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Check that exported bindings are defined.
|
||||||
|
|
||||||
|
Don't treat `\u180e` as a whitespace character.
|
||||||
|
|
||||||
|
Check for duplicate parameter names in methods.
|
||||||
|
|
||||||
|
Don't allow shorthand properties when they are generators or async methods.
|
||||||
|
|
||||||
|
Forbid binding `await` in async arrow function's parameter list.
|
||||||
|
|
||||||
|
## 6.0.6 (2019-01-30)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
The content of class declarations and expressions is now always parsed in strict mode.
|
||||||
|
|
||||||
|
Don't allow `let` or `const` to bind the variable name `let`.
|
||||||
|
|
||||||
|
Treat class declarations as lexical.
|
||||||
|
|
||||||
|
Don't allow a generator function declaration as the sole body of an `if` or `else`.
|
||||||
|
|
||||||
|
Ignore `"use strict"` when after an empty statement.
|
||||||
|
|
||||||
|
Allow string line continuations with special line terminator characters.
|
||||||
|
|
||||||
|
Treat `for` bodies as part of the `for` scope when checking for conflicting bindings.
|
||||||
|
|
||||||
|
Fix bug with parsing `yield` in a `for` loop initializer.
|
||||||
|
|
||||||
|
Implement special cases around scope checking for functions.
|
||||||
|
|
||||||
|
## 6.0.5 (2019-01-02)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type.
|
||||||
|
|
||||||
|
Don't treat `let` as a keyword when the next token is `{` on the next line.
|
||||||
|
|
||||||
|
Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on.
|
||||||
|
|
||||||
|
## 6.0.4 (2018-11-05)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Further improvements to tokenizing regular expressions in corner cases.
|
||||||
|
|
||||||
|
## 6.0.3 (2018-11-04)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression.
|
||||||
|
|
||||||
|
Remove stray symlink in the package tarball.
|
||||||
|
|
||||||
|
## 6.0.2 (2018-09-26)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix bug where default expressions could fail to parse inside an object destructuring assignment expression.
|
||||||
|
|
||||||
|
## 6.0.1 (2018-09-14)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix wrong value in `version` export.
|
||||||
|
|
||||||
|
## 6.0.0 (2018-09-14)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Better handle variable-redefinition checks for catch bindings and functions directly under if statements.
|
||||||
|
|
||||||
|
Forbid `new.target` in top-level arrow functions.
|
||||||
|
|
||||||
|
Fix issue with parsing a regexp after `yield` in some contexts.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
The package now comes with TypeScript definitions.
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
The default value of the `ecmaVersion` option is now 9 (2018).
|
||||||
|
|
||||||
|
Plugins work differently, and will have to be rewritten to work with this version.
|
||||||
|
|
||||||
|
The loose parser and walker have been moved into separate packages (`acorn-loose` and `acorn-walk`).
|
||||||
|
|
||||||
|
## 5.7.3 (2018-09-10)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix failure to tokenize regexps after expressions like `x.of`.
|
||||||
|
|
||||||
|
Better error message for unterminated template literals.
|
||||||
|
|
||||||
|
## 5.7.2 (2018-08-24)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Properly handle `allowAwaitOutsideFunction` in for statements.
|
||||||
|
|
||||||
|
Treat function declarations at the top level of modules like let bindings.
|
||||||
|
|
||||||
|
Don't allow async function declarations as the only statement under a label.
|
||||||
|
|
||||||
|
## 5.7.0 (2018-06-15)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Upgraded to Unicode 11.
|
||||||
|
|
||||||
|
## 5.6.0 (2018-05-31)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Allow U+2028 and U+2029 in string when ECMAVersion >= 10.
|
||||||
|
|
||||||
|
Allow binding-less catch statements when ECMAVersion >= 10.
|
||||||
|
|
||||||
|
Add `allowAwaitOutsideFunction` option for parsing top-level `await`.
|
||||||
|
|
||||||
|
## 5.5.3 (2018-03-08)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps.
|
||||||
|
|
||||||
|
## 5.5.2 (2018-03-08)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0.
|
||||||
|
|
||||||
|
## 5.5.1 (2018-03-06)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix misleading error message for octal escapes in template strings.
|
||||||
|
|
||||||
|
## 5.5.0 (2018-02-27)
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
The identifier character categorization is now based on Unicode version 10.
|
||||||
|
|
||||||
|
Acorn will now validate the content of regular expressions, including new ES9 features.
|
||||||
|
|
||||||
|
## 5.4.0 (2018-02-01)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Disallow duplicate or escaped flags on regular expressions.
|
||||||
|
|
||||||
|
Disallow octal escapes in strings in strict mode.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Add support for async iteration.
|
||||||
|
|
||||||
|
Add support for object spread and rest.
|
||||||
|
|
||||||
|
## 5.3.0 (2017-12-28)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix parsing of floating point literals with leading zeroes in loose mode.
|
||||||
|
|
||||||
|
Allow duplicate property names in object patterns.
|
||||||
|
|
||||||
|
Don't allow static class methods named `prototype`.
|
||||||
|
|
||||||
|
Disallow async functions directly under `if` or `else`.
|
||||||
|
|
||||||
|
Parse right-hand-side of `for`/`of` as an assignment expression.
|
||||||
|
|
||||||
|
Stricter parsing of `for`/`in`.
|
||||||
|
|
||||||
|
Don't allow unicode escapes in contextual keywords.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Parsing class members was factored into smaller methods to allow plugins to hook into it.
|
||||||
|
|
||||||
|
## 5.2.1 (2017-10-30)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix a token context corruption bug.
|
||||||
|
|
||||||
|
## 5.2.0 (2017-10-30)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix token context tracking for `class` and `function` in property-name position.
|
||||||
|
|
||||||
|
Make sure `%*` isn't parsed as a valid operator.
|
||||||
|
|
||||||
|
Allow shorthand properties `get` and `set` to be followed by default values.
|
||||||
|
|
||||||
|
Disallow `super` when not in callee or object position.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements.
|
||||||
|
|
||||||
|
## 5.1.2 (2017-09-04)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Disable parsing of legacy HTML-style comments in modules.
|
||||||
|
|
||||||
|
Fix parsing of async methods whose names are keywords.
|
||||||
|
|
||||||
|
## 5.1.1 (2017-07-06)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix problem with disambiguating regexp and division after a class.
|
||||||
|
|
||||||
|
## 5.1.0 (2017-07-05)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`.
|
||||||
|
|
||||||
|
Parse zero-prefixed numbers with non-octal digits as decimal.
|
||||||
|
|
||||||
|
Allow object/array patterns in rest parameters.
|
||||||
|
|
||||||
|
Don't error when `yield` is used as a property name.
|
||||||
|
|
||||||
|
Allow `async` as a shorthand object property.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9.
|
||||||
|
|
||||||
|
## 5.0.3 (2017-04-01)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix spurious duplicate variable definition errors for named functions.
|
||||||
|
|
||||||
|
## 5.0.2 (2017-03-30)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error.
|
||||||
|
|
||||||
|
## 5.0.0 (2017-03-28)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Raise an error for duplicated lexical bindings.
|
||||||
|
|
||||||
|
Fix spurious error when an assignement expression occurred after a spread expression.
|
||||||
|
|
||||||
|
Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions.
|
||||||
|
|
||||||
|
Allow labels in front or `var` declarations, even in strict mode.
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
Parse declarations following `export default` as declaration nodes, not expressions. This means that class and function declarations nodes can now have `null` as their `id`.
|
||||||
|
|
||||||
|
## 4.0.11 (2017-02-07)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Allow all forms of member expressions to be parenthesized as lvalue.
|
||||||
|
|
||||||
|
## 4.0.10 (2017-02-07)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Don't expect semicolons after default-exported functions or classes, even when they are expressions.
|
||||||
|
|
||||||
|
Check for use of `'use strict'` directives in non-simple parameter functions, even when already in strict mode.
|
||||||
|
|
||||||
|
## 4.0.9 (2017-02-06)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix incorrect error raised for parenthesized simple assignment targets, so that `(x) = 1` parses again.
|
||||||
|
|
||||||
|
## 4.0.8 (2017-02-03)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet.
|
||||||
|
|
||||||
|
## 4.0.7 (2017-02-02)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Accept invalidly rejected code like `(x).y = 2` again.
|
||||||
|
|
||||||
|
Don't raise an error when a function _inside_ strict code has a non-simple parameter list.
|
||||||
|
|
||||||
|
## 4.0.6 (2017-02-02)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check.
|
||||||
|
|
||||||
|
## 4.0.5 (2017-02-02)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Disallow parenthesized pattern expressions.
|
||||||
|
|
||||||
|
Allow keywords as export names.
|
||||||
|
|
||||||
|
Don't allow the `async` keyword to be parenthesized.
|
||||||
|
|
||||||
|
Properly raise an error when a keyword contains a character escape.
|
||||||
|
|
||||||
|
Allow `"use strict"` to appear after other string literal expressions.
|
||||||
|
|
||||||
|
Disallow labeled declarations.
|
||||||
|
|
||||||
|
## 4.0.4 (2016-12-19)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix crash when `export` was followed by a keyword that can't be
|
||||||
|
exported.
|
||||||
|
|
||||||
|
## 4.0.3 (2016-08-16)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Allow regular function declarations inside single-statement `if` branches in loose mode. Forbid them entirely in strict mode.
|
||||||
|
|
||||||
|
Properly parse properties named `async` in ES2017 mode.
|
||||||
|
|
||||||
|
Fix bug where reserved words were broken in ES2017 mode.
|
||||||
|
|
||||||
|
## 4.0.2 (2016-08-11)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Don't ignore period or 'e' characters after octal numbers.
|
||||||
|
|
||||||
|
Fix broken parsing for call expressions in default parameter values of arrow functions.
|
||||||
|
|
||||||
|
## 4.0.1 (2016-08-08)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix false positives in duplicated export name errors.
|
||||||
|
|
||||||
|
## 4.0.0 (2016-08-07)
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
The default `ecmaVersion` option value is now 7.
|
||||||
|
|
||||||
|
A number of internal method signatures changed, so plugins might need to be updated.
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
The parser now raises errors on duplicated export names.
|
||||||
|
|
||||||
|
`arguments` and `eval` can now be used in shorthand properties.
|
||||||
|
|
||||||
|
Duplicate parameter names in non-simple argument lists now always produce an error.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
The `ecmaVersion` option now also accepts year-style version numbers
|
||||||
|
(2015, etc).
|
||||||
|
|
||||||
|
Support for `async`/`await` syntax when `ecmaVersion` is >= 8.
|
||||||
|
|
||||||
|
Support for trailing commas in call expressions when `ecmaVersion` is >= 8.
|
||||||
|
|
||||||
|
## 3.3.0 (2016-07-25)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Fix bug in tokenizing of regexp operator after a function declaration.
|
||||||
|
|
||||||
|
Fix parser crash when parsing an array pattern with a hole.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Implement check against complex argument lists in functions that enable strict mode in ES7.
|
||||||
|
|
||||||
|
## 3.2.0 (2016-06-07)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Improve handling of lack of unicode regexp support in host
|
||||||
|
environment.
|
||||||
|
|
||||||
|
Properly reject shorthand properties whose name is a keyword.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Visitors created with `visit.make` now have their base as _prototype_, rather than copying properties into a fresh object.
|
||||||
|
|
||||||
|
## 3.1.0 (2016-04-18)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
Properly tokenize the division operator directly after a function expression.
|
||||||
|
|
||||||
|
Allow trailing comma in destructuring arrays.
|
||||||
|
|
||||||
|
## 3.0.4 (2016-02-25)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
Allow update expressions as left-hand-side of the ES7 exponential operator.
|
||||||
|
|
||||||
|
## 3.0.2 (2016-02-10)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
Fix bug that accidentally made `undefined` a reserved word when parsing ES7.
|
||||||
|
|
||||||
|
## 3.0.0 (2016-02-10)
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
The default value of the `ecmaVersion` option is now 6 (used to be 5).
|
||||||
|
|
||||||
|
Support for comprehension syntax (which was dropped from the draft spec) has been removed.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
`let` and `yield` are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code.
|
||||||
|
|
||||||
|
A parenthesized class or function expression after `export default` is now parsed correctly.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
When `ecmaVersion` is set to 7, Acorn will parse the exponentiation operator (`**`).
|
||||||
|
|
||||||
|
The identifier character ranges are now based on Unicode 8.0.0.
|
||||||
|
|
||||||
|
Plugins can now override the `raiseRecoverable` method to override the way non-critical errors are handled.
|
||||||
|
|
||||||
|
## 2.7.0 (2016-01-04)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
Stop allowing rest parameters in setters.
|
||||||
|
|
||||||
|
Disallow `y` rexexp flag in ES5.
|
||||||
|
|
||||||
|
Disallow `\00` and `\000` escapes in strict mode.
|
||||||
|
|
||||||
|
Raise an error when an import name is a reserved word.
|
||||||
|
|
||||||
|
## 2.6.2 (2015-11-10)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
Don't crash when no options object is passed.
|
||||||
|
|
||||||
|
## 2.6.0 (2015-11-09)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
Add `await` as a reserved word in module sources.
|
||||||
|
|
||||||
|
Disallow `yield` in a parameter default value for a generator.
|
||||||
|
|
||||||
|
Forbid using a comma after a rest pattern in an array destructuring.
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
Support parsing stdin in command-line tool.
|
||||||
|
|
||||||
|
## 2.5.0 (2015-10-27)
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
Fix tokenizer support in the command-line tool.
|
||||||
|
|
||||||
|
Stop allowing `new.target` outside of functions.
|
||||||
|
|
||||||
|
Remove legacy `guard` and `guardedHandler` properties from try nodes.
|
||||||
|
|
||||||
|
Stop allowing multiple `__proto__` properties on an object literal in strict mode.
|
||||||
|
|
||||||
|
Don't allow rest parameters to be non-identifier patterns.
|
||||||
|
|
||||||
|
Check for duplicate paramter names in arrow functions.
|
||||||
21
node_modules/acorn/LICENSE
generated
vendored
Normal file
21
node_modules/acorn/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
|
||||||
|
|
||||||
|
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.
|
||||||
269
node_modules/acorn/README.md
generated
vendored
Normal file
269
node_modules/acorn/README.md
generated
vendored
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
# Acorn
|
||||||
|
|
||||||
|
A tiny, fast JavaScript parser written in JavaScript.
|
||||||
|
|
||||||
|
## Community
|
||||||
|
|
||||||
|
Acorn is open source software released under an
|
||||||
|
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
|
||||||
|
|
||||||
|
You are welcome to
|
||||||
|
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||||
|
requests on [github](https://github.com/acornjs/acorn). For questions
|
||||||
|
and discussion, please use the
|
||||||
|
[Tern discussion forum](https://discuss.ternjs.net).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install acorn
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternately, you can download the source and build acorn yourself:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/acornjs/acorn.git
|
||||||
|
cd acorn
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Interface
|
||||||
|
|
||||||
|
**parse**`(input, options)` is the main interface to the library. The
|
||||||
|
`input` parameter is a string, `options` can be undefined or an object
|
||||||
|
setting some of the options listed below. The return value will be an
|
||||||
|
abstract syntax tree object as specified by the [ESTree
|
||||||
|
spec](https://github.com/estree/estree).
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
let acorn = require("acorn");
|
||||||
|
console.log(acorn.parse("1 + 1"));
|
||||||
|
```
|
||||||
|
|
||||||
|
When encountering a syntax error, the parser will raise a
|
||||||
|
`SyntaxError` object with a meaningful message. The error object will
|
||||||
|
have a `pos` property that indicates the string offset at which the
|
||||||
|
error occurred, and a `loc` object that contains a `{line, column}`
|
||||||
|
object referring to that same position.
|
||||||
|
|
||||||
|
Options can be provided by passing a second argument, which should be
|
||||||
|
an object containing any of these fields:
|
||||||
|
|
||||||
|
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||||
|
either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019) or 11
|
||||||
|
(2020, partial support). This influences support for strict mode,
|
||||||
|
the set of reserved words, and support for new syntax features.
|
||||||
|
Default is 10.
|
||||||
|
|
||||||
|
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||||
|
implemented by Acorn. Other proposed new features can be implemented
|
||||||
|
through plugins.
|
||||||
|
|
||||||
|
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||||
|
either `"script"` or `"module"`. This influences global strict mode
|
||||||
|
and parsing of `import` and `export` declarations.
|
||||||
|
|
||||||
|
**NOTE**: If set to `"module"`, then static `import` / `export` syntax
|
||||||
|
will be valid, even if `ecmaVersion` is less than 6.
|
||||||
|
|
||||||
|
- **onInsertedSemicolon**: If given a callback, that callback will be
|
||||||
|
called whenever a missing semicolon is inserted by the parser. The
|
||||||
|
callback will be given the character offset of the point where the
|
||||||
|
semicolon is inserted as argument, and if `locations` is on, also a
|
||||||
|
`{line, column}` object representing this position.
|
||||||
|
|
||||||
|
- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
|
||||||
|
commas.
|
||||||
|
|
||||||
|
- **allowReserved**: If `false`, using a reserved word will generate
|
||||||
|
an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
|
||||||
|
versions. When given the value `"never"`, reserved words and
|
||||||
|
keywords can also not be used as property names (as in Internet
|
||||||
|
Explorer's old parser).
|
||||||
|
|
||||||
|
- **allowReturnOutsideFunction**: By default, a return statement at
|
||||||
|
the top level raises an error. Set this to `true` to accept such
|
||||||
|
code.
|
||||||
|
|
||||||
|
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||||
|
declarations can only appear at a program's top level. Setting this
|
||||||
|
option to `true` allows them anywhere where a statement is allowed.
|
||||||
|
|
||||||
|
- **allowAwaitOutsideFunction**: By default, `await` expressions can
|
||||||
|
only appear inside `async` functions. Setting this option to
|
||||||
|
`true` allows to have top-level `await` expressions. They are
|
||||||
|
still not allowed in non-`async` functions, though.
|
||||||
|
|
||||||
|
- **allowHashBang**: When this is enabled (off by default), if the
|
||||||
|
code starts with the characters `#!` (as in a shellscript), the
|
||||||
|
first line will be treated as a comment.
|
||||||
|
|
||||||
|
- **locations**: When `true`, each node has a `loc` object attached
|
||||||
|
with `start` and `end` subobjects, each of which contains the
|
||||||
|
one-based line and zero-based column numbers in `{line, column}`
|
||||||
|
form. Default is `false`.
|
||||||
|
|
||||||
|
- **onToken**: If a function is passed for this option, each found
|
||||||
|
token will be passed in same format as tokens returned from
|
||||||
|
`tokenizer().getToken()`.
|
||||||
|
|
||||||
|
If array is passed, each found token is pushed to it.
|
||||||
|
|
||||||
|
Note that you are not allowed to call the parser from the
|
||||||
|
callback—that will corrupt its internal state.
|
||||||
|
|
||||||
|
- **onComment**: If a function is passed for this option, whenever a
|
||||||
|
comment is encountered the function will be called with the
|
||||||
|
following parameters:
|
||||||
|
|
||||||
|
- `block`: `true` if the comment is a block comment, false if it
|
||||||
|
is a line comment.
|
||||||
|
- `text`: The content of the comment.
|
||||||
|
- `start`: Character offset of the start of the comment.
|
||||||
|
- `end`: Character offset of the end of the comment.
|
||||||
|
|
||||||
|
When the `locations` options is on, the `{line, column}` locations
|
||||||
|
of the comment’s start and end are passed as two additional
|
||||||
|
parameters.
|
||||||
|
|
||||||
|
If array is passed for this option, each found comment is pushed
|
||||||
|
to it as object in Esprima format:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"type": "Line" | "Block",
|
||||||
|
"value": "comment text",
|
||||||
|
"start": Number,
|
||||||
|
"end": Number,
|
||||||
|
// If `locations` option is on:
|
||||||
|
"loc": {
|
||||||
|
"start": {line: Number, column: Number}
|
||||||
|
"end": {line: Number, column: Number}
|
||||||
|
},
|
||||||
|
// If `ranges` option is on:
|
||||||
|
"range": [Number, Number]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that you are not allowed to call the parser from the
|
||||||
|
callback—that will corrupt its internal state.
|
||||||
|
|
||||||
|
- **ranges**: Nodes have their start and end characters offsets
|
||||||
|
recorded in `start` and `end` properties (directly on the node,
|
||||||
|
rather than the `loc` object, which holds line/column data. To also
|
||||||
|
add a
|
||||||
|
[semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
|
||||||
|
`range` property holding a `[start, end]` array with the same
|
||||||
|
numbers, set the `ranges` option to `true`.
|
||||||
|
|
||||||
|
- **program**: It is possible to parse multiple files into a single
|
||||||
|
AST by passing the tree produced by parsing the first file as the
|
||||||
|
`program` option in subsequent parses. This will add the toplevel
|
||||||
|
forms of the parsed file to the "Program" (top) node of an existing
|
||||||
|
parse tree.
|
||||||
|
|
||||||
|
- **sourceFile**: When the `locations` option is `true`, you can pass
|
||||||
|
this option to add a `source` attribute in every node’s `loc`
|
||||||
|
object. Note that the contents of this option are not examined or
|
||||||
|
processed in any way; you are free to use whatever format you
|
||||||
|
choose.
|
||||||
|
|
||||||
|
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
|
||||||
|
will be added (regardless of the `location` option) directly to the
|
||||||
|
nodes, rather than the `loc` object.
|
||||||
|
|
||||||
|
- **preserveParens**: If this option is `true`, parenthesized expressions
|
||||||
|
are represented by (non-standard) `ParenthesizedExpression` nodes
|
||||||
|
that have a single `expression` property containing the expression
|
||||||
|
inside parentheses.
|
||||||
|
|
||||||
|
**parseExpressionAt**`(input, offset, options)` will parse a single
|
||||||
|
expression in a string, and return its AST. It will not complain if
|
||||||
|
there is more of the string left after the expression.
|
||||||
|
|
||||||
|
**tokenizer**`(input, options)` returns an object with a `getToken`
|
||||||
|
method that can be called repeatedly to get the next token, a `{start,
|
||||||
|
end, type, value}` object (with added `loc` property when the
|
||||||
|
`locations` option is enabled and `range` property when the `ranges`
|
||||||
|
option is enabled). When the token's type is `tokTypes.eof`, you
|
||||||
|
should stop calling the method, since it will keep returning that same
|
||||||
|
token forever.
|
||||||
|
|
||||||
|
In ES6 environment, returned result can be used as any other
|
||||||
|
protocol-compliant iterable:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
for (let token of acorn.tokenizer(str)) {
|
||||||
|
// iterate over the tokens
|
||||||
|
}
|
||||||
|
|
||||||
|
// transform code to array of tokens:
|
||||||
|
var tokens = [...acorn.tokenizer(str)];
|
||||||
|
```
|
||||||
|
|
||||||
|
**tokTypes** holds an object mapping names to the token type objects
|
||||||
|
that end up in the `type` properties of tokens.
|
||||||
|
|
||||||
|
**getLineInfo**`(input, offset)` can be used to get a `{line,
|
||||||
|
column}` object for a given program string and offset.
|
||||||
|
|
||||||
|
### The `Parser` class
|
||||||
|
|
||||||
|
Instances of the **`Parser`** class contain all the state and logic
|
||||||
|
that drives a parse. It has static methods `parse`,
|
||||||
|
`parseExpressionAt`, and `tokenizer` that match the top-level
|
||||||
|
functions by the same name.
|
||||||
|
|
||||||
|
When extending the parser with plugins, you need to call these methods
|
||||||
|
on the extended version of the class. To extend a parser with plugins,
|
||||||
|
you can use its static `extend` method.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var acorn = require("acorn");
|
||||||
|
var jsx = require("acorn-jsx");
|
||||||
|
var JSXParser = acorn.Parser.extend(jsx());
|
||||||
|
JSXParser.parse("foo(<bar/>)");
|
||||||
|
```
|
||||||
|
|
||||||
|
The `extend` method takes any number of plugin values, and returns a
|
||||||
|
new `Parser` class that includes the extra parser logic provided by
|
||||||
|
the plugins.
|
||||||
|
|
||||||
|
## Command line interface
|
||||||
|
|
||||||
|
The `bin/acorn` utility can be used to parse a file from the command
|
||||||
|
line. It accepts as arguments its input file and the following
|
||||||
|
options:
|
||||||
|
|
||||||
|
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
|
||||||
|
to parse. Default is version 9.
|
||||||
|
|
||||||
|
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
|
||||||
|
|
||||||
|
- `--locations`: Attaches a "loc" object to each node with "start" and
|
||||||
|
"end" subobjects, each of which contains the one-based line and
|
||||||
|
zero-based column numbers in `{line, column}` form.
|
||||||
|
|
||||||
|
- `--allow-hash-bang`: If the code starts with the characters #! (as
|
||||||
|
in a shellscript), the first line will be treated as a comment.
|
||||||
|
|
||||||
|
- `--compact`: No whitespace is used in the AST output.
|
||||||
|
|
||||||
|
- `--silent`: Do not output the AST, just return the exit status.
|
||||||
|
|
||||||
|
- `--help`: Print the usage information and quit.
|
||||||
|
|
||||||
|
The utility spits out the syntax tree as JSON data.
|
||||||
|
|
||||||
|
## Existing plugins
|
||||||
|
|
||||||
|
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
||||||
|
|
||||||
|
Plugins for ECMAScript proposals:
|
||||||
|
|
||||||
|
- [`acorn-stage3`](https://github.com/acornjs/acorn-stage3): Parse most stage 3 proposals, bundling:
|
||||||
|
- [`acorn-class-fields`](https://github.com/acornjs/acorn-class-fields): Parse [class fields proposal](https://github.com/tc39/proposal-class-fields)
|
||||||
|
- [`acorn-import-meta`](https://github.com/acornjs/acorn-import-meta): Parse [import.meta proposal](https://github.com/tc39/proposal-import-meta)
|
||||||
|
- [`acorn-private-methods`](https://github.com/acornjs/acorn-private-methods): parse [private methods, getters and setters proposal](https://github.com/tc39/proposal-private-methods)n
|
||||||
4
node_modules/acorn/bin/acorn
generated
vendored
Executable file
4
node_modules/acorn/bin/acorn
generated
vendored
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
require('../dist/bin.js');
|
||||||
209
node_modules/acorn/dist/acorn.d.ts
generated
vendored
Normal file
209
node_modules/acorn/dist/acorn.d.ts
generated
vendored
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
export as namespace acorn
|
||||||
|
export = acorn
|
||||||
|
|
||||||
|
declare namespace acorn {
|
||||||
|
function parse(input: string, options?: Options): Node
|
||||||
|
|
||||||
|
function parseExpressionAt(input: string, pos?: number, options?: Options): Node
|
||||||
|
|
||||||
|
function tokenizer(input: string, options?: Options): {
|
||||||
|
getToken(): Token
|
||||||
|
[Symbol.iterator](): Iterator<Token>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Options {
|
||||||
|
ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
||||||
|
sourceType?: 'script' | 'module'
|
||||||
|
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||||
|
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
|
||||||
|
allowReserved?: boolean | 'never'
|
||||||
|
allowReturnOutsideFunction?: boolean
|
||||||
|
allowImportExportEverywhere?: boolean
|
||||||
|
allowAwaitOutsideFunction?: boolean
|
||||||
|
allowHashBang?: boolean
|
||||||
|
locations?: boolean
|
||||||
|
onToken?: ((token: Token) => any) | Token[]
|
||||||
|
onComment?: ((
|
||||||
|
isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
|
||||||
|
endLoc?: Position
|
||||||
|
) => void) | Comment[]
|
||||||
|
ranges?: boolean
|
||||||
|
program?: Node
|
||||||
|
sourceFile?: string
|
||||||
|
directSourceFile?: string
|
||||||
|
preserveParens?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
class Parser {
|
||||||
|
constructor(options: Options, input: string, startPos?: number)
|
||||||
|
parse(this: Parser): Node
|
||||||
|
static parse(this: typeof Parser, input: string, options?: Options): Node
|
||||||
|
static parseExpressionAt(this: typeof Parser, input: string, pos: number, options?: Options): Node
|
||||||
|
static tokenizer(this: typeof Parser, input: string, options?: Options): {
|
||||||
|
getToken(): Token
|
||||||
|
[Symbol.iterator](): Iterator<Token>
|
||||||
|
}
|
||||||
|
static extend(this: typeof Parser, ...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Position { line: number; column: number; offset: number }
|
||||||
|
|
||||||
|
const defaultOptions: Options
|
||||||
|
|
||||||
|
function getLineInfo(input: string, offset: number): Position
|
||||||
|
|
||||||
|
class SourceLocation {
|
||||||
|
start: Position
|
||||||
|
end: Position
|
||||||
|
source?: string | null
|
||||||
|
constructor(p: Parser, start: Position, end: Position)
|
||||||
|
}
|
||||||
|
|
||||||
|
class Node {
|
||||||
|
type: string
|
||||||
|
start: number
|
||||||
|
end: number
|
||||||
|
loc?: SourceLocation
|
||||||
|
sourceFile?: string
|
||||||
|
range?: [number, number]
|
||||||
|
constructor(parser: Parser, pos: number, loc?: SourceLocation)
|
||||||
|
}
|
||||||
|
|
||||||
|
class TokenType {
|
||||||
|
label: string
|
||||||
|
keyword: string
|
||||||
|
beforeExpr: boolean
|
||||||
|
startsExpr: boolean
|
||||||
|
isLoop: boolean
|
||||||
|
isAssign: boolean
|
||||||
|
prefix: boolean
|
||||||
|
postfix: boolean
|
||||||
|
binop: number
|
||||||
|
updateContext?: (prevType: TokenType) => void
|
||||||
|
constructor(label: string, conf?: any)
|
||||||
|
}
|
||||||
|
|
||||||
|
const tokTypes: {
|
||||||
|
num: TokenType
|
||||||
|
regexp: TokenType
|
||||||
|
string: TokenType
|
||||||
|
name: TokenType
|
||||||
|
eof: TokenType
|
||||||
|
bracketL: TokenType
|
||||||
|
bracketR: TokenType
|
||||||
|
braceL: TokenType
|
||||||
|
braceR: TokenType
|
||||||
|
parenL: TokenType
|
||||||
|
parenR: TokenType
|
||||||
|
comma: TokenType
|
||||||
|
semi: TokenType
|
||||||
|
colon: TokenType
|
||||||
|
dot: TokenType
|
||||||
|
question: TokenType
|
||||||
|
arrow: TokenType
|
||||||
|
template: TokenType
|
||||||
|
ellipsis: TokenType
|
||||||
|
backQuote: TokenType
|
||||||
|
dollarBraceL: TokenType
|
||||||
|
eq: TokenType
|
||||||
|
assign: TokenType
|
||||||
|
incDec: TokenType
|
||||||
|
prefix: TokenType
|
||||||
|
logicalOR: TokenType
|
||||||
|
logicalAND: TokenType
|
||||||
|
bitwiseOR: TokenType
|
||||||
|
bitwiseXOR: TokenType
|
||||||
|
bitwiseAND: TokenType
|
||||||
|
equality: TokenType
|
||||||
|
relational: TokenType
|
||||||
|
bitShift: TokenType
|
||||||
|
plusMin: TokenType
|
||||||
|
modulo: TokenType
|
||||||
|
star: TokenType
|
||||||
|
slash: TokenType
|
||||||
|
starstar: TokenType
|
||||||
|
_break: TokenType
|
||||||
|
_case: TokenType
|
||||||
|
_catch: TokenType
|
||||||
|
_continue: TokenType
|
||||||
|
_debugger: TokenType
|
||||||
|
_default: TokenType
|
||||||
|
_do: TokenType
|
||||||
|
_else: TokenType
|
||||||
|
_finally: TokenType
|
||||||
|
_for: TokenType
|
||||||
|
_function: TokenType
|
||||||
|
_if: TokenType
|
||||||
|
_return: TokenType
|
||||||
|
_switch: TokenType
|
||||||
|
_throw: TokenType
|
||||||
|
_try: TokenType
|
||||||
|
_var: TokenType
|
||||||
|
_const: TokenType
|
||||||
|
_while: TokenType
|
||||||
|
_with: TokenType
|
||||||
|
_new: TokenType
|
||||||
|
_this: TokenType
|
||||||
|
_super: TokenType
|
||||||
|
_class: TokenType
|
||||||
|
_extends: TokenType
|
||||||
|
_export: TokenType
|
||||||
|
_import: TokenType
|
||||||
|
_null: TokenType
|
||||||
|
_true: TokenType
|
||||||
|
_false: TokenType
|
||||||
|
_in: TokenType
|
||||||
|
_instanceof: TokenType
|
||||||
|
_typeof: TokenType
|
||||||
|
_void: TokenType
|
||||||
|
_delete: TokenType
|
||||||
|
}
|
||||||
|
|
||||||
|
class TokContext {
|
||||||
|
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
|
||||||
|
}
|
||||||
|
|
||||||
|
const tokContexts: {
|
||||||
|
b_stat: TokContext
|
||||||
|
b_expr: TokContext
|
||||||
|
b_tmpl: TokContext
|
||||||
|
p_stat: TokContext
|
||||||
|
p_expr: TokContext
|
||||||
|
q_tmpl: TokContext
|
||||||
|
f_expr: TokContext
|
||||||
|
}
|
||||||
|
|
||||||
|
function isIdentifierStart(code: number, astral?: boolean): boolean
|
||||||
|
|
||||||
|
function isIdentifierChar(code: number, astral?: boolean): boolean
|
||||||
|
|
||||||
|
interface AbstractToken {
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Comment extends AbstractToken {
|
||||||
|
type: string
|
||||||
|
value: string
|
||||||
|
start: number
|
||||||
|
end: number
|
||||||
|
loc?: SourceLocation
|
||||||
|
range?: [number, number]
|
||||||
|
}
|
||||||
|
|
||||||
|
class Token {
|
||||||
|
type: TokenType
|
||||||
|
value: any
|
||||||
|
start: number
|
||||||
|
end: number
|
||||||
|
loc?: SourceLocation
|
||||||
|
range?: [number, number]
|
||||||
|
constructor(p: Parser)
|
||||||
|
}
|
||||||
|
|
||||||
|
function isNewLine(code: number): boolean
|
||||||
|
|
||||||
|
const lineBreak: RegExp
|
||||||
|
|
||||||
|
const lineBreakG: RegExp
|
||||||
|
|
||||||
|
const version: string
|
||||||
|
}
|
||||||
5186
node_modules/acorn/dist/acorn.js
generated
vendored
Normal file
5186
node_modules/acorn/dist/acorn.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/acorn/dist/acorn.js.map
generated
vendored
Normal file
1
node_modules/acorn/dist/acorn.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5155
node_modules/acorn/dist/acorn.mjs
generated
vendored
Normal file
5155
node_modules/acorn/dist/acorn.mjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
node_modules/acorn/dist/acorn.mjs.d.ts
generated
vendored
Normal file
2
node_modules/acorn/dist/acorn.mjs.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import * as acorn from "./acorn";
|
||||||
|
export = acorn;
|
||||||
1
node_modules/acorn/dist/acorn.mjs.map
generated
vendored
Normal file
1
node_modules/acorn/dist/acorn.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
64
node_modules/acorn/dist/bin.js
generated
vendored
Normal file
64
node_modules/acorn/dist/bin.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var path = require('path');
|
||||||
|
var fs = require('fs');
|
||||||
|
var acorn = require('./acorn.js');
|
||||||
|
|
||||||
|
var infile, forceFile, silent = false, compact = false, tokenize = false;
|
||||||
|
var options = {};
|
||||||
|
|
||||||
|
function help(status) {
|
||||||
|
var print = (status === 0) ? console.log : console.error;
|
||||||
|
print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
|
||||||
|
print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
|
||||||
|
process.exit(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 2; i < process.argv.length; ++i) {
|
||||||
|
var arg = process.argv[i];
|
||||||
|
if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; }
|
||||||
|
else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
|
||||||
|
else if (arg === "--locations") { options.locations = true; }
|
||||||
|
else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
|
||||||
|
else if (arg === "--silent") { silent = true; }
|
||||||
|
else if (arg === "--compact") { compact = true; }
|
||||||
|
else if (arg === "--help") { help(0); }
|
||||||
|
else if (arg === "--tokenize") { tokenize = true; }
|
||||||
|
else if (arg === "--module") { options.sourceType = "module"; }
|
||||||
|
else {
|
||||||
|
var match = arg.match(/^--ecma(\d+)$/);
|
||||||
|
if (match)
|
||||||
|
{ options.ecmaVersion = +match[1]; }
|
||||||
|
else
|
||||||
|
{ help(1); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function run(code) {
|
||||||
|
var result;
|
||||||
|
try {
|
||||||
|
if (!tokenize) {
|
||||||
|
result = acorn.parse(code, options);
|
||||||
|
} else {
|
||||||
|
result = [];
|
||||||
|
var tokenizer = acorn.tokenizer(code, options), token;
|
||||||
|
do {
|
||||||
|
token = tokenizer.getToken();
|
||||||
|
result.push(token);
|
||||||
|
} while (token.type !== acorn.tokTypes.eof)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(infile && infile !== "-" ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + infile + " " + m.slice(1); }) : e.message);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (forceFile || infile && infile !== "-") {
|
||||||
|
run(fs.readFileSync(infile, "utf8"));
|
||||||
|
} else {
|
||||||
|
var code = "";
|
||||||
|
process.stdin.resume();
|
||||||
|
process.stdin.on("data", function (chunk) { return code += chunk; });
|
||||||
|
process.stdin.on("end", function () { return run(code); });
|
||||||
|
}
|
||||||
67
node_modules/acorn/package.json
generated
vendored
Normal file
67
node_modules/acorn/package.json
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"_from": "acorn@^7.4.0",
|
||||||
|
"_id": "acorn@7.4.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||||
|
"_location": "/acorn",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "acorn@^7.4.0",
|
||||||
|
"name": "acorn",
|
||||||
|
"escapedName": "acorn",
|
||||||
|
"rawSpec": "^7.4.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^7.4.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/espree"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||||
|
"_shasum": "feaed255973d2e77555b83dbc08851a6c63520fa",
|
||||||
|
"_spec": "acorn@^7.4.0",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/espree",
|
||||||
|
"bin": {
|
||||||
|
"acorn": "bin/acorn"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/acornjs/acorn/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "ECMAScript parser",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/acornjs/acorn",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "dist/acorn.js",
|
||||||
|
"maintainers": [
|
||||||
|
{
|
||||||
|
"name": "Marijn Haverbeke",
|
||||||
|
"email": "marijnh@gmail.com",
|
||||||
|
"url": "https://marijnhaverbeke.nl"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ingvar Stepanyan",
|
||||||
|
"email": "me@rreverser.com",
|
||||||
|
"url": "https://rreverser.com/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Adrian Heine",
|
||||||
|
"url": "http://adrianheine.de"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"module": "dist/acorn.mjs",
|
||||||
|
"name": "acorn",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/acornjs/acorn.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"prepare": "cd ..; npm run build:main && npm run build:bin"
|
||||||
|
},
|
||||||
|
"types": "dist/acorn.d.ts",
|
||||||
|
"version": "7.4.1"
|
||||||
|
}
|
||||||
21
node_modules/ansi-colors/LICENSE
generated
vendored
Normal file
21
node_modules/ansi-colors/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015-present, Brian Woodward.
|
||||||
|
|
||||||
|
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/ansi-colors/README.md
generated
vendored
Normal file
315
node_modules/ansi-colors/README.md
generated
vendored
Normal file
@ -0,0 +1,315 @@
|
|||||||
|
# ansi-colors [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [](https://www.npmjs.com/package/ansi-colors) [](https://npmjs.org/package/ansi-colors) [](https://npmjs.org/package/ansi-colors) [](https://travis-ci.org/doowb/ansi-colors)
|
||||||
|
|
||||||
|
> Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).
|
||||||
|
|
||||||
|
Please consider following this project's author, [Brian Woodward](https://github.com/doowb), and consider starring the project to show your :heart: and support.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Install with [npm](https://www.npmjs.com/):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install --save ansi-colors
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Why use this?
|
||||||
|
|
||||||
|
ansi-colors is _the fastest Node.js library for terminal styling_. A more performant drop-in replacement for chalk, with no dependencies.
|
||||||
|
|
||||||
|
* _Blazing fast_ - Fastest terminal styling library in node.js, 10-20x faster than chalk!
|
||||||
|
|
||||||
|
* _Drop-in replacement_ for [chalk](https://github.com/chalk/chalk).
|
||||||
|
* _No dependencies_ (Chalk has 7 dependencies in its tree!)
|
||||||
|
|
||||||
|
* _Safe_ - Does not modify the `String.prototype` like [colors](https://github.com/Marak/colors.js).
|
||||||
|
* Supports [nested colors](#nested-colors), **and does not have the [nested styling bug](#nested-styling-bug) that is present in [colorette](https://github.com/jorgebucaran/colorette), [chalk](https://github.com/chalk/chalk), and [kleur](https://github.com/lukeed/kleur)**.
|
||||||
|
* Supports [chained colors](#chained-colors).
|
||||||
|
* [Toggle color support](#toggle-color-support) on or off.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const c = require('ansi-colors');
|
||||||
|
|
||||||
|
console.log(c.red('This is a red string!'));
|
||||||
|
console.log(c.green('This is a red string!'));
|
||||||
|
console.log(c.cyan('This is a cyan string!'));
|
||||||
|
console.log(c.yellow('This is a yellow string!'));
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Chained colors
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(c.bold.red('this is a bold red message'));
|
||||||
|
console.log(c.bold.yellow.italic('this is a bold yellow italicized message'));
|
||||||
|
console.log(c.green.bold.underline('this is a bold green underlined message'));
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Nested colors
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(c.yellow(`foo ${c.red.bold('red')} bar ${c.cyan('cyan')} baz`));
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Nested styling bug
|
||||||
|
|
||||||
|
`ansi-colors` does not have the nested styling bug found in [colorette](https://github.com/jorgebucaran/colorette), [chalk](https://github.com/chalk/chalk), and [kleur](https://github.com/lukeed/kleur).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { bold, red } = require('ansi-styles');
|
||||||
|
console.log(bold(`foo ${red.dim('bar')} baz`));
|
||||||
|
|
||||||
|
const colorette = require('colorette');
|
||||||
|
console.log(colorette.bold(`foo ${colorette.red(colorette.dim('bar'))} baz`));
|
||||||
|
|
||||||
|
const kleur = require('kleur');
|
||||||
|
console.log(kleur.bold(`foo ${kleur.red.dim('bar')} baz`));
|
||||||
|
|
||||||
|
const chalk = require('chalk');
|
||||||
|
console.log(chalk.bold(`foo ${chalk.red.dim('bar')} baz`));
|
||||||
|
```
|
||||||
|
|
||||||
|
**Results in the following**
|
||||||
|
|
||||||
|
(sans icons and labels)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Toggle color support
|
||||||
|
|
||||||
|
Easily enable/disable colors.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const c = require('ansi-colors');
|
||||||
|
|
||||||
|
// disable colors manually
|
||||||
|
c.enabled = false;
|
||||||
|
|
||||||
|
// or use a library to automatically detect support
|
||||||
|
c.enabled = require('color-support').hasBasic;
|
||||||
|
|
||||||
|
console.log(c.red('I will only be colored red if the terminal supports colors'));
|
||||||
|
```
|
||||||
|
|
||||||
|
## Strip ANSI codes
|
||||||
|
|
||||||
|
Use the `.unstyle` method to strip ANSI codes from a string.
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(c.unstyle(c.blue.bold('foo bar baz')));
|
||||||
|
//=> 'foo bar baz'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Available styles
|
||||||
|
|
||||||
|
**Note** that bright and bright-background colors are not always supported.
|
||||||
|
|
||||||
|
| Colors | Background Colors | Bright Colors | Bright Background Colors |
|
||||||
|
| ------- | ----------------- | ------------- | ------------------------ |
|
||||||
|
| black | bgBlack | blackBright | bgBlackBright |
|
||||||
|
| red | bgRed | redBright | bgRedBright |
|
||||||
|
| green | bgGreen | greenBright | bgGreenBright |
|
||||||
|
| yellow | bgYellow | yellowBright | bgYellowBright |
|
||||||
|
| blue | bgBlue | blueBright | bgBlueBright |
|
||||||
|
| magenta | bgMagenta | magentaBright | bgMagentaBright |
|
||||||
|
| cyan | bgCyan | cyanBright | bgCyanBright |
|
||||||
|
| white | bgWhite | whiteBright | bgWhiteBright |
|
||||||
|
| gray | | | |
|
||||||
|
| grey | | | |
|
||||||
|
|
||||||
|
_(`gray` is the U.S. spelling, `grey` is more commonly used in the Canada and U.K.)_
|
||||||
|
|
||||||
|
### Style modifiers
|
||||||
|
|
||||||
|
* dim
|
||||||
|
* **bold**
|
||||||
|
|
||||||
|
* hidden
|
||||||
|
* _italic_
|
||||||
|
|
||||||
|
* underline
|
||||||
|
* inverse
|
||||||
|
* ~~strikethrough~~
|
||||||
|
|
||||||
|
* reset
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
|
||||||
|
Create custom aliases for styles.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const colors = require('ansi-colors');
|
||||||
|
|
||||||
|
colors.alias('primary', colors.yellow);
|
||||||
|
colors.alias('secondary', colors.bold);
|
||||||
|
|
||||||
|
console.log(colors.primary.secondary('Foo'));
|
||||||
|
```
|
||||||
|
|
||||||
|
## Themes
|
||||||
|
|
||||||
|
A theme is an object of custom aliases.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const colors = require('ansi-colors');
|
||||||
|
|
||||||
|
colors.theme({
|
||||||
|
danger: colors.red,
|
||||||
|
dark: colors.dim.gray,
|
||||||
|
disabled: colors.gray,
|
||||||
|
em: colors.italic,
|
||||||
|
heading: colors.bold.underline,
|
||||||
|
info: colors.cyan,
|
||||||
|
muted: colors.dim,
|
||||||
|
primary: colors.blue,
|
||||||
|
strong: colors.bold,
|
||||||
|
success: colors.green,
|
||||||
|
underline: colors.underline,
|
||||||
|
warning: colors.yellow
|
||||||
|
});
|
||||||
|
|
||||||
|
// Now, we can use our custom styles alongside the built-in styles!
|
||||||
|
console.log(colors.danger.strong.em('Error!'));
|
||||||
|
console.log(colors.warning('Heads up!'));
|
||||||
|
console.log(colors.info('Did you know...'));
|
||||||
|
console.log(colors.success.bold('It worked!'));
|
||||||
|
```
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
**Libraries tested**
|
||||||
|
|
||||||
|
* ansi-colors v3.0.4
|
||||||
|
* chalk v2.4.1
|
||||||
|
|
||||||
|
### Mac
|
||||||
|
|
||||||
|
> MacBook Pro, Intel Core i7, 2.3 GHz, 16 GB.
|
||||||
|
|
||||||
|
**Load time**
|
||||||
|
|
||||||
|
Time it takes to load the first time `require()` is called:
|
||||||
|
|
||||||
|
* ansi-colors - `1.915ms`
|
||||||
|
* chalk - `12.437ms`
|
||||||
|
|
||||||
|
**Benchmarks**
|
||||||
|
|
||||||
|
```
|
||||||
|
# All Colors
|
||||||
|
ansi-colors x 173,851 ops/sec ±0.42% (91 runs sampled)
|
||||||
|
chalk x 9,944 ops/sec ±2.53% (81 runs sampled)))
|
||||||
|
|
||||||
|
# Chained colors
|
||||||
|
ansi-colors x 20,791 ops/sec ±0.60% (88 runs sampled)
|
||||||
|
chalk x 2,111 ops/sec ±2.34% (83 runs sampled)
|
||||||
|
|
||||||
|
# Nested colors
|
||||||
|
ansi-colors x 59,304 ops/sec ±0.98% (92 runs sampled)
|
||||||
|
chalk x 4,590 ops/sec ±2.08% (82 runs sampled)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
> Windows 10, Intel Core i7-7700k CPU @ 4.2 GHz, 32 GB
|
||||||
|
|
||||||
|
**Load time**
|
||||||
|
|
||||||
|
Time it takes to load the first time `require()` is called:
|
||||||
|
|
||||||
|
* ansi-colors - `1.494ms`
|
||||||
|
* chalk - `11.523ms`
|
||||||
|
|
||||||
|
**Benchmarks**
|
||||||
|
|
||||||
|
```
|
||||||
|
# All Colors
|
||||||
|
ansi-colors x 193,088 ops/sec ±0.51% (95 runs sampled))
|
||||||
|
chalk x 9,612 ops/sec ±3.31% (77 runs sampled)))
|
||||||
|
|
||||||
|
# Chained colors
|
||||||
|
ansi-colors x 26,093 ops/sec ±1.13% (94 runs sampled)
|
||||||
|
chalk x 2,267 ops/sec ±2.88% (80 runs sampled))
|
||||||
|
|
||||||
|
# Nested colors
|
||||||
|
ansi-colors x 67,747 ops/sec ±0.49% (93 runs sampled)
|
||||||
|
chalk x 4,446 ops/sec ±3.01% (82 runs sampled))
|
||||||
|
```
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>Contributing</strong></summary>
|
||||||
|
|
||||||
|
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>Running Tests</strong></summary>
|
||||||
|
|
||||||
|
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install && npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><strong>Building docs</strong></summary>
|
||||||
|
|
||||||
|
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||||
|
|
||||||
|
To generate the readme, run the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Related projects
|
||||||
|
|
||||||
|
You might also be interested in these projects:
|
||||||
|
|
||||||
|
* [ansi-wrap](https://www.npmjs.com/package/ansi-wrap): Create ansi colors by passing the open and close codes. | [homepage](https://github.com/jonschlinkert/ansi-wrap "Create ansi colors by passing the open and close codes.")
|
||||||
|
* [strip-color](https://www.npmjs.com/package/strip-color): Strip ANSI color codes from a string. No dependencies. | [homepage](https://github.com/jonschlinkert/strip-color "Strip ANSI color codes from a string. No dependencies.")
|
||||||
|
|
||||||
|
### Contributors
|
||||||
|
|
||||||
|
| **Commits** | **Contributor** |
|
||||||
|
| --- | --- |
|
||||||
|
| 48 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||||
|
| 42 | [doowb](https://github.com/doowb) |
|
||||||
|
| 6 | [lukeed](https://github.com/lukeed) |
|
||||||
|
| 2 | [Silic0nS0ldier](https://github.com/Silic0nS0ldier) |
|
||||||
|
| 1 | [dwieeb](https://github.com/dwieeb) |
|
||||||
|
| 1 | [jorgebucaran](https://github.com/jorgebucaran) |
|
||||||
|
| 1 | [madhavarshney](https://github.com/madhavarshney) |
|
||||||
|
| 1 | [chapterjason](https://github.com/chapterjason) |
|
||||||
|
|
||||||
|
### Author
|
||||||
|
|
||||||
|
**Brian Woodward**
|
||||||
|
|
||||||
|
* [GitHub Profile](https://github.com/doowb)
|
||||||
|
* [Twitter Profile](https://twitter.com/doowb)
|
||||||
|
* [LinkedIn Profile](https://linkedin.com/in/woodwardbrian)
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
|
Copyright © 2019, [Brian Woodward](https://github.com/doowb).
|
||||||
|
Released under the [MIT License](LICENSE).
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on July 01, 2019._
|
||||||
177
node_modules/ansi-colors/index.js
generated
vendored
Normal file
177
node_modules/ansi-colors/index.js
generated
vendored
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
||||||
|
const identity = val => val;
|
||||||
|
|
||||||
|
/* eslint-disable no-control-regex */
|
||||||
|
// this is a modified version of https://github.com/chalk/ansi-regex (MIT License)
|
||||||
|
const ANSI_REGEX = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g;
|
||||||
|
|
||||||
|
const create = () => {
|
||||||
|
const colors = { enabled: true, visible: true, styles: {}, keys: {} };
|
||||||
|
|
||||||
|
if ('FORCE_COLOR' in process.env) {
|
||||||
|
colors.enabled = process.env.FORCE_COLOR !== '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
const ansi = style => {
|
||||||
|
let open = style.open = `\u001b[${style.codes[0]}m`;
|
||||||
|
let close = style.close = `\u001b[${style.codes[1]}m`;
|
||||||
|
let regex = style.regex = new RegExp(`\\u001b\\[${style.codes[1]}m`, 'g');
|
||||||
|
style.wrap = (input, newline) => {
|
||||||
|
if (input.includes(close)) input = input.replace(regex, close + open);
|
||||||
|
let output = open + input + close;
|
||||||
|
// see https://github.com/chalk/chalk/pull/92, thanks to the
|
||||||
|
// chalk contributors for this fix. However, we've confirmed that
|
||||||
|
// this issue is also present in Windows terminals
|
||||||
|
return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output;
|
||||||
|
};
|
||||||
|
return style;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrap = (style, input, newline) => {
|
||||||
|
return typeof style === 'function' ? style(input) : style.wrap(input, newline);
|
||||||
|
};
|
||||||
|
|
||||||
|
const style = (input, stack) => {
|
||||||
|
if (input === '' || input == null) return '';
|
||||||
|
if (colors.enabled === false) return input;
|
||||||
|
if (colors.visible === false) return '';
|
||||||
|
let str = '' + input;
|
||||||
|
let nl = str.includes('\n');
|
||||||
|
let n = stack.length;
|
||||||
|
if (n > 0 && stack.includes('unstyle')) {
|
||||||
|
stack = [...new Set(['unstyle', ...stack])].reverse();
|
||||||
|
}
|
||||||
|
while (n-- > 0) str = wrap(colors.styles[stack[n]], str, nl);
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
const define = (name, codes, type) => {
|
||||||
|
colors.styles[name] = ansi({ name, codes });
|
||||||
|
let keys = colors.keys[type] || (colors.keys[type] = []);
|
||||||
|
keys.push(name);
|
||||||
|
|
||||||
|
Reflect.defineProperty(colors, name, {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
set(value) {
|
||||||
|
colors.alias(name, value);
|
||||||
|
},
|
||||||
|
get() {
|
||||||
|
let color = input => style(input, color.stack);
|
||||||
|
Reflect.setPrototypeOf(color, colors);
|
||||||
|
color.stack = this.stack ? this.stack.concat(name) : [name];
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
define('reset', [0, 0], 'modifier');
|
||||||
|
define('bold', [1, 22], 'modifier');
|
||||||
|
define('dim', [2, 22], 'modifier');
|
||||||
|
define('italic', [3, 23], 'modifier');
|
||||||
|
define('underline', [4, 24], 'modifier');
|
||||||
|
define('inverse', [7, 27], 'modifier');
|
||||||
|
define('hidden', [8, 28], 'modifier');
|
||||||
|
define('strikethrough', [9, 29], 'modifier');
|
||||||
|
|
||||||
|
define('black', [30, 39], 'color');
|
||||||
|
define('red', [31, 39], 'color');
|
||||||
|
define('green', [32, 39], 'color');
|
||||||
|
define('yellow', [33, 39], 'color');
|
||||||
|
define('blue', [34, 39], 'color');
|
||||||
|
define('magenta', [35, 39], 'color');
|
||||||
|
define('cyan', [36, 39], 'color');
|
||||||
|
define('white', [37, 39], 'color');
|
||||||
|
define('gray', [90, 39], 'color');
|
||||||
|
define('grey', [90, 39], 'color');
|
||||||
|
|
||||||
|
define('bgBlack', [40, 49], 'bg');
|
||||||
|
define('bgRed', [41, 49], 'bg');
|
||||||
|
define('bgGreen', [42, 49], 'bg');
|
||||||
|
define('bgYellow', [43, 49], 'bg');
|
||||||
|
define('bgBlue', [44, 49], 'bg');
|
||||||
|
define('bgMagenta', [45, 49], 'bg');
|
||||||
|
define('bgCyan', [46, 49], 'bg');
|
||||||
|
define('bgWhite', [47, 49], 'bg');
|
||||||
|
|
||||||
|
define('blackBright', [90, 39], 'bright');
|
||||||
|
define('redBright', [91, 39], 'bright');
|
||||||
|
define('greenBright', [92, 39], 'bright');
|
||||||
|
define('yellowBright', [93, 39], 'bright');
|
||||||
|
define('blueBright', [94, 39], 'bright');
|
||||||
|
define('magentaBright', [95, 39], 'bright');
|
||||||
|
define('cyanBright', [96, 39], 'bright');
|
||||||
|
define('whiteBright', [97, 39], 'bright');
|
||||||
|
|
||||||
|
define('bgBlackBright', [100, 49], 'bgBright');
|
||||||
|
define('bgRedBright', [101, 49], 'bgBright');
|
||||||
|
define('bgGreenBright', [102, 49], 'bgBright');
|
||||||
|
define('bgYellowBright', [103, 49], 'bgBright');
|
||||||
|
define('bgBlueBright', [104, 49], 'bgBright');
|
||||||
|
define('bgMagentaBright', [105, 49], 'bgBright');
|
||||||
|
define('bgCyanBright', [106, 49], 'bgBright');
|
||||||
|
define('bgWhiteBright', [107, 49], 'bgBright');
|
||||||
|
|
||||||
|
colors.ansiRegex = ANSI_REGEX;
|
||||||
|
colors.hasColor = colors.hasAnsi = str => {
|
||||||
|
colors.ansiRegex.lastIndex = 0;
|
||||||
|
return typeof str === 'string' && str !== '' && colors.ansiRegex.test(str);
|
||||||
|
};
|
||||||
|
|
||||||
|
colors.alias = (name, color) => {
|
||||||
|
let fn = typeof color === 'string' ? colors[color] : color;
|
||||||
|
|
||||||
|
if (typeof fn !== 'function') {
|
||||||
|
throw new TypeError('Expected alias to be the name of an existing color (string) or a function');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fn.stack) {
|
||||||
|
Reflect.defineProperty(fn, 'name', { value: name });
|
||||||
|
colors.styles[name] = fn;
|
||||||
|
fn.stack = [name];
|
||||||
|
}
|
||||||
|
|
||||||
|
Reflect.defineProperty(colors, name, {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: true,
|
||||||
|
set(value) {
|
||||||
|
colors.alias(name, value);
|
||||||
|
},
|
||||||
|
get() {
|
||||||
|
let color = input => style(input, color.stack);
|
||||||
|
Reflect.setPrototypeOf(color, colors);
|
||||||
|
color.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack;
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
colors.theme = custom => {
|
||||||
|
if (!isObject(custom)) throw new TypeError('Expected theme to be an object');
|
||||||
|
for (let name of Object.keys(custom)) {
|
||||||
|
colors.alias(name, custom[name]);
|
||||||
|
}
|
||||||
|
return colors;
|
||||||
|
};
|
||||||
|
|
||||||
|
colors.alias('unstyle', str => {
|
||||||
|
if (typeof str === 'string' && str !== '') {
|
||||||
|
colors.ansiRegex.lastIndex = 0;
|
||||||
|
return str.replace(colors.ansiRegex, '');
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
|
||||||
|
colors.alias('noop', str => str);
|
||||||
|
colors.none = colors.clear = colors.noop;
|
||||||
|
|
||||||
|
colors.stripColor = colors.unstyle;
|
||||||
|
colors.symbols = require('./symbols');
|
||||||
|
colors.define = define;
|
||||||
|
return colors;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = create();
|
||||||
|
module.exports.create = create;
|
||||||
152
node_modules/ansi-colors/package.json
generated
vendored
Normal file
152
node_modules/ansi-colors/package.json
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
{
|
||||||
|
"_from": "ansi-colors@^4.1.1",
|
||||||
|
"_id": "ansi-colors@4.1.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
|
||||||
|
"_location": "/ansi-colors",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "ansi-colors@^4.1.1",
|
||||||
|
"name": "ansi-colors",
|
||||||
|
"escapedName": "ansi-colors",
|
||||||
|
"rawSpec": "^4.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^4.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/enquirer"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
|
||||||
|
"_shasum": "cbb9ae256bf750af1eab344f229aa27fe94ba348",
|
||||||
|
"_spec": "ansi-colors@^4.1.1",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/enquirer",
|
||||||
|
"author": {
|
||||||
|
"name": "Brian Woodward",
|
||||||
|
"url": "https://github.com/doowb"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/doowb/ansi-colors/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Brian Woodward",
|
||||||
|
"url": "https://twitter.com/doowb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jason Schilling",
|
||||||
|
"url": "https://sourecode.de"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jon Schlinkert",
|
||||||
|
"url": "http://twitter.com/jonschlinkert"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jordan",
|
||||||
|
"url": "https://github.com/Silic0nS0ldier"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).",
|
||||||
|
"devDependencies": {
|
||||||
|
"decache": "^4.5.1",
|
||||||
|
"gulp-format-md": "^2.0.0",
|
||||||
|
"justified": "^1.0.1",
|
||||||
|
"mocha": "^6.1.4",
|
||||||
|
"text-table": "^0.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"symbols.js",
|
||||||
|
"types/index.d.ts"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/doowb/ansi-colors",
|
||||||
|
"keywords": [
|
||||||
|
"ansi",
|
||||||
|
"bgblack",
|
||||||
|
"bgBlack",
|
||||||
|
"bgblue",
|
||||||
|
"bgBlue",
|
||||||
|
"bgcyan",
|
||||||
|
"bgCyan",
|
||||||
|
"bggreen",
|
||||||
|
"bgGreen",
|
||||||
|
"bgmagenta",
|
||||||
|
"bgMagenta",
|
||||||
|
"bgred",
|
||||||
|
"bgRed",
|
||||||
|
"bgwhite",
|
||||||
|
"bgWhite",
|
||||||
|
"bgyellow",
|
||||||
|
"bgYellow",
|
||||||
|
"black",
|
||||||
|
"blue",
|
||||||
|
"bold",
|
||||||
|
"clorox",
|
||||||
|
"colors",
|
||||||
|
"cyan",
|
||||||
|
"dim",
|
||||||
|
"gray",
|
||||||
|
"green",
|
||||||
|
"grey",
|
||||||
|
"hidden",
|
||||||
|
"inverse",
|
||||||
|
"italic",
|
||||||
|
"kleur",
|
||||||
|
"magenta",
|
||||||
|
"red",
|
||||||
|
"reset",
|
||||||
|
"strikethrough",
|
||||||
|
"underline",
|
||||||
|
"white",
|
||||||
|
"yellow"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "ansi-colors",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/doowb/ansi-colors.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "mocha"
|
||||||
|
},
|
||||||
|
"types": "./types/index.d.ts",
|
||||||
|
"verb": {
|
||||||
|
"toc": false,
|
||||||
|
"layout": "default",
|
||||||
|
"tasks": [
|
||||||
|
"readme"
|
||||||
|
],
|
||||||
|
"data": {
|
||||||
|
"author": {
|
||||||
|
"linkedin": "woodwardbrian",
|
||||||
|
"twitter": "doowb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"gulp-format-md"
|
||||||
|
],
|
||||||
|
"lint": {
|
||||||
|
"reflinks": true
|
||||||
|
},
|
||||||
|
"related": {
|
||||||
|
"list": [
|
||||||
|
"ansi-wrap",
|
||||||
|
"strip-color"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"reflinks": [
|
||||||
|
"chalk",
|
||||||
|
"colorette",
|
||||||
|
"colors",
|
||||||
|
"kleur"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": "4.1.1"
|
||||||
|
}
|
||||||
70
node_modules/ansi-colors/symbols.js
generated
vendored
Normal file
70
node_modules/ansi-colors/symbols.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const isHyper = process.env.TERM_PROGRAM === 'Hyper';
|
||||||
|
const isWindows = process.platform === 'win32';
|
||||||
|
const isLinux = process.platform === 'linux';
|
||||||
|
|
||||||
|
const common = {
|
||||||
|
ballotDisabled: '☒',
|
||||||
|
ballotOff: '☐',
|
||||||
|
ballotOn: '☑',
|
||||||
|
bullet: '•',
|
||||||
|
bulletWhite: '◦',
|
||||||
|
fullBlock: '█',
|
||||||
|
heart: '❤',
|
||||||
|
identicalTo: '≡',
|
||||||
|
line: '─',
|
||||||
|
mark: '※',
|
||||||
|
middot: '·',
|
||||||
|
minus: '-',
|
||||||
|
multiplication: '×',
|
||||||
|
obelus: '÷',
|
||||||
|
pencilDownRight: '✎',
|
||||||
|
pencilRight: '✏',
|
||||||
|
pencilUpRight: '✐',
|
||||||
|
percent: '%',
|
||||||
|
pilcrow2: '❡',
|
||||||
|
pilcrow: '¶',
|
||||||
|
plusMinus: '±',
|
||||||
|
section: '§',
|
||||||
|
starsOff: '☆',
|
||||||
|
starsOn: '★',
|
||||||
|
upDownArrow: '↕'
|
||||||
|
};
|
||||||
|
|
||||||
|
const windows = Object.assign({}, common, {
|
||||||
|
check: '√',
|
||||||
|
cross: '×',
|
||||||
|
ellipsisLarge: '...',
|
||||||
|
ellipsis: '...',
|
||||||
|
info: 'i',
|
||||||
|
question: '?',
|
||||||
|
questionSmall: '?',
|
||||||
|
pointer: '>',
|
||||||
|
pointerSmall: '»',
|
||||||
|
radioOff: '( )',
|
||||||
|
radioOn: '(*)',
|
||||||
|
warning: '‼'
|
||||||
|
});
|
||||||
|
|
||||||
|
const other = Object.assign({}, common, {
|
||||||
|
ballotCross: '✘',
|
||||||
|
check: '✔',
|
||||||
|
cross: '✖',
|
||||||
|
ellipsisLarge: '⋯',
|
||||||
|
ellipsis: '…',
|
||||||
|
info: 'ℹ',
|
||||||
|
question: '?',
|
||||||
|
questionFull: '?',
|
||||||
|
questionSmall: '﹖',
|
||||||
|
pointer: isLinux ? '▸' : '❯',
|
||||||
|
pointerSmall: isLinux ? '‣' : '›',
|
||||||
|
radioOff: '◯',
|
||||||
|
radioOn: '◉',
|
||||||
|
warning: '⚠'
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = (isWindows && !isHyper) ? windows : other;
|
||||||
|
Reflect.defineProperty(module.exports, 'common', { enumerable: false, value: common });
|
||||||
|
Reflect.defineProperty(module.exports, 'windows', { enumerable: false, value: windows });
|
||||||
|
Reflect.defineProperty(module.exports, 'other', { enumerable: false, value: other });
|
||||||
161
node_modules/ansi-colors/types/index.d.ts
generated
vendored
Normal file
161
node_modules/ansi-colors/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
// Imported from DefinitelyTyped project.
|
||||||
|
// TypeScript definitions for ansi-colors
|
||||||
|
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||||
|
// Integrated by: Jordan Mele <https://github.com/Silic0nS0ldier>
|
||||||
|
|
||||||
|
interface SymbolsType {
|
||||||
|
check: string;
|
||||||
|
cross: string;
|
||||||
|
info: string;
|
||||||
|
line: string;
|
||||||
|
pointer: string;
|
||||||
|
pointerSmall: string;
|
||||||
|
question: string;
|
||||||
|
warning: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type StyleArrayStructure = [number, number];
|
||||||
|
interface StyleArrayProperties {
|
||||||
|
open: string;
|
||||||
|
close: string;
|
||||||
|
closeRe: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type StyleType = StyleArrayStructure & StyleArrayProperties;
|
||||||
|
|
||||||
|
export interface StyleFunction extends StylesType<StyleFunction> {
|
||||||
|
(s: string): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface StylesType<T> {
|
||||||
|
// modifiers
|
||||||
|
reset: T;
|
||||||
|
bold: T;
|
||||||
|
dim: T;
|
||||||
|
italic: T;
|
||||||
|
underline: T;
|
||||||
|
inverse: T;
|
||||||
|
hidden: T;
|
||||||
|
strikethrough: T;
|
||||||
|
|
||||||
|
// colors
|
||||||
|
black: T;
|
||||||
|
red: T;
|
||||||
|
green: T;
|
||||||
|
yellow: T;
|
||||||
|
blue: T;
|
||||||
|
magenta: T;
|
||||||
|
cyan: T;
|
||||||
|
white: T;
|
||||||
|
gray: T;
|
||||||
|
grey: T;
|
||||||
|
|
||||||
|
// bright colors
|
||||||
|
blackBright: T;
|
||||||
|
redBright: T;
|
||||||
|
greenBright: T;
|
||||||
|
yellowBright: T;
|
||||||
|
blueBright: T;
|
||||||
|
magentaBright: T;
|
||||||
|
cyanBright: T;
|
||||||
|
whiteBright: T;
|
||||||
|
|
||||||
|
// background colors
|
||||||
|
bgBlack: T;
|
||||||
|
bgRed: T;
|
||||||
|
bgGreen: T;
|
||||||
|
bgYellow: T;
|
||||||
|
bgBlue: T;
|
||||||
|
bgMagenta: T;
|
||||||
|
bgCyan: T;
|
||||||
|
bgWhite: T;
|
||||||
|
|
||||||
|
// bright background colors
|
||||||
|
bgBlackBright: T;
|
||||||
|
bgRedBright: T;
|
||||||
|
bgGreenBright: T;
|
||||||
|
bgYellowBright: T;
|
||||||
|
bgBlueBright: T;
|
||||||
|
bgMagentaBright: T;
|
||||||
|
bgCyanBright: T;
|
||||||
|
bgWhiteBright: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
// modifiers
|
||||||
|
export const reset: StyleFunction;
|
||||||
|
export const bold: StyleFunction;
|
||||||
|
export const dim: StyleFunction;
|
||||||
|
export const italic: StyleFunction;
|
||||||
|
export const underline: StyleFunction;
|
||||||
|
export const inverse: StyleFunction;
|
||||||
|
export const hidden: StyleFunction;
|
||||||
|
export const strikethrough: StyleFunction;
|
||||||
|
|
||||||
|
// colors
|
||||||
|
export const black: StyleFunction;
|
||||||
|
export const red: StyleFunction;
|
||||||
|
export const green: StyleFunction;
|
||||||
|
export const yellow: StyleFunction;
|
||||||
|
export const blue: StyleFunction;
|
||||||
|
export const magenta: StyleFunction;
|
||||||
|
export const cyan: StyleFunction;
|
||||||
|
export const white: StyleFunction;
|
||||||
|
export const gray: StyleFunction;
|
||||||
|
export const grey: StyleFunction;
|
||||||
|
|
||||||
|
// bright colors
|
||||||
|
export const blackBright: StyleFunction;
|
||||||
|
export const redBright: StyleFunction;
|
||||||
|
export const greenBright: StyleFunction;
|
||||||
|
export const yellowBright: StyleFunction;
|
||||||
|
export const blueBright: StyleFunction;
|
||||||
|
export const magentaBright: StyleFunction;
|
||||||
|
export const cyanBright: StyleFunction;
|
||||||
|
export const whiteBright: StyleFunction;
|
||||||
|
|
||||||
|
// background colors
|
||||||
|
export const bgBlack: StyleFunction;
|
||||||
|
export const bgRed: StyleFunction;
|
||||||
|
export const bgGreen: StyleFunction;
|
||||||
|
export const bgYellow: StyleFunction;
|
||||||
|
export const bgBlue: StyleFunction;
|
||||||
|
export const bgMagenta: StyleFunction;
|
||||||
|
export const bgCyan: StyleFunction;
|
||||||
|
export const bgWhite: StyleFunction;
|
||||||
|
|
||||||
|
// bright background colors
|
||||||
|
export const bgBlackBright: StyleFunction;
|
||||||
|
export const bgRedBright: StyleFunction;
|
||||||
|
export const bgGreenBright: StyleFunction;
|
||||||
|
export const bgYellowBright: StyleFunction;
|
||||||
|
export const bgBlueBright: StyleFunction;
|
||||||
|
export const bgMagentaBright: StyleFunction;
|
||||||
|
export const bgCyanBright: StyleFunction;
|
||||||
|
export const bgWhiteBright: StyleFunction;
|
||||||
|
|
||||||
|
export let enabled: boolean;
|
||||||
|
export let visible: boolean;
|
||||||
|
export const ansiRegex: RegExp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove styles from string
|
||||||
|
*/
|
||||||
|
export function stripColor(s: string): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove styles from string
|
||||||
|
*/
|
||||||
|
export function strip(s: string): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove styles from string
|
||||||
|
*/
|
||||||
|
export function unstyle(s: string): string;
|
||||||
|
|
||||||
|
export const styles: StylesType<StyleType>;
|
||||||
|
export const symbols: SymbolsType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Outputs a string with check-symbol as prefix
|
||||||
|
*/
|
||||||
|
export function ok(...args: string[]): string;
|
||||||
37
node_modules/ansi-regex/index.d.ts
generated
vendored
Normal file
37
node_modules/ansi-regex/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
declare namespace ansiRegex {
|
||||||
|
interface Options {
|
||||||
|
/**
|
||||||
|
Match only the first ANSI escape.
|
||||||
|
|
||||||
|
@default false
|
||||||
|
*/
|
||||||
|
onlyFirst: boolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Regular expression for matching ANSI escape codes.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
import ansiRegex = require('ansi-regex');
|
||||||
|
|
||||||
|
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
ansiRegex().test('cake');
|
||||||
|
//=> false
|
||||||
|
|
||||||
|
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||||
|
//=> ['\u001B[4m', '\u001B[0m']
|
||||||
|
|
||||||
|
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
||||||
|
//=> ['\u001B[4m']
|
||||||
|
|
||||||
|
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
||||||
|
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
declare function ansiRegex(options?: ansiRegex.Options): RegExp;
|
||||||
|
|
||||||
|
export = ansiRegex;
|
||||||
10
node_modules/ansi-regex/index.js
generated
vendored
Normal file
10
node_modules/ansi-regex/index.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = ({onlyFirst = false} = {}) => {
|
||||||
|
const pattern = [
|
||||||
|
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
||||||
|
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
||||||
|
].join('|');
|
||||||
|
|
||||||
|
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
||||||
|
};
|
||||||
9
node_modules/ansi-regex/license
generated
vendored
Normal file
9
node_modules/ansi-regex/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
87
node_modules/ansi-regex/package.json
generated
vendored
Normal file
87
node_modules/ansi-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"_from": "ansi-regex@^5.0.0",
|
||||||
|
"_id": "ansi-regex@5.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
|
||||||
|
"_location": "/ansi-regex",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "ansi-regex@^5.0.0",
|
||||||
|
"name": "ansi-regex",
|
||||||
|
"escapedName": "ansi-regex",
|
||||||
|
"rawSpec": "^5.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^5.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/strip-ansi"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
||||||
|
"_shasum": "388539f55179bf39339c81af30a654d69f87cb75",
|
||||||
|
"_spec": "ansi-regex@^5.0.0",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/strip-ansi",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/chalk/ansi-regex/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Regular expression for matching ANSI escape codes",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^2.4.0",
|
||||||
|
"tsd": "^0.9.0",
|
||||||
|
"xo": "^0.25.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/chalk/ansi-regex#readme",
|
||||||
|
"keywords": [
|
||||||
|
"ansi",
|
||||||
|
"styles",
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"colors",
|
||||||
|
"terminal",
|
||||||
|
"console",
|
||||||
|
"cli",
|
||||||
|
"string",
|
||||||
|
"tty",
|
||||||
|
"escape",
|
||||||
|
"formatting",
|
||||||
|
"rgb",
|
||||||
|
"256",
|
||||||
|
"shell",
|
||||||
|
"xterm",
|
||||||
|
"command-line",
|
||||||
|
"text",
|
||||||
|
"regex",
|
||||||
|
"regexp",
|
||||||
|
"re",
|
||||||
|
"match",
|
||||||
|
"test",
|
||||||
|
"find",
|
||||||
|
"pattern"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "ansi-regex",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/chalk/ansi-regex.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava && tsd",
|
||||||
|
"view-supported": "node fixtures/view-codes.js"
|
||||||
|
},
|
||||||
|
"version": "5.0.0"
|
||||||
|
}
|
||||||
78
node_modules/ansi-regex/readme.md
generated
vendored
Normal file
78
node_modules/ansi-regex/readme.md
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# ansi-regex [](https://travis-ci.org/chalk/ansi-regex)
|
||||||
|
|
||||||
|
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install ansi-regex
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const ansiRegex = require('ansi-regex');
|
||||||
|
|
||||||
|
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
ansiRegex().test('cake');
|
||||||
|
//=> false
|
||||||
|
|
||||||
|
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||||
|
//=> ['\u001B[4m', '\u001B[0m']
|
||||||
|
|
||||||
|
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
||||||
|
//=> ['\u001B[4m']
|
||||||
|
|
||||||
|
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
||||||
|
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### ansiRegex(options?)
|
||||||
|
|
||||||
|
Returns a regex for matching ANSI escape codes.
|
||||||
|
|
||||||
|
#### options
|
||||||
|
|
||||||
|
Type: `object`
|
||||||
|
|
||||||
|
##### onlyFirst
|
||||||
|
|
||||||
|
Type: `boolean`<br>
|
||||||
|
Default: `false` *(Matches any ANSI escape codes in a string)*
|
||||||
|
|
||||||
|
Match only the first ANSI escape.
|
||||||
|
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### Why do you test for codes not in the ECMA 48 standard?
|
||||||
|
|
||||||
|
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
|
||||||
|
|
||||||
|
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
|
||||||
|
|
||||||
|
|
||||||
|
## Maintainers
|
||||||
|
|
||||||
|
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||||
|
- [Josh Junon](https://github.com/qix-)
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<b>
|
||||||
|
<a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&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>
|
||||||
165
node_modules/ansi-styles/index.js
generated
vendored
Normal file
165
node_modules/ansi-styles/index.js
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
'use strict';
|
||||||
|
const colorConvert = require('color-convert');
|
||||||
|
|
||||||
|
const wrapAnsi16 = (fn, offset) => function () {
|
||||||
|
const code = fn.apply(colorConvert, arguments);
|
||||||
|
return `\u001B[${code + offset}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapAnsi256 = (fn, offset) => function () {
|
||||||
|
const code = fn.apply(colorConvert, arguments);
|
||||||
|
return `\u001B[${38 + offset};5;${code}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapAnsi16m = (fn, offset) => function () {
|
||||||
|
const rgb = fn.apply(colorConvert, arguments);
|
||||||
|
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||||
|
};
|
||||||
|
|
||||||
|
function assembleStyles() {
|
||||||
|
const codes = new Map();
|
||||||
|
const styles = {
|
||||||
|
modifier: {
|
||||||
|
reset: [0, 0],
|
||||||
|
// 21 isn't widely supported and 22 does the same thing
|
||||||
|
bold: [1, 22],
|
||||||
|
dim: [2, 22],
|
||||||
|
italic: [3, 23],
|
||||||
|
underline: [4, 24],
|
||||||
|
inverse: [7, 27],
|
||||||
|
hidden: [8, 28],
|
||||||
|
strikethrough: [9, 29]
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
black: [30, 39],
|
||||||
|
red: [31, 39],
|
||||||
|
green: [32, 39],
|
||||||
|
yellow: [33, 39],
|
||||||
|
blue: [34, 39],
|
||||||
|
magenta: [35, 39],
|
||||||
|
cyan: [36, 39],
|
||||||
|
white: [37, 39],
|
||||||
|
gray: [90, 39],
|
||||||
|
|
||||||
|
// Bright color
|
||||||
|
redBright: [91, 39],
|
||||||
|
greenBright: [92, 39],
|
||||||
|
yellowBright: [93, 39],
|
||||||
|
blueBright: [94, 39],
|
||||||
|
magentaBright: [95, 39],
|
||||||
|
cyanBright: [96, 39],
|
||||||
|
whiteBright: [97, 39]
|
||||||
|
},
|
||||||
|
bgColor: {
|
||||||
|
bgBlack: [40, 49],
|
||||||
|
bgRed: [41, 49],
|
||||||
|
bgGreen: [42, 49],
|
||||||
|
bgYellow: [43, 49],
|
||||||
|
bgBlue: [44, 49],
|
||||||
|
bgMagenta: [45, 49],
|
||||||
|
bgCyan: [46, 49],
|
||||||
|
bgWhite: [47, 49],
|
||||||
|
|
||||||
|
// Bright color
|
||||||
|
bgBlackBright: [100, 49],
|
||||||
|
bgRedBright: [101, 49],
|
||||||
|
bgGreenBright: [102, 49],
|
||||||
|
bgYellowBright: [103, 49],
|
||||||
|
bgBlueBright: [104, 49],
|
||||||
|
bgMagentaBright: [105, 49],
|
||||||
|
bgCyanBright: [106, 49],
|
||||||
|
bgWhiteBright: [107, 49]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Fix humans
|
||||||
|
styles.color.grey = styles.color.gray;
|
||||||
|
|
||||||
|
for (const groupName of Object.keys(styles)) {
|
||||||
|
const group = styles[groupName];
|
||||||
|
|
||||||
|
for (const styleName of Object.keys(group)) {
|
||||||
|
const style = group[styleName];
|
||||||
|
|
||||||
|
styles[styleName] = {
|
||||||
|
open: `\u001B[${style[0]}m`,
|
||||||
|
close: `\u001B[${style[1]}m`
|
||||||
|
};
|
||||||
|
|
||||||
|
group[styleName] = styles[styleName];
|
||||||
|
|
||||||
|
codes.set(style[0], style[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(styles, groupName, {
|
||||||
|
value: group,
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.defineProperty(styles, 'codes', {
|
||||||
|
value: codes,
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const ansi2ansi = n => n;
|
||||||
|
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||||
|
|
||||||
|
styles.color.close = '\u001B[39m';
|
||||||
|
styles.bgColor.close = '\u001B[49m';
|
||||||
|
|
||||||
|
styles.color.ansi = {
|
||||||
|
ansi: wrapAnsi16(ansi2ansi, 0)
|
||||||
|
};
|
||||||
|
styles.color.ansi256 = {
|
||||||
|
ansi256: wrapAnsi256(ansi2ansi, 0)
|
||||||
|
};
|
||||||
|
styles.color.ansi16m = {
|
||||||
|
rgb: wrapAnsi16m(rgb2rgb, 0)
|
||||||
|
};
|
||||||
|
|
||||||
|
styles.bgColor.ansi = {
|
||||||
|
ansi: wrapAnsi16(ansi2ansi, 10)
|
||||||
|
};
|
||||||
|
styles.bgColor.ansi256 = {
|
||||||
|
ansi256: wrapAnsi256(ansi2ansi, 10)
|
||||||
|
};
|
||||||
|
styles.bgColor.ansi16m = {
|
||||||
|
rgb: wrapAnsi16m(rgb2rgb, 10)
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let key of Object.keys(colorConvert)) {
|
||||||
|
if (typeof colorConvert[key] !== 'object') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const suite = colorConvert[key];
|
||||||
|
|
||||||
|
if (key === 'ansi16') {
|
||||||
|
key = 'ansi';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('ansi16' in suite) {
|
||||||
|
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
|
||||||
|
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('ansi256' in suite) {
|
||||||
|
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
|
||||||
|
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('rgb' in suite) {
|
||||||
|
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
|
||||||
|
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return styles;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make the export immutable
|
||||||
|
Object.defineProperty(module, 'exports', {
|
||||||
|
enumerable: true,
|
||||||
|
get: assembleStyles
|
||||||
|
});
|
||||||
9
node_modules/ansi-styles/license
generated
vendored
Normal file
9
node_modules/ansi-styles/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
89
node_modules/ansi-styles/package.json
generated
vendored
Normal file
89
node_modules/ansi-styles/package.json
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"_from": "ansi-styles@^3.2.1",
|
||||||
|
"_id": "ansi-styles@3.2.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||||
|
"_location": "/ansi-styles",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "ansi-styles@^3.2.1",
|
||||||
|
"name": "ansi-styles",
|
||||||
|
"escapedName": "ansi-styles",
|
||||||
|
"rawSpec": "^3.2.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^3.2.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/@babel/highlight/chalk",
|
||||||
|
"/slice-ansi"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||||
|
"_shasum": "41fbb20243e50b12be0f04b8dedbf07520ce841d",
|
||||||
|
"_spec": "ansi-styles@^3.2.1",
|
||||||
|
"_where": "/home/tristan.helmich/code/matrix-chat-message/node_modules/@babel/highlight/node_modules/chalk",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"ava": {
|
||||||
|
"require": "babel-polyfill"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^1.9.0"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "ANSI escape codes for styling strings in the terminal",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "*",
|
||||||
|
"babel-polyfill": "^6.23.0",
|
||||||
|
"svg-term-cli": "^2.1.1",
|
||||||
|
"xo": "*"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/chalk/ansi-styles#readme",
|
||||||
|
"keywords": [
|
||||||
|
"ansi",
|
||||||
|
"styles",
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"colors",
|
||||||
|
"terminal",
|
||||||
|
"console",
|
||||||
|
"cli",
|
||||||
|
"string",
|
||||||
|
"tty",
|
||||||
|
"escape",
|
||||||
|
"formatting",
|
||||||
|
"rgb",
|
||||||
|
"256",
|
||||||
|
"shell",
|
||||||
|
"xterm",
|
||||||
|
"log",
|
||||||
|
"logging",
|
||||||
|
"command-line",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "ansi-styles",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/chalk/ansi-styles.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
|
||||||
|
"test": "xo && ava"
|
||||||
|
},
|
||||||
|
"version": "3.2.1"
|
||||||
|
}
|
||||||
147
node_modules/ansi-styles/readme.md
generated
vendored
Normal file
147
node_modules/ansi-styles/readme.md
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||||
|
|
||||||
|
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||||
|
|
||||||
|
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||||
|
|
||||||
|
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install ansi-styles
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const style = require('ansi-styles');
|
||||||
|
|
||||||
|
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||||
|
|
||||||
|
|
||||||
|
// Color conversion between 16/256/truecolor
|
||||||
|
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||||
|
// may be degraded to fit that color palette. This means terminals
|
||||||
|
// that do not support 16 million colors will best-match the
|
||||||
|
// original color.
|
||||||
|
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||||
|
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||||
|
console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
Each style has an `open` and `close` property.
|
||||||
|
|
||||||
|
|
||||||
|
## Styles
|
||||||
|
|
||||||
|
### Modifiers
|
||||||
|
|
||||||
|
- `reset`
|
||||||
|
- `bold`
|
||||||
|
- `dim`
|
||||||
|
- `italic` *(Not widely supported)*
|
||||||
|
- `underline`
|
||||||
|
- `inverse`
|
||||||
|
- `hidden`
|
||||||
|
- `strikethrough` *(Not widely supported)*
|
||||||
|
|
||||||
|
### Colors
|
||||||
|
|
||||||
|
- `black`
|
||||||
|
- `red`
|
||||||
|
- `green`
|
||||||
|
- `yellow`
|
||||||
|
- `blue`
|
||||||
|
- `magenta`
|
||||||
|
- `cyan`
|
||||||
|
- `white`
|
||||||
|
- `gray` ("bright black")
|
||||||
|
- `redBright`
|
||||||
|
- `greenBright`
|
||||||
|
- `yellowBright`
|
||||||
|
- `blueBright`
|
||||||
|
- `magentaBright`
|
||||||
|
- `cyanBright`
|
||||||
|
- `whiteBright`
|
||||||
|
|
||||||
|
### Background colors
|
||||||
|
|
||||||
|
- `bgBlack`
|
||||||
|
- `bgRed`
|
||||||
|
- `bgGreen`
|
||||||
|
- `bgYellow`
|
||||||
|
- `bgBlue`
|
||||||
|
- `bgMagenta`
|
||||||
|
- `bgCyan`
|
||||||
|
- `bgWhite`
|
||||||
|
- `bgBlackBright`
|
||||||
|
- `bgRedBright`
|
||||||
|
- `bgGreenBright`
|
||||||
|
- `bgYellowBright`
|
||||||
|
- `bgBlueBright`
|
||||||
|
- `bgMagentaBright`
|
||||||
|
- `bgCyanBright`
|
||||||
|
- `bgWhiteBright`
|
||||||
|
|
||||||
|
|
||||||
|
## Advanced usage
|
||||||
|
|
||||||
|
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||||
|
|
||||||
|
- `style.modifier`
|
||||||
|
- `style.color`
|
||||||
|
- `style.bgColor`
|
||||||
|
|
||||||
|
###### Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(style.color.green.open);
|
||||||
|
```
|
||||||
|
|
||||||
|
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
||||||
|
|
||||||
|
###### Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(style.codes.get(36));
|
||||||
|
//=> 39
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||||
|
|
||||||
|
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||||
|
|
||||||
|
To use these, call the associated conversion function with the intended output, for example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||||
|
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||||
|
|
||||||
|
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||||
|
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||||
|
|
||||||
|
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||||
|
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||||
|
|
||||||
|
|
||||||
|
## Maintainers
|
||||||
|
|
||||||
|
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||||
|
- [Josh Junon](https://github.com/qix-)
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
185
node_modules/argparse/CHANGELOG.md
generated
vendored
Normal file
185
node_modules/argparse/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
1.0.10 / 2018-02-15
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Use .concat instead of + for arrays, #122.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.9 / 2016-09-29
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Rerelease after 1.0.8 - deps cleanup.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.8 / 2016-09-29
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Maintenance (deps bump, fix node 6.5+ tests, coverage report).
|
||||||
|
|
||||||
|
|
||||||
|
1.0.7 / 2016-03-17
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Teach `addArgument` to accept string arg names. #97, @tomxtobin.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.6 / 2016-02-06
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Maintenance: moved to eslint & updated CS.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.5 / 2016-02-05
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Removed lodash dependency to significantly reduce install size.
|
||||||
|
Thanks to @mourner.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.4 / 2016-01-17
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Maintenance: lodash update to 4.0.0.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.3 / 2015-10-27
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.2 / 2015-03-22
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Relaxed lodash version dependency.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.1 / 2015-02-20
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Changed dependencies to be compatible with ancient nodejs.
|
||||||
|
|
||||||
|
|
||||||
|
1.0.0 / 2015-02-19
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Maintenance release.
|
||||||
|
- Replaced `underscore` with `lodash`.
|
||||||
|
- Bumped version to 1.0.0 to better reflect semver meaning.
|
||||||
|
- HISTORY.md -> CHANGELOG.md
|
||||||
|
|
||||||
|
|
||||||
|
0.1.16 / 2013-12-01
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Maintenance release. Updated dependencies and docs.
|
||||||
|
|
||||||
|
|
||||||
|
0.1.15 / 2013-05-13
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Fixed #55, @trebor89
|
||||||
|
|
||||||
|
|
||||||
|
0.1.14 / 2013-05-12
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Fixed #62, @maxtaco
|
||||||
|
|
||||||
|
|
||||||
|
0.1.13 / 2013-04-08
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Added `.npmignore` to reduce package size
|
||||||
|
|
||||||
|
|
||||||
|
0.1.12 / 2013-02-10
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Fixed conflictHandler (#46), @hpaulj
|
||||||
|
|
||||||
|
|
||||||
|
0.1.11 / 2013-02-07
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Multiple bugfixes, @hpaulj
|
||||||
|
- Added 70+ tests (ported from python), @hpaulj
|
||||||
|
- Added conflictHandler, @applepicke
|
||||||
|
- Added fromfilePrefixChar, @hpaulj
|
||||||
|
|
||||||
|
|
||||||
|
0.1.10 / 2012-12-30
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion)
|
||||||
|
support, thanks to @hpaulj
|
||||||
|
- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj
|
||||||
|
|
||||||
|
|
||||||
|
0.1.9 / 2012-12-27
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj
|
||||||
|
- Fixed default value behavior with `*` positionals, thanks to @hpaulj
|
||||||
|
- Improve `getDefault()` behavior, thanks to @hpaulj
|
||||||
|
- Imrove negative argument parsing, thanks to @hpaulj
|
||||||
|
|
||||||
|
|
||||||
|
0.1.8 / 2012-12-01
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fixed parser parents (issue #19), thanks to @hpaulj
|
||||||
|
- Fixed negative argument parse (issue #20), thanks to @hpaulj
|
||||||
|
|
||||||
|
|
||||||
|
0.1.7 / 2012-10-14
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fixed 'choices' argument parse (issue #16)
|
||||||
|
- Fixed stderr output (issue #15)
|
||||||
|
|
||||||
|
|
||||||
|
0.1.6 / 2012-09-09
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fixed check for conflict of options (thanks to @tomxtobin)
|
||||||
|
|
||||||
|
|
||||||
|
0.1.5 / 2012-09-03
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fix parser #setDefaults method (thanks to @tomxtobin)
|
||||||
|
|
||||||
|
|
||||||
|
0.1.4 / 2012-07-30
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fixed pseudo-argument support (thanks to @CGamesPlay)
|
||||||
|
- Fixed addHelp default (should be true), if not set (thanks to @benblank)
|
||||||
|
|
||||||
|
|
||||||
|
0.1.3 / 2012-06-27
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fixed formatter api name: Formatter -> HelpFormatter
|
||||||
|
|
||||||
|
|
||||||
|
0.1.2 / 2012-05-29
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Added basic tests
|
||||||
|
- Removed excess whitespace in help
|
||||||
|
- Fixed error reporting, when parcer with subcommands
|
||||||
|
called with empty arguments
|
||||||
|
|
||||||
|
|
||||||
|
0.1.1 / 2012-05-23
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fixed line wrapping in help formatter
|
||||||
|
- Added better error reporting on invalid arguments
|
||||||
|
|
||||||
|
|
||||||
|
0.1.0 / 2012-05-16
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- First release.
|
||||||
21
node_modules/argparse/LICENSE
generated
vendored
Normal file
21
node_modules/argparse/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (C) 2012 by Vitaly Puzrin
|
||||||
|
|
||||||
|
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.
|
||||||
257
node_modules/argparse/README.md
generated
vendored
Normal file
257
node_modules/argparse/README.md
generated
vendored
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
argparse
|
||||||
|
========
|
||||||
|
|
||||||
|
[](http://travis-ci.org/nodeca/argparse)
|
||||||
|
[](https://www.npmjs.org/package/argparse)
|
||||||
|
|
||||||
|
CLI arguments parser for node.js. Javascript port of python's
|
||||||
|
[argparse](http://docs.python.org/dev/library/argparse.html) module
|
||||||
|
(original version 3.2). That's a full port, except some very rare options,
|
||||||
|
recorded in issue tracker.
|
||||||
|
|
||||||
|
**NB. Difference with original.**
|
||||||
|
|
||||||
|
- Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/).
|
||||||
|
- Use `defaultValue` instead of `default`.
|
||||||
|
- Use `argparse.Const.REMAINDER` instead of `argparse.REMAINDER`, and
|
||||||
|
similarly for constant values `OPTIONAL`, `ZERO_OR_MORE`, and `ONE_OR_MORE`
|
||||||
|
(aliases for `nargs` values `'?'`, `'*'`, `'+'`, respectively), and
|
||||||
|
`SUPPRESS`.
|
||||||
|
|
||||||
|
|
||||||
|
Example
|
||||||
|
=======
|
||||||
|
|
||||||
|
test.js file:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
#!/usr/bin/env node
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||||
|
var parser = new ArgumentParser({
|
||||||
|
version: '0.0.1',
|
||||||
|
addHelp:true,
|
||||||
|
description: 'Argparse example'
|
||||||
|
});
|
||||||
|
parser.addArgument(
|
||||||
|
[ '-f', '--foo' ],
|
||||||
|
{
|
||||||
|
help: 'foo bar'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
parser.addArgument(
|
||||||
|
[ '-b', '--bar' ],
|
||||||
|
{
|
||||||
|
help: 'bar foo'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
parser.addArgument(
|
||||||
|
'--baz',
|
||||||
|
{
|
||||||
|
help: 'baz bar'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
var args = parser.parseArgs();
|
||||||
|
console.dir(args);
|
||||||
|
```
|
||||||
|
|
||||||
|
Display help:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./test.js -h
|
||||||
|
usage: example.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ]
|
||||||
|
|
||||||
|
Argparse example
|
||||||
|
|
||||||
|
Optional arguments:
|
||||||
|
-h, --help Show this help message and exit.
|
||||||
|
-v, --version Show program's version number and exit.
|
||||||
|
-f FOO, --foo FOO foo bar
|
||||||
|
-b BAR, --bar BAR bar foo
|
||||||
|
--baz BAZ baz bar
|
||||||
|
```
|
||||||
|
|
||||||
|
Parse arguments:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./test.js -f=3 --bar=4 --baz 5
|
||||||
|
{ foo: '3', bar: '4', baz: '5' }
|
||||||
|
```
|
||||||
|
|
||||||
|
More [examples](https://github.com/nodeca/argparse/tree/master/examples).
|
||||||
|
|
||||||
|
|
||||||
|
ArgumentParser objects
|
||||||
|
======================
|
||||||
|
|
||||||
|
```
|
||||||
|
new ArgumentParser({parameters hash});
|
||||||
|
```
|
||||||
|
|
||||||
|
Creates a new ArgumentParser object.
|
||||||
|
|
||||||
|
**Supported params:**
|
||||||
|
|
||||||
|
- ```description``` - Text to display before the argument help.
|
||||||
|
- ```epilog``` - Text to display after the argument help.
|
||||||
|
- ```addHelp``` - Add a -h/–help option to the parser. (default: true)
|
||||||
|
- ```argumentDefault``` - Set the global default value for arguments. (default: null)
|
||||||
|
- ```parents``` - A list of ArgumentParser objects whose arguments should also be included.
|
||||||
|
- ```prefixChars``` - The set of characters that prefix optional arguments. (default: ‘-‘)
|
||||||
|
- ```formatterClass``` - A class for customizing the help output.
|
||||||
|
- ```prog``` - The name of the program (default: `path.basename(process.argv[1])`)
|
||||||
|
- ```usage``` - The string describing the program usage (default: generated)
|
||||||
|
- ```conflictHandler``` - Usually unnecessary, defines strategy for resolving conflicting optionals.
|
||||||
|
|
||||||
|
**Not supported yet**
|
||||||
|
|
||||||
|
- ```fromfilePrefixChars``` - The set of characters that prefix files from which additional arguments should be read.
|
||||||
|
|
||||||
|
|
||||||
|
Details in [original ArgumentParser guide](http://docs.python.org/dev/library/argparse.html#argumentparser-objects)
|
||||||
|
|
||||||
|
|
||||||
|
addArgument() method
|
||||||
|
====================
|
||||||
|
|
||||||
|
```
|
||||||
|
ArgumentParser.addArgument(name or flag or [name] or [flags...], {options})
|
||||||
|
```
|
||||||
|
|
||||||
|
Defines how a single command-line argument should be parsed.
|
||||||
|
|
||||||
|
- ```name or flag or [name] or [flags...]``` - Either a positional name
|
||||||
|
(e.g., `'foo'`), a single option (e.g., `'-f'` or `'--foo'`), an array
|
||||||
|
of a single positional name (e.g., `['foo']`), or an array of options
|
||||||
|
(e.g., `['-f', '--foo']`).
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
- ```action``` - The basic type of action to be taken when this argument is encountered at the command line.
|
||||||
|
- ```nargs```- The number of command-line arguments that should be consumed.
|
||||||
|
- ```constant``` - A constant value required by some action and nargs selections.
|
||||||
|
- ```defaultValue``` - The value produced if the argument is absent from the command line.
|
||||||
|
- ```type``` - The type to which the command-line argument should be converted.
|
||||||
|
- ```choices``` - A container of the allowable values for the argument.
|
||||||
|
- ```required``` - Whether or not the command-line option may be omitted (optionals only).
|
||||||
|
- ```help``` - A brief description of what the argument does.
|
||||||
|
- ```metavar``` - A name for the argument in usage messages.
|
||||||
|
- ```dest``` - The name of the attribute to be added to the object returned by parseArgs().
|
||||||
|
|
||||||
|
Details in [original add_argument guide](http://docs.python.org/dev/library/argparse.html#the-add-argument-method)
|
||||||
|
|
||||||
|
|
||||||
|
Action (some details)
|
||||||
|
================
|
||||||
|
|
||||||
|
ArgumentParser objects associate command-line arguments with actions.
|
||||||
|
These actions can do just about anything with the command-line arguments associated
|
||||||
|
with them, though most actions simply add an attribute to the object returned by
|
||||||
|
parseArgs(). The action keyword argument specifies how the command-line arguments
|
||||||
|
should be handled. The supported actions are:
|
||||||
|
|
||||||
|
- ```store``` - Just stores the argument’s value. This is the default action.
|
||||||
|
- ```storeConst``` - Stores value, specified by the const keyword argument.
|
||||||
|
(Note that the const keyword argument defaults to the rather unhelpful None.)
|
||||||
|
The 'storeConst' action is most commonly used with optional arguments, that
|
||||||
|
specify some sort of flag.
|
||||||
|
- ```storeTrue``` and ```storeFalse``` - Stores values True and False
|
||||||
|
respectively. These are special cases of 'storeConst'.
|
||||||
|
- ```append``` - Stores a list, and appends each argument value to the list.
|
||||||
|
This is useful to allow an option to be specified multiple times.
|
||||||
|
- ```appendConst``` - Stores a list, and appends value, specified by the
|
||||||
|
const keyword argument to the list. (Note, that the const keyword argument defaults
|
||||||
|
is None.) The 'appendConst' action is typically used when multiple arguments need
|
||||||
|
to store constants to the same list.
|
||||||
|
- ```count``` - Counts the number of times a keyword argument occurs. For example,
|
||||||
|
used for increasing verbosity levels.
|
||||||
|
- ```help``` - Prints a complete help message for all the options in the current
|
||||||
|
parser and then exits. By default a help action is automatically added to the parser.
|
||||||
|
See ArgumentParser for details of how the output is created.
|
||||||
|
- ```version``` - Prints version information and exit. Expects a `version=`
|
||||||
|
keyword argument in the addArgument() call.
|
||||||
|
|
||||||
|
Details in [original action guide](http://docs.python.org/dev/library/argparse.html#action)
|
||||||
|
|
||||||
|
|
||||||
|
Sub-commands
|
||||||
|
============
|
||||||
|
|
||||||
|
ArgumentParser.addSubparsers()
|
||||||
|
|
||||||
|
Many programs split their functionality into a number of sub-commands, for
|
||||||
|
example, the svn program can invoke sub-commands like `svn checkout`, `svn update`,
|
||||||
|
and `svn commit`. Splitting up functionality this way can be a particularly good
|
||||||
|
idea when a program performs several different functions which require different
|
||||||
|
kinds of command-line arguments. `ArgumentParser` supports creation of such
|
||||||
|
sub-commands with `addSubparsers()` method. The `addSubparsers()` method is
|
||||||
|
normally called with no arguments and returns an special action object.
|
||||||
|
This object has a single method `addParser()`, which takes a command name and
|
||||||
|
any `ArgumentParser` constructor arguments, and returns an `ArgumentParser` object
|
||||||
|
that can be modified as usual.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
sub_commands.js
|
||||||
|
```javascript
|
||||||
|
#!/usr/bin/env node
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var ArgumentParser = require('../lib/argparse').ArgumentParser;
|
||||||
|
var parser = new ArgumentParser({
|
||||||
|
version: '0.0.1',
|
||||||
|
addHelp:true,
|
||||||
|
description: 'Argparse examples: sub-commands',
|
||||||
|
});
|
||||||
|
|
||||||
|
var subparsers = parser.addSubparsers({
|
||||||
|
title:'subcommands',
|
||||||
|
dest:"subcommand_name"
|
||||||
|
});
|
||||||
|
|
||||||
|
var bar = subparsers.addParser('c1', {addHelp:true});
|
||||||
|
bar.addArgument(
|
||||||
|
[ '-f', '--foo' ],
|
||||||
|
{
|
||||||
|
action: 'store',
|
||||||
|
help: 'foo3 bar3'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
var bar = subparsers.addParser(
|
||||||
|
'c2',
|
||||||
|
{aliases:['co'], addHelp:true}
|
||||||
|
);
|
||||||
|
bar.addArgument(
|
||||||
|
[ '-b', '--bar' ],
|
||||||
|
{
|
||||||
|
action: 'store',
|
||||||
|
type: 'int',
|
||||||
|
help: 'foo3 bar3'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var args = parser.parseArgs();
|
||||||
|
console.dir(args);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Details in [original sub-commands guide](http://docs.python.org/dev/library/argparse.html#sub-commands)
|
||||||
|
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
============
|
||||||
|
|
||||||
|
- [Eugene Shkuropat](https://github.com/shkuropat)
|
||||||
|
- [Paul Jacobson](https://github.com/hpaulj)
|
||||||
|
|
||||||
|
[others](https://github.com/nodeca/argparse/graphs/contributors)
|
||||||
|
|
||||||
|
License
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin).
|
||||||
|
Released under the MIT license. See
|
||||||
|
[LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details.
|
||||||
|
|
||||||
|
|
||||||
3
node_modules/argparse/index.js
generated
vendored
Normal file
3
node_modules/argparse/index.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = require('./lib/argparse');
|
||||||
146
node_modules/argparse/lib/action.js
generated
vendored
Normal file
146
node_modules/argparse/lib/action.js
generated
vendored
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
/**
|
||||||
|
* class Action
|
||||||
|
*
|
||||||
|
* Base class for all actions
|
||||||
|
* Do not call in your code, use this class only for inherits your own action
|
||||||
|
*
|
||||||
|
* Information about how to convert command line strings to Javascript objects.
|
||||||
|
* Action objects are used by an ArgumentParser to represent the information
|
||||||
|
* needed to parse a single argument from one or more strings from the command
|
||||||
|
* line. The keyword arguments to the Action constructor are also all attributes
|
||||||
|
* of Action instances.
|
||||||
|
*
|
||||||
|
* ##### Allowed keywords:
|
||||||
|
*
|
||||||
|
* - `store`
|
||||||
|
* - `storeConstant`
|
||||||
|
* - `storeTrue`
|
||||||
|
* - `storeFalse`
|
||||||
|
* - `append`
|
||||||
|
* - `appendConstant`
|
||||||
|
* - `count`
|
||||||
|
* - `help`
|
||||||
|
* - `version`
|
||||||
|
*
|
||||||
|
* Information about action options see [[Action.new]]
|
||||||
|
*
|
||||||
|
* See also [original guide](http://docs.python.org/dev/library/argparse.html#action)
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
var c = require('./const');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* new Action(options)
|
||||||
|
*
|
||||||
|
* Base class for all actions. Used only for inherits
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* ##### Options:
|
||||||
|
*
|
||||||
|
* - `optionStrings` A list of command-line option strings for the action.
|
||||||
|
* - `dest` Attribute to hold the created object(s)
|
||||||
|
* - `nargs` The number of command-line arguments that should be consumed.
|
||||||
|
* By default, one argument will be consumed and a single value will be
|
||||||
|
* produced.
|
||||||
|
* - `constant` Default value for an action with no value.
|
||||||
|
* - `defaultValue` The value to be produced if the option is not specified.
|
||||||
|
* - `type` Cast to 'string'|'int'|'float'|'complex'|function (string). If
|
||||||
|
* None, 'string'.
|
||||||
|
* - `choices` The choices available.
|
||||||
|
* - `required` True if the action must always be specified at the command
|
||||||
|
* line.
|
||||||
|
* - `help` The help describing the argument.
|
||||||
|
* - `metavar` The name to be used for the option's argument with the help
|
||||||
|
* string. If None, the 'dest' value will be used as the name.
|
||||||
|
*
|
||||||
|
* ##### nargs supported values:
|
||||||
|
*
|
||||||
|
* - `N` (an integer) consumes N arguments (and produces a list)
|
||||||
|
* - `?` consumes zero or one arguments
|
||||||
|
* - `*` consumes zero or more arguments (and produces a list)
|
||||||
|
* - `+` consumes one or more arguments (and produces a list)
|
||||||
|
*
|
||||||
|
* Note: that the difference between the default and nargs=1 is that with the
|
||||||
|
* default, a single value will be produced, while with nargs=1, a list
|
||||||
|
* containing a single value will be produced.
|
||||||
|
**/
|
||||||
|
var Action = module.exports = function Action(options) {
|
||||||
|
options = options || {};
|
||||||
|
this.optionStrings = options.optionStrings || [];
|
||||||
|
this.dest = options.dest;
|
||||||
|
this.nargs = typeof options.nargs !== 'undefined' ? options.nargs : null;
|
||||||
|
this.constant = typeof options.constant !== 'undefined' ? options.constant : null;
|
||||||
|
this.defaultValue = options.defaultValue;
|
||||||
|
this.type = typeof options.type !== 'undefined' ? options.type : null;
|
||||||
|
this.choices = typeof options.choices !== 'undefined' ? options.choices : null;
|
||||||
|
this.required = typeof options.required !== 'undefined' ? options.required : false;
|
||||||
|
this.help = typeof options.help !== 'undefined' ? options.help : null;
|
||||||
|
this.metavar = typeof options.metavar !== 'undefined' ? options.metavar : null;
|
||||||
|
|
||||||
|
if (!(this.optionStrings instanceof Array)) {
|
||||||
|
throw new Error('optionStrings should be an array');
|
||||||
|
}
|
||||||
|
if (typeof this.required !== 'undefined' && typeof this.required !== 'boolean') {
|
||||||
|
throw new Error('required should be a boolean');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action#getName -> String
|
||||||
|
*
|
||||||
|
* Tells action name
|
||||||
|
**/
|
||||||
|
Action.prototype.getName = function () {
|
||||||
|
if (this.optionStrings.length > 0) {
|
||||||
|
return this.optionStrings.join('/');
|
||||||
|
} else if (this.metavar !== null && this.metavar !== c.SUPPRESS) {
|
||||||
|
return this.metavar;
|
||||||
|
} else if (typeof this.dest !== 'undefined' && this.dest !== c.SUPPRESS) {
|
||||||
|
return this.dest;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action#isOptional -> Boolean
|
||||||
|
*
|
||||||
|
* Return true if optional
|
||||||
|
**/
|
||||||
|
Action.prototype.isOptional = function () {
|
||||||
|
return !this.isPositional();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action#isPositional -> Boolean
|
||||||
|
*
|
||||||
|
* Return true if positional
|
||||||
|
**/
|
||||||
|
Action.prototype.isPositional = function () {
|
||||||
|
return (this.optionStrings.length === 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action#call(parser, namespace, values, optionString) -> Void
|
||||||
|
* - parser (ArgumentParser): current parser
|
||||||
|
* - namespace (Namespace): namespace for output data
|
||||||
|
* - values (Array): parsed values
|
||||||
|
* - optionString (Array): input option string(not parsed)
|
||||||
|
*
|
||||||
|
* Call the action. Should be implemented in inherited classes
|
||||||
|
*
|
||||||
|
* ##### Example
|
||||||
|
*
|
||||||
|
* ActionCount.prototype.call = function (parser, namespace, values, optionString) {
|
||||||
|
* namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
Action.prototype.call = function () {
|
||||||
|
throw new Error('.call() not defined');// Not Implemented error
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user