This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

View File

@@ -7,39 +7,17 @@ exports.shouldHighlight = shouldHighlight;
exports.getChalk = getChalk;
exports.default = highlight;
function _jsTokens() {
const data = _interopRequireWildcard(require("js-tokens"));
var _jsTokens = _interopRequireWildcard(require("js-tokens"));
_jsTokens = function () {
return data;
};
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
return data;
}
function _esutils() {
const data = _interopRequireDefault(require("esutils"));
_esutils = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
var _chalk = _interopRequireDefault(require("chalk"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
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 {
@@ -61,10 +39,10 @@ const BRACKET = /^[()[\]{}]$/;
function getTokenType(match) {
const [offset, text] = match.slice(-2);
const token = (0, _jsTokens().matchToToken)(match);
const token = (0, _jsTokens.matchToToken)(match);
if (token.type === "name") {
if (_esutils().default.keyword.isReservedWordES6(token.value)) {
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isReservedWord)(token.value)) {
return "keyword";
}
@@ -89,7 +67,7 @@ function getTokenType(match) {
}
function highlightTokens(defs, text) {
return text.replace(_jsTokens().default, function (...args) {
return text.replace(_jsTokens.default, function (...args) {
const type = getTokenType(args);
const colorize = defs[type];
@@ -102,14 +80,14 @@ function highlightTokens(defs, text) {
}
function shouldHighlight(options) {
return _chalk().default.supportsColor || options.forceColor;
return _chalk.default.supportsColor || options.forceColor;
}
function getChalk(options) {
let chalk = _chalk().default;
let chalk = _chalk.default;
if (options.forceColor) {
chalk = new (_chalk().default.constructor)({
chalk = new _chalk.default.constructor({
enabled: true,
level: 1
});