babel-plugin-jsx-dom-expressions 0.36.10 → 0.36.18

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 +34 -12
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -3138,22 +3138,44 @@ function transformComponent(path) {
3138
3138
  checkTags: true
3139
3139
  })
3140
3140
  ) {
3141
- let expr =
3141
+ if (
3142
3142
  config.wrapConditionals &&
3143
3143
  config.generate !== "ssr" &&
3144
3144
  (t__namespace.isLogicalExpression(value.expression) ||
3145
3145
  t__namespace.isConditionalExpression(value.expression))
3146
- ? transformCondition(attribute.get("value").get("expression"), true)
3147
- : t__namespace.arrowFunctionExpression([], value.expression);
3148
- runningObject.push(
3149
- t__namespace.objectMethod(
3150
- "get",
3151
- id,
3152
- [],
3153
- t__namespace.blockStatement([t__namespace.returnStatement(expr.body)]),
3154
- !t__namespace.isValidIdentifier(key)
3155
- )
3156
- );
3146
+ ) {
3147
+ const expr = transformCondition(attribute.get("value").get("expression"), true);
3148
+
3149
+ runningObject.push(
3150
+ t__namespace.objectMethod(
3151
+ "get",
3152
+ id,
3153
+ [],
3154
+ t__namespace.blockStatement([t__namespace.returnStatement(expr.body)]),
3155
+ !t__namespace.isValidIdentifier(key)
3156
+ )
3157
+ );
3158
+ } else if (
3159
+ t__namespace.isCallExpression(value.expression) &&
3160
+ t__namespace.isArrowFunctionExpression(value.expression.callee)
3161
+ ) {
3162
+ const callee = value.expression.callee;
3163
+ const body = t__namespace.isBlockStatement(callee.body)
3164
+ ? callee.body
3165
+ : t__namespace.blockStatement([t__namespace.returnStatement(callee.body)]);
3166
+
3167
+ runningObject.push(t__namespace.objectMethod("get", id, [], body, !t__namespace.isValidIdentifier(key)));
3168
+ } else {
3169
+ runningObject.push(
3170
+ t__namespace.objectMethod(
3171
+ "get",
3172
+ id,
3173
+ [],
3174
+ t__namespace.blockStatement([t__namespace.returnStatement(value.expression)]),
3175
+ !t__namespace.isValidIdentifier(key)
3176
+ )
3177
+ );
3178
+ }
3157
3179
  } else runningObject.push(t__namespace.objectProperty(id, value.expression));
3158
3180
  else runningObject.push(t__namespace.objectProperty(id, value));
3159
3181
  }
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.36.10",
4
+ "version": "0.36.18",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -31,5 +31,5 @@
31
31
  "devDependencies": {
32
32
  "@babel/core": "^7.20.12"
33
33
  },
34
- "gitHead": "1d04cc14bbde62e06d852eac9e85252359c6b304"
34
+ "gitHead": "70ab5bf1b167c0a3cefd0a3582c0b97f502bb92b"
35
35
  }