Socket
Socket
Sign inDemoInstall

@babel/code-frame

Package Overview
Dependencies
11
Maintainers
4
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.18.6 to 7.21.4

lib/index.js.map

27

lib/index.js

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

exports.default = _default;
var _highlight = require("@babel/highlight");
let deprecationWarningShown = false;
function getDefs(chalk) {

@@ -21,5 +18,3 @@ return {

}
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
function getMarkerLines(loc, source, opts) {

@@ -41,18 +36,13 @@ const startLoc = Object.assign({

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) {

@@ -81,3 +71,2 @@ markerLines[lineNumber] = true;

}
return {

@@ -89,3 +78,2 @@ start,

}
function codeFrameColumns(rawLines, loc, opts = {}) {

@@ -95,7 +83,5 @@ const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);

const defs = getDefs(chalk);
const maybeHighlight = (chalkFn, string) => {
return highlighted ? chalkFn(string) : string;
};
const lines = rawLines.split(NEWLINE);

@@ -116,6 +102,4 @@ const {

const lastMarkerLine = !markerLines[number + 1];
if (hasMarker) {
let markerLine = "";
if (Array.isArray(hasMarker)) {

@@ -125,3 +109,2 @@ const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");

markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
if (lastMarkerLine && opts.message) {

@@ -131,3 +114,2 @@ markerLine += " " + maybeHighlight(defs.message, opts.message);

}
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");

@@ -138,7 +120,5 @@ } else {

}).join("\n");
if (opts.message && !hasColumns) {
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
}
if (highlighted) {

@@ -150,3 +130,2 @@ return chalk.reset(frame);

}
function _default(rawLines, lineNumber, colNumber, opts = {}) {

@@ -156,3 +135,2 @@ if (!deprecationWarningShown) {

const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
if (process.emitWarning) {

@@ -166,3 +144,2 @@ process.emitWarning(message, "DeprecationWarning");

}
colNumber = Math.max(colNumber, 0);

@@ -176,2 +153,4 @@ const location = {

return codeFrameColumns(rawLines, location, opts);
}
}
//# sourceMappingURL=index.js.map
{
"name": "@babel/code-frame",
"version": "7.18.6",
"version": "7.21.4",
"description": "Generate errors that contain a code frame that point to source locations.",

@@ -22,4 +22,2 @@ "author": "The Babel Team (https://babel.dev/team)",

"devDependencies": {
"@types/chalk": "^2.0.0",
"chalk": "^2.0.0",
"strip-ansi": "^4.0.0"

@@ -26,0 +24,0 @@ },

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc