babel-plugin-jsx-dom-expressions 0.35.4 → 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 +7 -2
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -383,7 +383,7 @@ function checkLength(children) {
383
383
  children.forEach(path => {
384
384
  const child = path.node;
385
385
  !(t__namespace.isJSXExpressionContainer(child) && t__namespace.isJSXEmptyExpression(child.expression)) &&
386
- (!t__namespace.isJSXText(child) || !/^\s*$/.test(child.extra.raw)) &&
386
+ (!t__namespace.isJSXText(child) || !/^\s*$/.test(child.extra.raw) || /^ *$/.test(child.extra.raw)) &&
387
387
  i++;
388
388
  });
389
389
  return i > 1;
@@ -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.4",
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": "dcc322b7f4bf7d651196b99504b2d17bb80f1973"
30
+ "gitHead": "17ea89fb40b4c65633bd7916f063be9751b25602"
31
31
  }