Socket
Socket
Sign inDemoInstall

@babel/generator

Package Overview
Dependencies
10
Maintainers
4
Versions
165
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.23.3 to 7.23.4

26

lib/printer.js

@@ -20,3 +20,2 @@ "use strict";

const ZERO_DECIMAL_INTEGER = /\.0+$/;
const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/;
const HAS_NEWLINE = /[\n\r\u2028\u2029]/;

@@ -262,5 +261,3 @@ const HAS_NEWLINE_OR_BlOCK_COMMENT_END = /[\n\r\u2028\u2029]|\*\//;

if (chaPost === 42) {
if (PURE_ANNOTATION_RE.test(str.slice(i + 2, len - 2))) {
return;
}
return;
} else if (chaPost !== 47) {

@@ -314,3 +311,3 @@ this._parenPushNewlineState = null;

print(node, parent, noLineTerminatorAfter, trailingCommentsLineOffset, forceParens) {
var _node$extra;
var _node$extra, _node$leadingComments;
if (!node) return;

@@ -332,3 +329,20 @@ this._endsWithInnerRaw = false;

this._maybeAddAuxComment(this._insideAux && !oldInAux);
const shouldPrintParens = forceParens || format.retainFunctionParens && nodeType === "FunctionExpression" && ((_node$extra = node.extra) == null ? void 0 : _node$extra.parenthesized) || needsParens(node, parent, this._printStack);
const parenthesized = (_node$extra = node.extra) == null ? void 0 : _node$extra.parenthesized;
let shouldPrintParens = forceParens || parenthesized && format.retainFunctionParens && nodeType === "FunctionExpression" || needsParens(node, parent, this._printStack);
if (!shouldPrintParens && parenthesized && (_node$leadingComments = node.leadingComments) != null && _node$leadingComments.length && node.leadingComments[0].type === "CommentBlock") {
const parentType = parent == null ? void 0 : parent.type;
switch (parentType) {
case "ExpressionStatement":
case "VariableDeclarator":
case "AssignmentExpression":
case "ReturnStatement":
break;
case "CallExpression":
case "OptionalCallExpression":
case "NewExpression":
if (parent.callee !== node) break;
default:
shouldPrintParens = true;
}
}
if (shouldPrintParens) {

@@ -335,0 +349,0 @@ this.tokenChar(40);

{
"name": "@babel/generator",
"version": "7.23.3",
"version": "7.23.4",
"description": "Turns an AST into code.",

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

"dependencies": {
"@babel/types": "^7.23.3",
"@babel/types": "^7.23.4",
"@jridgewell/gen-mapping": "^0.3.2",

@@ -29,4 +29,4 @@ "@jridgewell/trace-mapping": "^0.3.17",

"devDependencies": {
"@babel/helper-fixtures": "^7.22.19",
"@babel/parser": "^7.23.3",
"@babel/helper-fixtures": "^7.23.4",
"@babel/parser": "^7.23.4",
"@jridgewell/sourcemap-codec": "^1.4.15",

@@ -33,0 +33,0 @@ "@types/jsesc": "^2.5.0",

Sorry, the diff of this file is not supported yet

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