🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@babel/highlight

Package Overview
Dependencies
Maintainers
4
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/highlight - npm Package Compare versions

Comparing version

to
7.22.10

30

lib/index.js

@@ -7,7 +7,7 @@ "use strict";

exports.default = highlight;
exports.getChalk = getChalk;
exports.shouldHighlight = shouldHighlight;
var _jsTokens = require("js-tokens");
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
var _chalk = require("chalk");
var _chalk2 = require("chalk");
const chalk = _chalk2;
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);

@@ -79,14 +79,24 @@ function getDefs(chalk) {

function shouldHighlight(options) {
return !!_chalk.supportsColor || options.forceColor;
return !!chalk.supportsColor || options.forceColor;
}
function getChalk(options) {
return options.forceColor ? new _chalk.constructor({
enabled: true,
level: 1
}) : _chalk;
let chalkWithForcedColor = undefined;
function getChalk(forceColor) {
if (forceColor) {
var _chalkWithForcedColor;
(_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new chalk.constructor({
enabled: true,
level: 1
});
return chalkWithForcedColor;
}
return chalk;
}
{
{
exports.getChalk = options => getChalk(options.forceColor);
}
}
function highlight(code, options = {}) {
if (code !== "" && shouldHighlight(options)) {
const chalk = getChalk(options);
const defs = getDefs(chalk);
const defs = getDefs(getChalk(options.forceColor));
return highlightTokens(defs, code);

@@ -93,0 +103,0 @@ } else {

{
"name": "@babel/highlight",
"version": "7.22.5",
"version": "7.22.10",
"description": "Syntax highlight JavaScript strings for output in terminals.",

@@ -19,7 +19,6 @@ "author": "The Babel Team (https://babel.dev/team)",

"@babel/helper-validator-identifier": "^7.22.5",
"chalk": "^2.0.0",
"chalk": "^2.4.2",
"js-tokens": "^4.0.0"
},
"devDependencies": {
"@types/chalk": "^2.0.0",
"strip-ansi": "^4.0.0"

@@ -26,0 +25,0 @@ },

@@ -5,3 +5,3 @@ # @babel/highlight

See our website [@babel/highlight](https://babeljs.io/docs/en/babel-highlight) for more information.
See our website [@babel/highlight](https://babeljs.io/docs/babel-highlight) for more information.

@@ -8,0 +8,0 @@ ## Install

Sorry, the diff of this file is not supported yet