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

@babel/generator

Package Overview
Dependencies
Maintainers
4
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/generator - npm Package Compare versions

Comparing version 7.25.5 to 7.25.6

8

lib/generators/base.js

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

const newline = node.body.length ? 2 : 1;
this.printSequence(node.directives, node, {
this.printSequence(node.directives, {
trailingCommentsLineOffset: newline

@@ -35,3 +35,3 @@ });

}
this.printSequence(node.body, node);
this.printSequence(node.body);
}

@@ -45,3 +45,3 @@ function BlockStatement(node) {

const newline = node.body.length ? 2 : 1;
this.printSequence(node.directives, node, {
this.printSequence(node.directives, {
indent: true,

@@ -55,3 +55,3 @@ trailingCommentsLineOffset: newline

const exit = this.enterForStatementInit(false);
this.printSequence(node.body, node, {
this.printSequence(node.body, {
indent: true

@@ -58,0 +58,0 @@ });

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

if (!inExport || !this._shouldPrintDecoratorsBeforeExport(parent)) {
this.printJoin(node.decorators, node);
this.printJoin(node.decorators);
}

@@ -51,3 +51,3 @@ if (node.declare) {

this.space();
this.printList(node.implements, node);
this.printList(node.implements);
}

@@ -64,3 +64,3 @@ this.space();

const exit = this.enterForStatementInit(false);
this.printSequence(node.body, node, {
this.printSequence(node.body, {
indent: true

@@ -75,3 +75,3 @@ });

var _node$key$loc;
this.printJoin(node.decorators, node);
this.printJoin(node.decorators);
const endLine = (_node$key$loc = node.key.loc) == null || (_node$key$loc = _node$key$loc.end) == null ? void 0 : _node$key$loc.line;

@@ -105,3 +105,3 @@ if (endLine) this.catchUp(endLine);

var _node$key$loc2;
this.printJoin(node.decorators, node);
this.printJoin(node.decorators);
const endLine = (_node$key$loc2 = node.key.loc) == null || (_node$key$loc2 = _node$key$loc2.end) == null ? void 0 : _node$key$loc2.line;

@@ -136,3 +136,3 @@ if (endLine) this.catchUp(endLine);

function ClassPrivateProperty(node) {
this.printJoin(node.decorators, node);
this.printJoin(node.decorators);
if (node.static) {

@@ -164,3 +164,3 @@ this.word("static");

var _node$key$loc3;
this.printJoin(node.decorators, node);
this.printJoin(node.decorators);
const endLine = (_node$key$loc3 = node.key.loc) == null || (_node$key$loc3 = _node$key$loc3.end) == null ? void 0 : _node$key$loc3.line;

@@ -179,3 +179,3 @@ if (endLine) this.catchUp(endLine);

this.newline();
this.printSequence(node.body, node, {
this.printSequence(node.body, {
indent: true

@@ -182,0 +182,0 @@ });

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

} else {
this.printTerminatorless(node.argument, node, true);
this.printTerminatorless(node.argument, true);
this.token(node.operator);

@@ -104,3 +104,3 @@ }

const exit = this.enterForStatementInit(false);
this.printList(node.arguments, node);
this.printList(node.arguments);
exit();

@@ -110,3 +110,3 @@ this.rightParens(node);

function SequenceExpression(node) {
this.printList(node.expressions, node);
this.printList(node.expressions);
}

@@ -168,3 +168,3 @@ function ThisExpression() {

const exit = this.enterForStatementInit(false);
this.printList(node.arguments, node);
this.printList(node.arguments);
exit();

@@ -179,3 +179,3 @@ this.rightParens(node);

const exit = this.enterForStatementInit(false);
this.printList(node.arguments, node);
this.printList(node.arguments);
exit();

@@ -191,3 +191,3 @@ this.rightParens(node);

this.space();
this.printTerminatorless(node.argument, node, false);
this.printTerminatorless(node.argument, false);
}

@@ -206,3 +206,3 @@ }

this.space();
this.printTerminatorless(node.argument, node, false);
this.printTerminatorless(node.argument, false);
}

@@ -209,0 +209,0 @@ }

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

this.space();
this.printList(node.specifiers, node);
this.printList(node.specifiers);
this.space();

@@ -326,3 +326,3 @@ }

}
this.printList(node.params, node);
this.printList(node.params);
if (node.rest) {

@@ -368,3 +368,3 @@ if (node.params.length) {

this.space();
this.printList(node.extends, node);
this.printList(node.extends);
}

@@ -377,3 +377,3 @@ if (node.type === "DeclareClass") {

this.space();
this.printList(node.mixins, node);
this.printList(node.mixins);
}

@@ -384,3 +384,3 @@ if ((_node$implements = node.implements) != null && _node$implements.length) {

this.space();
this.printList(node.implements, node);
this.printList(node.implements);
}

@@ -419,3 +419,3 @@ }

this.space();
this.printList(node.extends, node);
this.printList(node.extends);
}

@@ -426,3 +426,3 @@ this.space();

function IntersectionTypeAnnotation(node) {
this.printJoin(node.types, node, {
this.printJoin(node.types, {
separator: andSeparator

@@ -452,3 +452,3 @@ });

this.tokenChar(91);
this.printList(node.types, node);
this.printList(node.types);
this.tokenChar(93);

@@ -484,3 +484,3 @@ }

this.tokenChar(60);
this.printList(node.params, node, {});
this.printList(node.params, {});
this.tokenChar(62);

@@ -531,3 +531,3 @@ }

this.space();
this.printJoin(props, node, {
this.printJoin(props, {
addNewlines(leading) {

@@ -643,3 +643,3 @@ if (leading && !props[0]) return 1;

function UnionTypeAnnotation(node) {
this.printJoin(node.types, node, {
this.printJoin(node.types, {
separator: orSeparator

@@ -646,0 +646,0 @@ });

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

this.print(node.argument);
this.tokenChar(125);
this.rightBrace(node);
}

@@ -51,3 +51,3 @@ function JSXExpressionContainer(node) {

this.print(node.expression);
this.tokenChar(125);
this.rightBrace(node);
}

@@ -58,3 +58,3 @@ function JSXSpreadChild(node) {

this.print(node.expression);
this.tokenChar(125);
this.rightBrace(node);
}

@@ -89,3 +89,3 @@ function JSXText(node) {

this.space();
this.printJoin(node.attributes, node, {
this.printJoin(node.attributes, {
separator: spaceSeparator

@@ -92,0 +92,0 @@ });

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

function _param(parameter) {
this.printJoin(parameter.decorators, parameter);
this.printJoin(parameter.decorators);
this.print(parameter);

@@ -48,0 +48,0 @@ if (parameter.optional) {

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

if (!useAssertKeyword && importAttributesKeyword !== "with") {
this.printList(attributes || assertions, node);
this.printList(attributes || assertions);
return;

@@ -97,3 +97,3 @@ }

this.space();
this.printList(attributes || assertions, node);
this.printList(attributes || assertions);
this.space();

@@ -125,3 +125,3 @@ this.tokenChar(125);

if (isClassDeclaration(node.declaration) && printer._shouldPrintDecoratorsBeforeExport(node)) {
printer.printJoin(node.declaration.decorators, node);
printer.printJoin(node.declaration.decorators);
}

@@ -161,3 +161,3 @@ }

this.space();
this.printList(specifiers, node);
this.printList(specifiers);
this.space();

@@ -230,3 +230,3 @@ }

this.space();
this.printList(specifiers, node);
this.printList(specifiers);
this.space();

@@ -233,0 +233,0 @@ this.tokenChar(125);

@@ -143,6 +143,6 @@ "use strict";

}
function printStatementAfterKeyword(printer, node, parent, isLabel) {
function printStatementAfterKeyword(printer, node, isLabel) {
if (node) {
printer.space();
printer.printTerminatorless(node, parent, isLabel);
printer.printTerminatorless(node, isLabel);
}

@@ -153,15 +153,15 @@ printer.semicolon();

this.word("break");
printStatementAfterKeyword(this, node.label, node, true);
printStatementAfterKeyword(this, node.label, true);
}
function ContinueStatement(node) {
this.word("continue");
printStatementAfterKeyword(this, node.label, node, true);
printStatementAfterKeyword(this, node.label, true);
}
function ReturnStatement(node) {
this.word("return");
printStatementAfterKeyword(this, node.argument, node, false);
printStatementAfterKeyword(this, node.argument, false);
}
function ThrowStatement(node) {
this.word("throw");
printStatementAfterKeyword(this, node.argument, node, false);
printStatementAfterKeyword(this, node.argument, false);
}

@@ -211,3 +211,3 @@ function LabeledStatement(node) {

this.tokenChar(123);
this.printSequence(node.cases, node, {
this.printSequence(node.cases, {
indent: true,

@@ -232,3 +232,3 @@ addNewlines(leading, cas) {

this.newline();
this.printSequence(node.consequent, node, {
this.printSequence(node.consequent, {
indent: true

@@ -266,3 +266,3 @@ });

}
this.printList(node.declarations, node, {
this.printList(node.declarations, {
separator: hasInits ? function () {

@@ -269,0 +269,0 @@ this.tokenChar(44);

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

this.space();
this.printList(props, node, {
this.printList(props, {
indent: true,

@@ -62,3 +62,3 @@ statement: true

function ObjectMethod(node) {
this.printJoin(node.decorators, node);
this.printJoin(node.decorators);
this._methodHead(node);

@@ -69,3 +69,3 @@ this.space();

function ObjectProperty(node) {
this.printJoin(node.decorators, node);
this.printJoin(node.decorators);
if (node.computed) {

@@ -125,3 +125,3 @@ this.tokenChar(91);

this.space();
this.printList(props, node, {
this.printList(props, {
indent: true,

@@ -128,0 +128,0 @@ statement: true

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

this.tokenChar(60);
this.printList(node.params, node, {});
this.printList(node.params, {});
if (parent.type === "ArrowFunctionExpression" && node.params.length === 1) {

@@ -320,7 +320,8 @@ this.tokenChar(44);

this.print(node.elementType, true);
this.token("[]");
this.tokenChar(91);
this.tokenChar(93);
}
function TSTupleType(node) {
this.tokenChar(91);
this.printList(node.elementTypes, node);
this.printList(node.elementTypes);
this.tokenChar(93);

@@ -350,3 +351,3 @@ }

function tsPrintUnionOrIntersectionType(printer, node, sep) {
printer.printJoin(node.types, node, {
printer.printJoin(node.types, {
separator() {

@@ -400,3 +401,2 @@ this.space();

readonly,
typeParameter,
typeAnnotation

@@ -412,7 +412,11 @@ } = node;

this.tokenChar(91);
this.word(typeParameter.name);
{
this.word(node.typeParameter.name);
}
this.space();
this.word("in");
this.space();
this.print(typeParameter.constraint);
{
this.print(node.typeParameter.constraint);
}
if (nameType) {

@@ -469,3 +473,3 @@ this.space();

this.space();
this.printList(extendz, node);
this.printList(extendz);
}

@@ -472,0 +476,0 @@ this.space();

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

const parentType = parent.type;
return parentType === "TSArrayType" || parentType === "TSOptionalType" || parentType === "TSIntersectionType" || parentType === "TSUnionType" || parentType === "TSRestType";
return parentType === "TSArrayType" || parentType === "TSOptionalType" || parentType === "TSIntersectionType" || parentType === "TSRestType";
}

@@ -123,0 +123,0 @@ function TSInferType(node, parent) {

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

}
printTerminatorless(node, parent, isLabel) {
printTerminatorless(node, isLabel) {
if (isLabel) {

@@ -411,3 +411,3 @@ this._noLineTerminator = true;

}
printJoin(nodes, parent, opts = {}) {
printJoin(nodes, opts = {}) {
if (!(nodes != null && nodes.length)) return;

@@ -507,13 +507,13 @@ let {

}
printSequence(nodes, parent, opts = {}) {
printSequence(nodes, opts = {}) {
var _opts$indent;
opts.statement = true;
(_opts$indent = opts.indent) != null ? _opts$indent : opts.indent = false;
this.printJoin(nodes, parent, opts);
this.printJoin(nodes, opts);
}
printList(items, parent, opts = {}) {
printList(items, opts = {}) {
if (opts.separator == null) {
opts.separator = commaSeparator;
}
this.printJoin(items, parent, opts);
this.printJoin(items, opts);
}

@@ -563,3 +563,3 @@ _printNewline(newLine, opts) {

const lastCharCode = this.getLastChar();
if (lastCharCode !== 91 && lastCharCode !== 123) {
if (lastCharCode !== 91 && lastCharCode !== 123 && lastCharCode !== 40) {
this.space();

@@ -566,0 +566,0 @@ }

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

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

"dependencies": {
"@babel/types": "^7.25.4",
"@babel/types": "^7.25.6",
"@jridgewell/gen-mapping": "^0.3.5",

@@ -30,3 +30,3 @@ "@jridgewell/trace-mapping": "^0.3.25",

"@babel/helper-fixtures": "^7.24.8",
"@babel/parser": "^7.25.4",
"@babel/parser": "^7.25.6",
"@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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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