Socket
Socket
Sign inDemoInstall

@babel/generator

Package Overview
Dependencies
Maintainers
5
Versions
179
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.6.2 to 7.6.3

12

lib/generators/classes.js

@@ -14,12 +14,4 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -30,3 +22,3 @@

function ClassDeclaration(node, parent) {
if (!this.format.decoratorsBeforeExport || !t().isExportDefaultDeclaration(parent) && !t().isExportNamedDeclaration(parent)) {
if (!this.format.decoratorsBeforeExport || !t.isExportDefaultDeclaration(parent) && !t.isExportNamedDeclaration(parent)) {
this.printJoin(node.decorators, node);

@@ -33,0 +25,0 @@ }

22

lib/generators/expressions.js

@@ -31,12 +31,4 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
var n = _interopRequireWildcard(require("../node"));

@@ -100,5 +92,5 @@

if (this.format.minified && node.arguments.length === 0 && !node.optional && !t().isCallExpression(parent, {
if (this.format.minified && node.arguments.length === 0 && !node.optional && !t.isCallExpression(parent, {
callee: node
}) && !t().isMemberExpression(parent) && !t().isNewExpression(parent)) {
}) && !t.isMemberExpression(parent) && !t.isNewExpression(parent)) {
return;

@@ -140,3 +132,3 @@ }

if (!node.computed && t().isMemberExpression(node.property)) {
if (!node.computed && t.isMemberExpression(node.property)) {
throw new TypeError("Got a MemberExpression for MemberExpression property");

@@ -147,3 +139,3 @@ }

if (t().isLiteral(node.property) && typeof node.property.value === "number") {
if (t.isLiteral(node.property) && typeof node.property.value === "number") {
computed = true;

@@ -270,3 +262,3 @@ }

if (!node.computed && t().isMemberExpression(node.property)) {
if (!node.computed && t.isMemberExpression(node.property)) {
throw new TypeError("Got a MemberExpression for MemberExpression property");

@@ -277,3 +269,3 @@ }

if (t().isLiteral(node.property) && typeof node.property.value === "number") {
if (t.isLiteral(node.property) && typeof node.property.value === "number") {
computed = true;

@@ -280,0 +272,0 @@ }

@@ -69,12 +69,4 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
var _modules = require("./modules");

@@ -111,3 +103,3 @@

function DeclareClass(node, parent) {
if (!t().isDeclareExportDeclaration(parent)) {
if (!t.isDeclareExportDeclaration(parent)) {
this.word("declare");

@@ -124,3 +116,3 @@ this.space();

function DeclareFunction(node, parent) {
if (!t().isDeclareExportDeclaration(parent)) {
if (!t.isDeclareExportDeclaration(parent)) {
this.word("declare");

@@ -188,3 +180,3 @@ this.space();

function DeclareOpaqueType(node, parent) {
if (!t().isDeclareExportDeclaration(parent)) {
if (!t.isDeclareExportDeclaration(parent)) {
this.word("declare");

@@ -198,3 +190,3 @@ this.space();

function DeclareVariable(node, parent) {
if (!t().isDeclareExportDeclaration(parent)) {
if (!t.isDeclareExportDeclaration(parent)) {
this.word("declare");

@@ -236,3 +228,3 @@ this.space();

this.print(declar, node);
if (!t().isStatement(declar)) this.semicolon();
if (!t.isStatement(declar)) this.semicolon();
} else {

@@ -239,0 +231,0 @@ this.token("{");

@@ -15,12 +15,4 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -138,3 +130,3 @@

if (node.params.length === 1 && t().isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
if (node.params.length === 1 && t.isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
if (this.format.retainLines && node.loc && node.body.loc && node.loc.start.line < node.body.loc.start.line) {

@@ -141,0 +133,0 @@ this.token("(");

@@ -17,12 +17,4 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -93,3 +85,3 @@

function ExportNamedDeclaration(node) {
if (this.format.decoratorsBeforeExport && t().isClassDeclaration(node.declaration)) {
if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node);

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

function ExportDefaultDeclaration(node) {
if (this.format.decoratorsBeforeExport && t().isClassDeclaration(node.declaration)) {
if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node);

@@ -120,3 +112,3 @@ }

this.print(declar, node);
if (!t().isStatement(declar)) this.semicolon();
if (!t.isStatement(declar)) this.semicolon();
} else {

@@ -134,3 +126,3 @@ if (node.exportKind === "type") {

if (t().isExportDefaultSpecifier(first) || t().isExportNamespaceSpecifier(first)) {
if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) {
hasSpecial = true;

@@ -186,3 +178,3 @@ this.print(specifiers.shift(), node);

if (t().isImportDefaultSpecifier(first) || t().isImportNamespaceSpecifier(first)) {
if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) {
this.print(specifiers.shift(), node);

@@ -189,0 +181,0 @@

@@ -21,12 +21,4 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -52,3 +44,3 @@

this.space();
const needsBlock = node.alternate && t().isIfStatement(getLastStatement(node.consequent));
const needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent));

@@ -78,3 +70,3 @@ if (needsBlock) {

function getLastStatement(statement) {
if (!t().isStatement(statement.body)) return statement;
if (!t.isStatement(statement.body)) return statement;
return getLastStatement(statement.body);

@@ -288,3 +280,3 @@ }

if (!t().isFor(parent)) {
if (!t.isFor(parent)) {
for (const declar of node.declarations) {

@@ -307,3 +299,3 @@ if (declar.init) {

if (t().isFor(parent)) {
if (t.isFor(parent)) {
if (parent.left === node || parent.init === node) return;

@@ -310,0 +302,0 @@ }

@@ -23,22 +23,6 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
var _jsesc = _interopRequireDefault(require("jsesc"));
return data;
}
function _jsesc() {
const data = _interopRequireDefault(require("jsesc"));
_jsesc = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -99,3 +83,3 @@

} else {
if (t().isAssignmentPattern(node.value) && t().isIdentifier(node.key) && node.key.name === node.value.left.name) {
if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) {
this.print(node.value, node);

@@ -107,3 +91,3 @@ return;

if (node.shorthand && t().isIdentifier(node.key) && t().isIdentifier(node.value) && node.key.name === node.value.name) {
if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) {
return;

@@ -178,3 +162,3 @@ }

const val = (0, _jsesc().default)(node.value, opts);
const val = (0, _jsesc.default)(node.value, opts);
return this.token(val);

@@ -181,0 +165,0 @@ }

@@ -15,12 +15,4 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -42,3 +34,3 @@

for (const type of Object.keys(obj)) {
const aliases = t().FLIPPED_ALIAS_KEYS[type];
const aliases = t.FLIPPED_ALIAS_KEYS[type];

@@ -67,7 +59,7 @@ if (aliases) {

function isOrHasCallExpression(node) {
if (t().isCallExpression(node)) {
if (t.isCallExpression(node)) {
return true;
}
if (t().isMemberExpression(node)) {
if (t.isMemberExpression(node)) {
return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);

@@ -82,3 +74,3 @@ } else {

if (t().isExpressionStatement(node)) {
if (t.isExpressionStatement(node)) {
node = node.expression;

@@ -118,8 +110,8 @@ }

if (t().isNewExpression(parent) && parent.callee === node) {
if (t.isNewExpression(parent) && parent.callee === node) {
if (isOrHasCallExpression(node)) return true;
}
if (t().isLogicalExpression(node) && parent.operator === "??") return true;
if (t.isLogicalExpression(node) && parent.operator === "??") return true;
return find(expandedParens, node, parent, printStack);
}

@@ -28,12 +28,4 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -70,18 +62,18 @@

const isClassExtendsClause = (node, parent) => (t().isClassDeclaration(parent) || t().isClassExpression(parent)) && parent.superClass === node;
const isClassExtendsClause = (node, parent) => (t.isClassDeclaration(parent) || t.isClassExpression(parent)) && parent.superClass === node;
function NullableTypeAnnotation(node, parent) {
return t().isArrayTypeAnnotation(parent);
return t.isArrayTypeAnnotation(parent);
}
function FunctionTypeAnnotation(node, parent) {
return t().isUnionTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isArrayTypeAnnotation(parent);
return t.isUnionTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isArrayTypeAnnotation(parent);
}
function UpdateExpression(node, parent) {
return t().isMemberExpression(parent, {
return t.isMemberExpression(parent, {
object: node
}) || t().isCallExpression(parent, {
}) || t.isCallExpression(parent, {
callee: node
}) || t().isNewExpression(parent, {
}) || t.isNewExpression(parent, {
callee: node

@@ -102,3 +94,3 @@ }) || isClassExtendsClause(node, parent);

function Binary(node, parent) {
if (node.operator === "**" && t().isBinaryExpression(parent, {
if (node.operator === "**" && t.isBinaryExpression(parent, {
operator: "**"

@@ -113,7 +105,7 @@ })) {

if ((t().isCallExpression(parent) || t().isNewExpression(parent)) && parent.callee === node || t().isUnaryLike(parent) || t().isMemberExpression(parent) && parent.object === node || t().isAwaitExpression(parent)) {
if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isUnaryLike(parent) || t.isMemberExpression(parent) && parent.object === node || t.isAwaitExpression(parent)) {
return true;
}
if (t().isBinary(parent)) {
if (t.isBinary(parent)) {
const parentOp = parent.operator;

@@ -124,3 +116,3 @@ const parentPos = PRECEDENCE[parentOp];

if (parentPos === nodePos && parent.right === node && !t().isLogicalExpression(parent) || parentPos > nodePos) {
if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent) || parentPos > nodePos) {
return true;

@@ -134,3 +126,3 @@ }

function UnionTypeAnnotation(node, parent) {
return t().isArrayTypeAnnotation(parent) || t().isNullableTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isUnionTypeAnnotation(parent);
return t.isArrayTypeAnnotation(parent) || t.isNullableTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isUnionTypeAnnotation(parent);
}

@@ -147,11 +139,11 @@

function TSUnionType(node, parent) {
return t().isTSArrayType(parent) || t().isTSOptionalType(parent) || t().isTSIntersectionType(parent) || t().isTSUnionType(parent) || t().isTSRestType(parent);
return t.isTSArrayType(parent) || t.isTSOptionalType(parent) || t.isTSIntersectionType(parent) || t.isTSUnionType(parent) || t.isTSRestType(parent);
}
function BinaryExpression(node, parent) {
return node.operator === "in" && (t().isVariableDeclarator(parent) || t().isFor(parent));
return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent));
}
function SequenceExpression(node, parent) {
if (t().isForStatement(parent) || t().isThrowStatement(parent) || t().isReturnStatement(parent) || t().isIfStatement(parent) && parent.test === node || t().isWhileStatement(parent) && parent.test === node || t().isForInStatement(parent) && parent.right === node || t().isSwitchStatement(parent) && parent.discriminant === node || t().isExpressionStatement(parent) && parent.expression === node) {
if (t.isForStatement(parent) || t.isThrowStatement(parent) || t.isReturnStatement(parent) || t.isIfStatement(parent) && parent.test === node || t.isWhileStatement(parent) && parent.test === node || t.isForInStatement(parent) && parent.right === node || t.isSwitchStatement(parent) && parent.discriminant === node || t.isExpressionStatement(parent) && parent.expression === node) {
return false;

@@ -164,3 +156,3 @@ }

function YieldExpression(node, parent) {
return t().isBinary(parent) || t().isUnaryLike(parent) || t().isCallExpression(parent) || t().isMemberExpression(parent) || t().isNewExpression(parent) || t().isAwaitExpression(parent) && t().isYieldExpression(node) || t().isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
return t.isBinary(parent) || t.isUnaryLike(parent) || t.isCallExpression(parent) || t.isMemberExpression(parent) || t.isNewExpression(parent) || t.isAwaitExpression(parent) && t.isYieldExpression(node) || t.isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
}

@@ -175,9 +167,9 @@

function UnaryLike(node, parent) {
return t().isMemberExpression(parent, {
return t.isMemberExpression(parent, {
object: node
}) || t().isCallExpression(parent, {
}) || t.isCallExpression(parent, {
callee: node
}) || t().isNewExpression(parent, {
}) || t.isNewExpression(parent, {
callee: node
}) || t().isBinaryExpression(parent, {
}) || t.isBinaryExpression(parent, {
operator: "**",

@@ -195,9 +187,9 @@ left: node

function ArrowFunctionExpression(node, parent) {
return t().isExportDeclaration(parent) || ConditionalExpression(node, parent);
return t.isExportDeclaration(parent) || ConditionalExpression(node, parent);
}
function ConditionalExpression(node, parent) {
if (t().isUnaryLike(parent) || t().isBinary(parent) || t().isConditionalExpression(parent, {
if (t.isUnaryLike(parent) || t.isBinary(parent) || t.isConditionalExpression(parent, {
test: node
}) || t().isAwaitExpression(parent) || t().isOptionalMemberExpression(parent) || t().isTaggedTemplateExpression(parent) || t().isTSTypeAssertion(parent) || t().isTSAsExpression(parent)) {
}) || t.isAwaitExpression(parent) || t.isOptionalMemberExpression(parent) || t.isTaggedTemplateExpression(parent) || t.isTSTypeAssertion(parent) || t.isTSAsExpression(parent)) {
return true;

@@ -210,7 +202,7 @@ }

function OptionalMemberExpression(node, parent) {
return t().isCallExpression(parent) || t().isMemberExpression(parent);
return t.isCallExpression(parent) || t.isMemberExpression(parent);
}
function AssignmentExpression(node) {
if (t().isObjectPattern(node.left)) {
if (t.isObjectPattern(node.left)) {
return true;

@@ -236,7 +228,7 @@ } else {

while (i > 0) {
if (t().isExpressionStatement(parent, {
if (t.isExpressionStatement(parent, {
expression: node
}) || t().isTaggedTemplateExpression(parent) || considerDefaultExports && t().isExportDefaultDeclaration(parent, {
}) || t.isTaggedTemplateExpression(parent) || considerDefaultExports && t.isExportDefaultDeclaration(parent, {
declaration: node
}) || considerArrow && t().isArrowFunctionExpression(parent, {
}) || considerArrow && t.isArrowFunctionExpression(parent, {
body: node

@@ -247,11 +239,11 @@ })) {

if (t().isCallExpression(parent, {
if (t.isCallExpression(parent, {
callee: node
}) || t().isSequenceExpression(parent) && parent.expressions[0] === node || t().isMemberExpression(parent, {
}) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isMemberExpression(parent, {
object: node
}) || t().isConditional(parent, {
}) || t.isConditional(parent, {
test: node
}) || t().isBinary(parent, {
}) || t.isBinary(parent, {
left: node
}) || t().isAssignmentExpression(parent, {
}) || t.isAssignmentExpression(parent, {
left: node

@@ -258,0 +250,0 @@ })) {

@@ -8,12 +8,4 @@ "use strict";

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -24,14 +16,14 @@

function crawl(node, state = {}) {
if (t().isMemberExpression(node)) {
if (t.isMemberExpression(node)) {
crawl(node.object, state);
if (node.computed) crawl(node.property, state);
} else if (t().isBinary(node) || t().isAssignmentExpression(node)) {
} else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
crawl(node.left, state);
crawl(node.right, state);
} else if (t().isCallExpression(node)) {
} else if (t.isCallExpression(node)) {
state.hasCall = true;
crawl(node.callee, state);
} else if (t().isFunction(node)) {
} else if (t.isFunction(node)) {
state.hasFunction = true;
} else if (t().isIdentifier(node)) {
} else if (t.isIdentifier(node)) {
state.hasHelper = state.hasHelper || isHelper(node.callee);

@@ -44,10 +36,10 @@ }

function isHelper(node) {
if (t().isMemberExpression(node)) {
if (t.isMemberExpression(node)) {
return isHelper(node.object) || isHelper(node.property);
} else if (t().isIdentifier(node)) {
} else if (t.isIdentifier(node)) {
return node.name === "require" || node.name[0] === "_";
} else if (t().isCallExpression(node)) {
} else if (t.isCallExpression(node)) {
return isHelper(node.callee);
} else if (t().isBinary(node) || t().isAssignmentExpression(node)) {
return t().isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
} else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
return t.isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
} else {

@@ -59,3 +51,3 @@ return false;

function isType(node) {
return t().isLiteral(node) || t().isObjectExpression(node) || t().isArrayExpression(node) || t().isIdentifier(node) || t().isMemberExpression(node);
return t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) || t.isIdentifier(node) || t.isMemberExpression(node);
}

@@ -83,3 +75,3 @@

LogicalExpression(node) {
if (t().isFunction(node.left) || t().isFunction(node.right)) {
if (t.isFunction(node.left) || t.isFunction(node.right)) {
return {

@@ -100,3 +92,3 @@ after: true

CallExpression(node) {
if (t().isFunction(node.callee) || isHelper(node)) {
if (t.isFunction(node.callee) || isHelper(node)) {
return {

@@ -129,3 +121,3 @@ before: true,

IfStatement(node) {
if (t().isBlockStatement(node.consequent)) {
if (t.isBlockStatement(node.consequent)) {
return {

@@ -196,3 +188,3 @@ before: true,

[type].concat(t().FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
[type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
nodes[type] = function () {

@@ -199,0 +191,0 @@ return amounts;

@@ -8,22 +8,6 @@ "use strict";

function _isInteger() {
const data = _interopRequireDefault(require("lodash/isInteger"));
var _isInteger = _interopRequireDefault(require("lodash/isInteger"));
_isInteger = function () {
return data;
};
var _repeat = _interopRequireDefault(require("lodash/repeat"));
return data;
}
function _repeat() {
const data = _interopRequireDefault(require("lodash/repeat"));
_repeat = function () {
return data;
};
return data;
}
var _buffer = _interopRequireDefault(require("./buffer"));

@@ -33,12 +17,4 @@

function t() {
const data = _interopRequireWildcard(require("@babel/types"));
var t = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
var generatorFunctions = _interopRequireWildcard(require("./generators"));

@@ -127,3 +103,3 @@

this.word(str);
this._endsWithInteger = (0, _isInteger().default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
this._endsWithInteger = (0, _isInteger.default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
}

@@ -247,3 +223,3 @@

_getIndent() {
return (0, _repeat().default)(this.format.indent.style, this._indent);
return (0, _repeat.default)(this.format.indent.style, this._indent);
}

@@ -303,3 +279,3 @@

const loc = t().isProgram(node) || t().isFile(node) ? null : node.loc;
const loc = t.isProgram(node) || t.isFile(node) ? null : node.loc;
this.withSource("start", loc, () => {

@@ -395,3 +371,3 @@ printMethod.call(this, node, parent);

if (!t().isEmptyStatement(node)) {
if (!t.isEmptyStatement(node)) {
this.space();

@@ -483,3 +459,3 @@ }

const indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn());
val = val.replace(/\n(?!$)/g, `\n${(0, _repeat().default)(" ", indentSize)}`);
val = val.replace(/\n(?!$)/g, `\n${(0, _repeat.default)(" ", indentSize)}`);
}

@@ -486,0 +462,0 @@

@@ -8,12 +8,4 @@ "use strict";

function _sourceMap() {
const data = _interopRequireDefault(require("source-map"));
var _sourceMap = _interopRequireDefault(require("source-map"));
_sourceMap = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -31,3 +23,3 @@

if (!this._cachedMap) {
const map = this._cachedMap = new (_sourceMap().default.SourceMapGenerator)({
const map = this._cachedMap = new _sourceMap.default.SourceMapGenerator({
sourceRoot: this._opts.sourceRoot

@@ -38,10 +30,10 @@ });

if (typeof code === "string") {
map.setSourceContent(this._opts.sourceFileName, code);
map.setSourceContent(this._opts.sourceFileName.replace(/\\/g, "/"), code);
} else if (typeof code === "object") {
Object.keys(code).forEach(sourceFileName => {
map.setSourceContent(sourceFileName, code[sourceFileName]);
map.setSourceContent(sourceFileName.replace(/\\/g, "/"), code[sourceFileName]);
});
}
this._rawMappings.forEach(map.addMapping, map);
this._rawMappings.forEach(mapping => map.addMapping(mapping), map);
}

@@ -74,3 +66,3 @@

},
source: line == null ? undefined : filename || this._opts.sourceFileName,
source: line == null ? undefined : (filename || this._opts.sourceFileName).replace(/\\/g, "/"),
original: line == null ? undefined : {

@@ -77,0 +69,0 @@ line: line,

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

@@ -17,12 +17,12 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"dependencies": {
"@babel/types": "^7.6.0",
"@babel/types": "^7.6.3",
"jsesc": "^2.5.1",
"lodash": "^4.17.13",
"source-map": "^0.5.0"
"source-map": "^0.6.1"
},
"devDependencies": {
"@babel/helper-fixtures": "^7.6.2",
"@babel/parser": "^7.6.2"
"@babel/helper-fixtures": "^7.6.3",
"@babel/parser": "^7.6.3"
},
"gitHead": "b9cb4af953afb1a5aeed9b18526192ab15bb45c1"
"gitHead": "d329156ebc17da01382acb83e212cb4328534ebc"
}
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