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.24.5 to 7.24.6

13

lib/generators/template-literals.js

@@ -14,18 +14,19 @@ "use strict";

}
function TemplateElement(node, parent) {
const isFirst = parent.quasis[0] === node;
const isLast = parent.quasis[parent.quasis.length - 1] === node;
const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${");
this.token(value, true);
function TemplateElement() {
throw new Error("TemplateElement printing is handled in TemplateLiteral");
}
function TemplateLiteral(node) {
const quasis = node.quasis;
let partRaw = "`";
for (let i = 0; i < quasis.length; i++) {
this.print(quasis[i], node);
partRaw += quasis[i].value.raw;
if (i + 1 < quasis.length) {
this.token(partRaw + "${", true);
this.print(node.expressions[i], node);
partRaw = "}";
}
}
this.token(partRaw + "`", true);
}
//# sourceMappingURL=template-literals.js.map

@@ -104,10 +104,12 @@ "use strict";

let endToken;
if (this.format.recordAndTupleSyntaxType === "bar") {
startToken = "{|";
endToken = "|}";
} else if (this.format.recordAndTupleSyntaxType !== "hash" && this.format.recordAndTupleSyntaxType != null) {
throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);
} else {
startToken = "#{";
endToken = "}";
{
if (this.format.recordAndTupleSyntaxType === "bar") {
startToken = "{|";
endToken = "|}";
} else if (this.format.recordAndTupleSyntaxType !== "hash" && this.format.recordAndTupleSyntaxType != null) {
throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);
} else {
startToken = "#{";
endToken = "}";
}
}

@@ -130,10 +132,12 @@ this.token(startToken);

let endToken;
if (this.format.recordAndTupleSyntaxType === "bar") {
startToken = "[|";
endToken = "|]";
} else if (this.format.recordAndTupleSyntaxType === "hash") {
startToken = "#[";
endToken = "]";
} else {
throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);
{
if (this.format.recordAndTupleSyntaxType === "bar") {
startToken = "[|";
endToken = "|]";
} else if (this.format.recordAndTupleSyntaxType === "hash") {
startToken = "#[";
endToken = "]";
} else {
throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);
}
}

@@ -140,0 +144,0 @@ this.token(startToken);

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

function normalizeOptions(code, opts) {
var _opts$recordAndTupleS;
const format = {

@@ -31,3 +30,2 @@ auxiliaryCommentBefore: opts.auxiliaryCommentBefore,

}, opts.jsescOption),
recordAndTupleSyntaxType: (_opts$recordAndTupleS = opts.recordAndTupleSyntaxType) != null ? _opts$recordAndTupleS : "hash",
topicToken: opts.topicToken,

@@ -37,4 +35,6 @@ importAttributesKeyword: opts.importAttributesKeyword

{
var _opts$recordAndTupleS;
format.decoratorsBeforeExport = opts.decoratorsBeforeExport;
format.jsescOption.json = opts.jsonCompatibleStrings;
format.recordAndTupleSyntaxType = (_opts$recordAndTupleS = opts.recordAndTupleSyntaxType) != null ? _opts$recordAndTupleS : "hash";
}

@@ -41,0 +41,0 @@ if (format.minified) {

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

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

"dependencies": {
"@babel/types": "^7.24.5",
"@babel/types": "^7.24.6",
"@jridgewell/gen-mapping": "^0.3.5",

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

"devDependencies": {
"@babel/helper-fixtures": "^7.24.4",
"@babel/parser": "^7.24.5",
"@babel/helper-fixtures": "^7.24.6",
"@babel/parser": "^7.24.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

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