babel-plugin-jsx-dom-expressions 0.40.5 → 0.40.6

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 +8 -5
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -2662,11 +2662,12 @@ function escapeExpression(path, expression, attr, escapeLiterals) {
2662
2662
  expression.alternate = escapeExpression(path, expression.alternate, attr, escapeLiterals);
2663
2663
  return expression;
2664
2664
  } else if (t__namespace.isLogicalExpression(expression)) {
2665
- expression.right = escapeExpression(path, expression.right, attr, escapeLiterals);
2666
- if (expression.operator !== "&&") {
2667
- expression.left = escapeExpression(path, expression.left, attr, escapeLiterals);
2665
+ // Preserve the old short-circuit shape for && while still escaping the
2666
+ // selected result of || and ?? as a whole.
2667
+ if (expression.operator === "&&") {
2668
+ expression.right = escapeExpression(path, expression.right, attr, escapeLiterals);
2669
+ return expression;
2668
2670
  }
2669
- return expression;
2670
2671
  } else if (t__namespace.isCallExpression(expression) && t__namespace.isFunction(expression.callee)) {
2671
2672
  if (t__namespace.isBlockStatement(expression.callee.body)) {
2672
2673
  expression.callee.body.body = expression.callee.body.body.map((e) => {
@@ -2822,8 +2823,10 @@ function transformAttributes$1(path, results, info) {
2822
2823
  children = value;
2823
2824
  } else {
2824
2825
  let doEscape = true;
2826
+
2825
2827
  if (key.startsWith("attr:")) key = key.replace("attr:", "");
2826
- if (BooleanAttributes.has(key)) {
2828
+ if (BooleanAttributes.has(key) || key.startsWith("bool:")) {
2829
+ key = key.replace("bool:", "");
2827
2830
  results.template.push("");
2828
2831
  const fn = t__namespace.callExpression(registerImportMethod(attribute, "ssrAttribute"), [
2829
2832
  t__namespace.stringLiteral(key),
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.40.5",
4
+ "version": "0.40.6",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -33,5 +33,5 @@
33
33
  "@rollup/plugin-babel": "6.0.3",
34
34
  "@types/babel__core": "^7.20.5"
35
35
  },
36
- "gitHead": "d90e7885930e6bff605a1c50260577fda6506c23"
36
+ "gitHead": "4f1ff795b280004134c0c3e16dec1dc0c9148141"
37
37
  }