You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@babel/code-frame

Package Overview
Dependencies
Maintainers
4
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/code-frame - npm Package Compare versions

Comparing version
7.28.6
to
7.29.0
+7
-6
lib/index.js

@@ -93,3 +93,3 @@ 'use strict';

const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
function getMarkerLines(loc, source, opts) {
function getMarkerLines(loc, source, opts, startLineBaseZero) {
const startLoc = Object.assign({

@@ -104,5 +104,5 @@ column: 0,

} = opts || {};
const startLine = startLoc.line;
const startLine = startLoc.line - startLineBaseZero;
const startColumn = startLoc.column;
const endLine = endLoc.line;
const endLine = endLoc.line - startLineBaseZero;
const endColumn = endLoc.column;

@@ -153,2 +153,3 @@ let start = Math.max(startLine - (linesAbove + 1), 0);

const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
const startLineBaseZero = (opts.startLine || 1) - 1;
const defs = getDefs(shouldHighlight);

@@ -160,9 +161,9 @@ const lines = rawLines.split(NEWLINE);

markerLines
} = getMarkerLines(loc, lines, opts);
} = getMarkerLines(loc, lines, opts, startLineBaseZero);
const hasColumns = loc.start && typeof loc.start.column === "number";
const numberMaxWidth = String(end).length;
const numberMaxWidth = String(end + startLineBaseZero).length;
const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
const number = start + 1 + index;
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
const gutter = ` ${paddedNumber} |`;

@@ -169,0 +170,0 @@ const hasMarker = markerLines[number];

{
"name": "@babel/code-frame",
"version": "7.28.6",
"version": "7.29.0",
"description": "Generate errors that contain a code frame that point to source locations.",

@@ -5,0 +5,0 @@ "author": "The Babel Team (https://babel.dev/team)",

Sorry, the diff of this file is not supported yet