babel-plugin-debug-tools
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -113,20 +113,39 @@ "use strict"; | ||
const cname = t.stringLiteral((0, _generator.default)(cclone).code); | ||
const aexpr = t.arrayExpression([cname, cclone]); | ||
prev.push(aexpr); | ||
if (t.isBinaryExpression(cclone)) { | ||
const leftId = path.scope.generateUidIdentifier('left'); | ||
const cnameleft = t.stringLiteral((0, _generator.default)(cclone.left).code); | ||
const cnameright = t.stringLiteral((0, _generator.default)(cclone.right).code); | ||
const isLiteralleft = t.isLiteral(cclone.left); | ||
const isLiteralright = t.isLiteral(cclone.right); | ||
path.scope.push({ | ||
id: leftId | ||
}); | ||
const rightId = path.scope.generateUidIdentifier('right'); | ||
path.scope.push({ | ||
id: rightId | ||
}); | ||
path.insertBefore(t.expressionStatement(t.assignmentExpression('=', leftId, t.clone(cclone.left)))); | ||
path.insertBefore(t.expressionStatement(t.assignmentExpression('=', rightId, t.clone(cclone.right)))); | ||
cclone.left = leftId; | ||
cclone.right = rightId; | ||
const aexpr = t.arrayExpression([cname, cclone]); | ||
prev.push(aexpr); | ||
const binExpr = t.objectExpression([]); | ||
const left = t.clone(cclone.left); | ||
const cnameleft = t.stringLiteral((0, _generator.default)(left).code); | ||
if (!t.isLiteral(left)) binExpr.properties.push(t.objectProperty(cnameleft, left)); | ||
if (!isLiteralleft) binExpr.properties.push(t.objectProperty(cnameleft, left)); | ||
const right = t.clone(cclone.right); | ||
const cnameright = t.stringLiteral((0, _generator.default)(right).code); | ||
if (!t.isLiteral(right)) binExpr.properties.push(t.objectProperty(cnameright, right)); | ||
if (!isLiteralright) binExpr.properties.push(t.objectProperty(cnameright, right)); | ||
aexpr.elements.push(binExpr); | ||
} else if (t.isUnaryExpression(cclone)) { | ||
const arg = t.clone(cclone.argument); | ||
const argId = path.scope.generateUidIdentifier('arg'); | ||
const cnameArg = t.stringLiteral((0, _generator.default)(cclone.argument).code); | ||
const isLiteralArg = t.isLiteral(cclone.argument); | ||
path.insertBefore(t.expressionStatement(t.assignmentExpression('=', argId, t.clone(cclone.argument)))); | ||
cclone.argument = argId; | ||
const aexpr = t.arrayExpression([cname, cclone]); | ||
prev.push(aexpr); | ||
if (!t.isLiteral(arg)) { | ||
const cnamearg = t.stringLiteral((0, _generator.default)(arg).code); | ||
aexpr.elements.push(t.objectExpression([t.objectProperty(cnamearg, arg)])); | ||
if (!isLiteralArg) { | ||
aexpr.elements.push(t.objectExpression([t.objectProperty(cnameArg, argId)])); | ||
} | ||
@@ -133,0 +152,0 @@ } else throw path.buildCodeFrameError("unsupported expression"); |
{ | ||
"name": "babel-plugin-debug-tools", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "Helpers for debug Javascript Applications", | ||
@@ -19,2 +19,3 @@ "repository": { | ||
"test": "jest", | ||
"dev": "jest --watchAll", | ||
"ci": "jest", | ||
@@ -21,0 +22,0 @@ "syntax-check": "npx tsc -p ./tsconfig.json" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47817
154