babel-plugin-vtex-render-route
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -71,7 +71,43 @@ 'use strict'; | ||
if (isCalleeRoute) { | ||
path.parentPath.replaceWith(parentArguments[0]); | ||
var _parentArguments = _slicedToArray(parentArguments, 1); | ||
var parentArgument = _parentArguments[0]; | ||
var declaration = void 0; | ||
switch (parentArgument.type) { | ||
case 'FunctionExpression': | ||
{ | ||
var id = parentArgument.id; | ||
var params = parentArgument.params; | ||
var body = parentArgument.body; | ||
declaration = t.functionDeclaration(id, params, body); | ||
break; | ||
} | ||
case 'ClassExpression': | ||
{ | ||
var _id = parentArgument.id; | ||
var superClass = parentArgument.superClass; | ||
var _body = parentArgument.body; | ||
declaration = t.classDeclaration(_id, superClass, _body, []); | ||
break; | ||
} | ||
case 'Identifier': | ||
{ | ||
declaration = parentArgument; | ||
break; | ||
} | ||
} | ||
path.parentPath.parentPath.remove(); | ||
state.file.path.container.program.body.push(t.exportDefaultDeclaration(declaration)); | ||
} else { | ||
path.remove(); | ||
} | ||
} else { | ||
path.remove(); | ||
} | ||
path.remove(); | ||
state.file.metadata.vtexRender = { | ||
@@ -78,0 +114,0 @@ route: { |
{ | ||
"name": "babel-plugin-vtex-render-route", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A babel plugin for extracting VTEX Render route information from a component", | ||
@@ -10,4 +10,5 @@ "main": "lib/index.js", | ||
"lint": "eslint src", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"prerelease": "rimraf lib && npm run lint && npm run build" | ||
"test": "ava test/index.js --verbose", | ||
"prerelease": "rimraf lib && npm run build && npm run lint && npm test", | ||
"release": "npm publish" | ||
}, | ||
@@ -39,2 +40,3 @@ "repository": { | ||
"devDependencies": { | ||
"ava": "^0.15.2", | ||
"babel-cli": "^6.10.1", | ||
@@ -44,2 +46,3 @@ "babel-core": "^6.10.4", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-react": "^6.11.1", | ||
"eslint": "^2.13.1", | ||
@@ -46,0 +49,0 @@ "eslint-config-vtex": "^4.0.0", |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
11243
152
1
9