Node updated. Some todos.
This commit is contained in:
68
Scripts/node_modules/@babel/highlight/lib/index.js
generated
vendored
68
Scripts/node_modules/@babel/highlight/lib/index.js
generated
vendored
@ -7,21 +7,23 @@ exports.default = highlight;
|
||||
exports.shouldHighlight = shouldHighlight;
|
||||
var _jsTokens = require("js-tokens");
|
||||
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
|
||||
var _chalk = _interopRequireWildcard(require("chalk"), true);
|
||||
var _picocolors = _interopRequireWildcard(require("picocolors"), true);
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
const colors = typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? (0, _picocolors.createColors)(false) : _picocolors.default;
|
||||
const compose = (f, g) => v => f(g(v));
|
||||
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
||||
function getDefs(chalk) {
|
||||
function getDefs(colors) {
|
||||
return {
|
||||
keyword: chalk.cyan,
|
||||
capitalized: chalk.yellow,
|
||||
jsxIdentifier: chalk.yellow,
|
||||
punctuator: chalk.yellow,
|
||||
number: chalk.magenta,
|
||||
string: chalk.green,
|
||||
regex: chalk.magenta,
|
||||
comment: chalk.grey,
|
||||
invalid: chalk.white.bgRed.bold
|
||||
keyword: colors.cyan,
|
||||
capitalized: colors.yellow,
|
||||
jsxIdentifier: colors.yellow,
|
||||
punctuator: colors.yellow,
|
||||
number: colors.magenta,
|
||||
string: colors.green,
|
||||
regex: colors.magenta,
|
||||
comment: colors.gray,
|
||||
invalid: compose(compose(colors.white, colors.bgRed), colors.bold)
|
||||
};
|
||||
}
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
@ -34,7 +36,7 @@ let tokenize;
|
||||
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
|
||||
return "keyword";
|
||||
}
|
||||
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) {
|
||||
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
|
||||
return "jsxIdentifier";
|
||||
}
|
||||
if (token.value[0] !== token.value[0].toLowerCase()) {
|
||||
@ -76,30 +78,42 @@ function highlightTokens(defs, text) {
|
||||
return highlighted;
|
||||
}
|
||||
function shouldHighlight(options) {
|
||||
return _chalk.default.level > 0 || options.forceColor;
|
||||
return colors.isColorSupported || options.forceColor;
|
||||
}
|
||||
let chalkWithForcedColor = undefined;
|
||||
function getChalk(forceColor) {
|
||||
let pcWithForcedColor = undefined;
|
||||
function getColors(forceColor) {
|
||||
if (forceColor) {
|
||||
var _chalkWithForcedColor;
|
||||
(_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new _chalk.default.constructor({
|
||||
enabled: true,
|
||||
level: 1
|
||||
});
|
||||
return chalkWithForcedColor;
|
||||
var _pcWithForcedColor;
|
||||
(_pcWithForcedColor = pcWithForcedColor) != null ? _pcWithForcedColor : pcWithForcedColor = (0, _picocolors.createColors)(true);
|
||||
return pcWithForcedColor;
|
||||
}
|
||||
return _chalk.default;
|
||||
}
|
||||
{
|
||||
exports.getChalk = options => getChalk(options.forceColor);
|
||||
return colors;
|
||||
}
|
||||
function highlight(code, options = {}) {
|
||||
if (code !== "" && shouldHighlight(options)) {
|
||||
const defs = getDefs(getChalk(options.forceColor));
|
||||
const defs = getDefs(getColors(options.forceColor));
|
||||
return highlightTokens(defs, code);
|
||||
} else {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
{
|
||||
let chalk, chalkWithForcedColor;
|
||||
exports.getChalk = ({
|
||||
forceColor
|
||||
}) => {
|
||||
var _chalk;
|
||||
(_chalk = chalk) != null ? _chalk : chalk = require("chalk");
|
||||
if (forceColor) {
|
||||
var _chalkWithForcedColor;
|
||||
(_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new chalk.constructor({
|
||||
enabled: true,
|
||||
level: 1
|
||||
});
|
||||
return chalkWithForcedColor;
|
||||
}
|
||||
return chalk;
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
2
Scripts/node_modules/@babel/highlight/lib/index.js.map
generated
vendored
2
Scripts/node_modules/@babel/highlight/lib/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
7
Scripts/node_modules/@babel/highlight/package.json
generated
vendored
7
Scripts/node_modules/@babel/highlight/package.json
generated
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/highlight",
|
||||
"version": "7.23.4",
|
||||
"version": "7.24.7",
|
||||
"description": "Syntax highlight JavaScript strings for output in terminals.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-highlight",
|
||||
@ -15,9 +15,10 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"@babel/helper-validator-identifier": "^7.24.7",
|
||||
"chalk": "^2.4.2",
|
||||
"js-tokens": "^4.0.0"
|
||||
"js-tokens": "^4.0.0",
|
||||
"picocolors": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strip-ansi": "^4.0.0"
|
||||
|
||||
Reference in New Issue
Block a user