Socket
Socket
Sign inDemoInstall

@babel/code-frame

Package Overview
Dependencies
10
Maintainers
4
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

@babel/code-frame

Generate errors that contain a code frame that point to source locations.

    7.23.5latest
    GitHub
    npm

Version published
Maintainers
4
Weekly downloads
49,255,181
decreased by-14.33%

Weekly downloads

Package description

What is @babel/code-frame?

The @babel/code-frame package is used to generate a string representing code with a specific error highlighted. It is often used to produce more readable error messages in development tools by showing the code snippet where an error has occurred along with line and column numbers.

What are @babel/code-frame's main functionalities?

Highlighting syntax errors in code

This feature allows developers to highlight syntax errors in their code. The code sample shows how to use the codeFrameColumns function to generate a string that highlights the location of an error in the source code.

const { codeFrameColumns } = require('@babel/code-frame');
const rawLines = `class Foo {
  constructor()
}
`;
const location = { start: { line: 2, column: 15 } };

const result = codeFrameColumns(rawLines, location, {
  highlightCode: true
});

console.log(result);

Other packages similar to @babel/code-frame

Changelog

Source

v7.23.5 (2023-11-29)

:eyeglasses: Spec Compliance
  • babel-plugin-proposal-decorators
    • #16138 Class binding is in TDZ during decorators initialization (@nicolo-ribaudo)
  • babel-helpers, babel-plugin-proposal-decorators
:bug: Bug Fix
  • babel-traverse, babel-types
  • babel-plugin-transform-classes
  • babel-generator
  • babel-helpers
  • babel-helper-create-class-features-plugin, babel-plugin-transform-class-properties, babel-plugin-transform-typescript
  • babel-generator, babel-plugin-transform-modules-commonjs, babel-plugin-transform-parameters, babel-plugin-transform-typescript, babel-traverse
  • babel-eslint-plugin
:microscope: Output optimization

Readme

Source

@babel/code-frame

Generate errors that contain a code frame that point to source locations.

See our website @babel/code-frame for more information.

Install

Using npm:

npm install --save-dev @babel/code-frame

or using yarn:

yarn add @babel/code-frame --dev

FAQs

Last updated on 29 Nov 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

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