babel-plugin-jsx-dom-expressions 0.35.6 → 0.35.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +6 -1
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1842,7 +1842,12 @@ function escapeExpression(path, expression, attr) {
1842
1842
  if (t__namespace.isStringLiteral(expression) || t__namespace.isNumericLiteral(expression)) {
1843
1843
  return expression;
1844
1844
  } else if (t__namespace.isFunction(expression)) {
1845
- expression.body = escapeExpression(path, expression.body, attr);
1845
+ if (t__namespace.isBlockStatement(expression.body)) {
1846
+ expression.body.body = expression.body.body.map(e => {
1847
+ if (t__namespace.isReturnStatement(e)) e.argument = escapeExpression(path, e.argument, attr);
1848
+ return e;
1849
+ });
1850
+ } else expression.body = escapeExpression(path, expression.body, attr);
1846
1851
  return expression;
1847
1852
  } else if (t__namespace.isTemplateLiteral(expression)) {
1848
1853
  expression.expressions = expression.expressions.map(e => escapeExpression(path, e, attr));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "babel-plugin-jsx-dom-expressions",
3
3
  "description": "A JSX to DOM plugin that wraps expressions for fine grained change detection",
4
- "version": "0.35.6",
4
+ "version": "0.35.8",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "peerDependencies": {
28
28
  "@babel/core": "^7.0.0"
29
29
  },
30
- "gitHead": "0525efe1ea9d3e43336dea787de0b84e6d42ed72"
30
+ "gitHead": "17ea89fb40b4c65633bd7916f063be9751b25602"
31
31
  }