babel-plugin-debug-tools
Advanced tools
Comparing version 1.0.19 to 1.0.20
@@ -73,3 +73,3 @@ "use strict"; | ||
})) { | ||
transpileOthers(); | ||
transpileCloning(); | ||
} else if (property.isIdentifier({ | ||
@@ -82,3 +82,15 @@ name: 'TRACE' | ||
path.get('expression').replaceWith(t.callExpression(t.clone(arg0), [])); | ||
} else throw path.buildCodeFrameError("Invalid command"); | ||
} else { | ||
const method = property.node; | ||
let isCustom = false; | ||
if (t.isIdentifier(method)) { | ||
if (/^[a-z]\w+$/.test(method.name)) { | ||
isCustom = true; | ||
transpileCustom(); | ||
} | ||
} | ||
if (!isCustom) throw path.buildCodeFrameError("Invalid command"); | ||
} | ||
} | ||
@@ -161,6 +173,13 @@ } | ||
function transpileOthers() { | ||
function transpileCloning() { | ||
path.get('expression').replaceWith(t.clone(expr.node)); | ||
} | ||
function transpileCustom() { | ||
const codes = t.arrayExpression(expr.node.arguments.map(arg => t.stringLiteral((0, _generator.default)(t.clone(arg)).code))); | ||
const values = t.arrayExpression(expr.node.arguments.map(arg => t.clone(arg))); | ||
const nexpr = t.callExpression(t.clone(callee.node), [calleeLoc(), codes, values]); | ||
path.get('expression').replaceWith(nexpr); | ||
} | ||
function calleeLoc() { | ||
@@ -167,0 +186,0 @@ const loc = callee.node.loc; |
{ | ||
"name": "babel-plugin-debug-tools", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"description": "Helpers for debug Javascript Applications", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
48866
170