babel-plugin-jsx-dom-expressions 0.30.3 → 0.30.5

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 +13 -2
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -813,6 +813,16 @@ function transformAttributes$2(path, results) {
813
813
  : node.name.name,
814
814
  reservedNameSpace =
815
815
  t__namespace.isJSXNamespacedName(node.name) && reservedNameSpaces.has(node.name.namespace.name);
816
+ if (t__namespace.isJSXExpressionContainer(value)) {
817
+ const evaluated = attribute.get("value").get("expression").evaluate().value;
818
+ let type;
819
+ if (
820
+ evaluated !== undefined &&
821
+ ((type = typeof evaluated) === "string" || type === "number")
822
+ ) {
823
+ value = t__namespace.stringLiteral(String(evaluated));
824
+ }
825
+ }
816
826
  if (
817
827
  t__namespace.isJSXNamespacedName(node.name) &&
818
828
  reservedNameSpace &&
@@ -2199,6 +2209,7 @@ function transformComponent(path) {
2199
2209
  tagName = getTagName(path.node),
2200
2210
  props = [],
2201
2211
  runningObject = [],
2212
+ dynamicSpread = false,
2202
2213
  hasChildren = path.node.children.length > 0;
2203
2214
 
2204
2215
  if (config.builtIns.indexOf(tagName) > -1 && !path.scope.hasBinding(tagName)) {
@@ -2219,7 +2230,7 @@ function transformComponent(path) {
2219
2230
  props.push(
2220
2231
  isDynamic(attribute.get("argument"), {
2221
2232
  checkMember: true
2222
- })
2233
+ }) && (dynamicSpread = true)
2223
2234
  ? t__namespace.isCallExpression(node.argument) && !node.argument.arguments.length
2224
2235
  ? node.argument.callee
2225
2236
  : t__namespace.arrowFunctionExpression([], node.argument)
@@ -2350,7 +2361,7 @@ function transformComponent(path) {
2350
2361
  }
2351
2362
  if (runningObject.length || !props.length) props.push(t__namespace.objectExpression(runningObject));
2352
2363
 
2353
- if (props.length > 1) {
2364
+ if (props.length > 1 || dynamicSpread) {
2354
2365
  registerImportMethod(path, "mergeProps");
2355
2366
  props = [t__namespace.callExpression(t__namespace.identifier("_$mergeProps"), props)];
2356
2367
  }
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.30.3",
4
+ "version": "0.30.5",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,5 +23,5 @@
23
23
  "@babel/types": "^7.11.5",
24
24
  "html-entities": "2.3.2"
25
25
  },
26
- "gitHead": "4eb94a2d860cb1b1fa09cce9b47c52e72f2e6648"
26
+ "gitHead": "a8b08272aaaffe70374ad9bd2703f4b730b34706"
27
27
  }