Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@babel/highlight

Package Overview
Dependencies
Maintainers
5
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 7.0.0-beta.46 to 7.0.0-beta.47

46

lib/index.js

@@ -11,3 +11,3 @@ "use strict";

function _jsTokens() {
var data = _interopRequireWildcard(require("js-tokens"));
const data = _interopRequireWildcard(require("js-tokens"));

@@ -22,3 +22,3 @@ _jsTokens = function _jsTokens() {

function _esutils() {
var data = _interopRequireDefault(require("esutils"));
const data = _interopRequireDefault(require("esutils"));

@@ -33,3 +33,3 @@ _esutils = function _esutils() {

function _chalk() {
var data = _interopRequireDefault(require("chalk"));
const data = _interopRequireDefault(require("chalk"));

@@ -61,12 +61,12 @@ _chalk = function _chalk() {

var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
var JSX_TAG = /^[a-z][\w-]*$/i;
var BRACKET = /^[()[\]{}]$/;
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
const JSX_TAG = /^[a-z][\w-]*$/i;
const BRACKET = /^[()[\]{}]$/;
function getTokenType(match) {
var _match$slice = match.slice(-2),
offset = _match$slice[0],
text = _match$slice[1];
const _match$slice = match.slice(-2),
offset = _match$slice[0],
text = _match$slice[1];
var token = (0, _jsTokens().matchToToken)(match);
const token = (0, _jsTokens().matchToToken)(match);

@@ -99,14 +99,8 @@ if (token.type === "name") {

function highlightTokens(defs, text) {
return text.replace(_jsTokens().default, function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return text.replace(_jsTokens().default, function (...args) {
const type = getTokenType(args);
const colorize = defs[type];
var type = getTokenType(args);
var colorize = defs[type];
if (colorize) {
return args[0].split(NEWLINE).map(function (str) {
return colorize(str);
}).join("\n");
return args[0].split(NEWLINE).map(str => colorize(str)).join("\n");
} else {

@@ -123,3 +117,3 @@ return args[0];

function getChalk(options) {
var chalk = _chalk().default;
let chalk = _chalk().default;

@@ -136,10 +130,6 @@ if (options.forceColor) {

function highlight(code, options) {
if (options === void 0) {
options = {};
}
function highlight(code, options = {}) {
if (shouldHighlight(options)) {
var chalk = getChalk(options);
var defs = getDefs(chalk);
const chalk = getChalk(options);
const defs = getDefs(chalk);
return highlightTokens(defs, code);

@@ -146,0 +136,0 @@ } else {

{
"name": "@babel/highlight",
"version": "7.0.0-beta.46",
"version": "7.0.0-beta.47",
"description": "Syntax highlight JavaScript strings for output in terminals.",

@@ -5,0 +5,0 @@ "author": "suchipi <me@suchipi.com>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc