babel-plugin-jsx-dom-expressions 0.37.9 → 0.37.13

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 +138 -94
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -531,7 +531,7 @@ function transformCondition(path, inline, deep) {
531
531
  }
532
532
  if (dTest && !inline) {
533
533
  const statements = [
534
- t__namespace.variableDeclaration("const", [
534
+ t__namespace.variableDeclaration("var", [
535
535
  t__namespace.variableDeclarator(
536
536
  id,
537
537
  config.memoWrapper
@@ -630,6 +630,22 @@ function canNativeSpread(key, { checkNameSpaces } = {}) {
630
630
  return true;
631
631
  }
632
632
 
633
+ const chars = "etaoinshrdlucwmfygpbTAOISWCBvkxjqzPHFMDRELNGUKVYJQZX_$";
634
+ const base = chars.length;
635
+
636
+ function getNumberedId(num) {
637
+ let out = "";
638
+
639
+ do {
640
+ const digit = num % base;
641
+
642
+ num = Math.floor(num / base);
643
+ out = chars[digit] + out;
644
+ } while (num !== 0);
645
+
646
+ return out;
647
+ }
648
+
633
649
  const InlineElements = [
634
650
  "a",
635
651
  "abbr",
@@ -761,7 +777,8 @@ function transformElement$3(path, info) {
761
777
  isSVG: wrapSVG,
762
778
  hasCustomElement: isCustomElement,
763
779
  tagName,
764
- renderer: "dom"
780
+ renderer: "dom",
781
+ skipTemplate: false
765
782
  };
766
783
  if (config.hydratable && (tagName === "html" || tagName === "head" || tagName === "body")) {
767
784
  results.skipTemplate = true;
@@ -1002,12 +1019,12 @@ function transformAttributes$2(path, results) {
1002
1019
  .node.attributes.splice(
1003
1020
  styleAttribute.key + ++i,
1004
1021
  0,
1005
- t__namespace.JSXAttribute(
1006
- t__namespace.JSXNamespacedName(
1007
- t__namespace.JSXIdentifier("style"),
1008
- t__namespace.JSXIdentifier(t__namespace.isIdentifier(p.key) ? p.key.name : p.key.value)
1022
+ t__namespace.jsxAttribute(
1023
+ t__namespace.jsxNamespacedName(
1024
+ t__namespace.jsxIdentifier("style"),
1025
+ t__namespace.jsxIdentifier(t__namespace.isIdentifier(p.key) ? p.key.name : p.key.value)
1009
1026
  ),
1010
- t__namespace.JSXExpressionContainer(p.value)
1027
+ t__namespace.jsxExpressionContainer(p.value)
1011
1028
  )
1012
1029
  );
1013
1030
  styleAttribute.node.value.expression.properties.splice(index - i - 1, 1);
@@ -1046,12 +1063,12 @@ function transformAttributes$2(path, results) {
1046
1063
  .node.attributes.splice(
1047
1064
  classListAttribute.key + ++i,
1048
1065
  0,
1049
- t__namespace.JSXAttribute(
1050
- t__namespace.JSXNamespacedName(
1051
- t__namespace.JSXIdentifier("class"),
1052
- t__namespace.JSXIdentifier(t__namespace.isIdentifier(p.key) ? p.key.name : p.key.value)
1066
+ t__namespace.jsxAttribute(
1067
+ t__namespace.jsxNamespacedName(
1068
+ t__namespace.jsxIdentifier("class"),
1069
+ t__namespace.jsxIdentifier(t__namespace.isIdentifier(p.key) ? p.key.name : p.key.value)
1053
1070
  ),
1054
- t__namespace.JSXExpressionContainer(p.value)
1071
+ t__namespace.jsxExpressionContainer(p.value)
1055
1072
  )
1056
1073
  );
1057
1074
  } else if (computed) {
@@ -1060,8 +1077,8 @@ function transformAttributes$2(path, results) {
1060
1077
  .node.attributes.splice(
1061
1078
  classListAttribute.key + ++i,
1062
1079
  0,
1063
- t__namespace.JSXAttribute(
1064
- t__namespace.JSXIdentifier("class"),
1080
+ t__namespace.jsxAttribute(
1081
+ t__namespace.jsxIdentifier("class"),
1065
1082
  t__namespace.stringLiteral(t__namespace.isIdentifier(p.key) ? p.key.name : p.key.value)
1066
1083
  )
1067
1084
  );
@@ -1080,24 +1097,24 @@ function transformAttributes$2(path, results) {
1080
1097
  if (classAttributes.length > 1) {
1081
1098
  const first = classAttributes[0].node,
1082
1099
  values = [],
1083
- quasis = [t__namespace.TemplateElement({ raw: "" })];
1100
+ quasis = [t__namespace.templateElement({ raw: "" })];
1084
1101
  for (let i = 0; i < classAttributes.length; i++) {
1085
1102
  const attr = classAttributes[i].node,
1086
1103
  isLast = i === classAttributes.length - 1;
1087
1104
  if (!t__namespace.isJSXExpressionContainer(attr.value)) {
1088
1105
  const prev = quasis.pop();
1089
1106
  quasis.push(
1090
- t__namespace.TemplateElement({
1107
+ t__namespace.templateElement({
1091
1108
  raw: (prev ? prev.value.raw : "") + `${attr.value.value}` + (isLast ? "" : " ")
1092
1109
  })
1093
1110
  );
1094
1111
  } else {
1095
1112
  values.push(t__namespace.logicalExpression("||", attr.value.expression, t__namespace.stringLiteral("")));
1096
- quasis.push(t__namespace.TemplateElement({ raw: isLast ? "" : " " }));
1113
+ quasis.push(t__namespace.templateElement({ raw: isLast ? "" : " " }));
1097
1114
  }
1098
1115
  i && attributes.splice(attributes.indexOf(classAttributes[i]), 1);
1099
1116
  }
1100
- if (values.length) first.value = t__namespace.JSXExpressionContainer(t__namespace.TemplateLiteral(quasis, values));
1117
+ if (values.length) first.value = t__namespace.jsxExpressionContainer(t__namespace.templateLiteral(quasis, values));
1101
1118
  else first.value = t__namespace.stringLiteral(quasis[0].value.raw);
1102
1119
  }
1103
1120
  path.get("openingElement").set(
@@ -1133,7 +1150,7 @@ function transformAttributes$2(path, results) {
1133
1150
  reservedNameSpace &&
1134
1151
  !t__namespace.isJSXExpressionContainer(value)
1135
1152
  ) {
1136
- node.value = value = t__namespace.JSXExpressionContainer(value || t__namespace.JSXEmptyExpression());
1153
+ node.value = value = t__namespace.jsxExpressionContainer(value || t__namespace.jsxEmptyExpression());
1137
1154
  }
1138
1155
  if (
1139
1156
  t__namespace.isJSXExpressionContainer(value) &&
@@ -1156,7 +1173,7 @@ function transformAttributes$2(path, results) {
1156
1173
  if (!isFunction && t__namespace.isLVal(value.expression)) {
1157
1174
  const refIdentifier = path.scope.generateUidIdentifier("_ref$");
1158
1175
  results.exprs.unshift(
1159
- t__namespace.variableDeclaration("const", [
1176
+ t__namespace.variableDeclaration("var", [
1160
1177
  t__namespace.variableDeclarator(refIdentifier, value.expression)
1161
1178
  ]),
1162
1179
  t__namespace.expressionStatement(
@@ -1186,7 +1203,7 @@ function transformAttributes$2(path, results) {
1186
1203
  } else if (t__namespace.isCallExpression(value.expression)) {
1187
1204
  const refIdentifier = path.scope.generateUidIdentifier("_ref$");
1188
1205
  results.exprs.unshift(
1189
- t__namespace.variableDeclaration("const", [
1206
+ t__namespace.variableDeclaration("var", [
1190
1207
  t__namespace.variableDeclarator(refIdentifier, value.expression)
1191
1208
  ]),
1192
1209
  t__namespace.expressionStatement(
@@ -1370,7 +1387,7 @@ function transformAttributes$2(path, results) {
1370
1387
  }
1371
1388
  if (key === "textContent") {
1372
1389
  nextElem = attribute.scope.generateUidIdentifier("el$");
1373
- children = t__namespace.JSXText(" ");
1390
+ children = t__namespace.jsxText(" ");
1374
1391
  children.extra = { raw: " ", rawValue: " " };
1375
1392
  results.declarations.push(
1376
1393
  t__namespace.variableDeclarator(nextElem, t__namespace.memberExpression(elem, t__namespace.identifier("firstChild")))
@@ -1846,7 +1863,7 @@ function appendTemplates$1(path, templates) {
1846
1863
  )
1847
1864
  );
1848
1865
  });
1849
- path.node.body.unshift(t__namespace.variableDeclaration("const", declarators));
1866
+ path.node.body.unshift(t__namespace.variableDeclaration("var", declarators));
1850
1867
  }
1851
1868
 
1852
1869
  function registerTemplate(path, results) {
@@ -1882,7 +1899,7 @@ function registerTemplate(path, results) {
1882
1899
  );
1883
1900
  }
1884
1901
  results.declarations.unshift(decl);
1885
- results.decl = t__namespace.variableDeclaration("const", results.declarations);
1902
+ results.decl = t__namespace.variableDeclaration("var", results.declarations);
1886
1903
  }
1887
1904
 
1888
1905
  function wrapDynamics$1(path, dynamics) {
@@ -1919,50 +1936,65 @@ function wrapDynamics$1(path, dynamics) {
1919
1936
  ])
1920
1937
  );
1921
1938
  }
1922
- const declarations = [],
1923
- statements = [],
1924
- identifiers = [],
1925
- prevId = t__namespace.identifier("_p$");
1926
- dynamics.forEach(({ elem, key, value, isSVG, isCE, tagName }) => {
1927
- const identifier = path.scope.generateUidIdentifier("v$");
1928
- if (key.startsWith("class:") && !t__namespace.isBooleanLiteral(value) && !t__namespace.isUnaryExpression(value)) {
1939
+
1940
+ const prevId = t__namespace.identifier("_p$");
1941
+
1942
+ /** @type {t.VariableDeclarator[]} */
1943
+ const declarations = [];
1944
+ /** @type {t.ExpressionStatement[]} */
1945
+ const statements = [];
1946
+ /** @type {t.Identifier[]} */
1947
+ const properties = [];
1948
+
1949
+ dynamics.forEach(({ elem, key, value, isSVG, isCE, tagName }, index) => {
1950
+ const varIdent = path.scope.generateUidIdentifier("v$");
1951
+
1952
+ const propIdent = t__namespace.identifier(getNumberedId(index));
1953
+ const propMember = t__namespace.memberExpression(prevId, propIdent);
1954
+
1955
+ if (
1956
+ key.startsWith("class:") &&
1957
+ !t__namespace.isBooleanLiteral(value) &&
1958
+ !t__namespace.isUnaryExpression(value)
1959
+ ) {
1929
1960
  value = t__namespace.unaryExpression("!", t__namespace.unaryExpression("!", value));
1930
1961
  }
1931
- identifiers.push(identifier);
1932
- declarations.push(t__namespace.variableDeclarator(identifier, value));
1962
+
1963
+ properties.push(propIdent);
1964
+ declarations.push(t__namespace.variableDeclarator(varIdent, value));
1965
+
1933
1966
  if (key === "classList" || key === "style") {
1934
- const prev = t__namespace.memberExpression(prevId, identifier);
1935
1967
  statements.push(
1936
1968
  t__namespace.expressionStatement(
1937
1969
  t__namespace.assignmentExpression(
1938
1970
  "=",
1939
- prev,
1940
- setAttr$2(path, elem, key, identifier, {
1971
+ propMember,
1972
+ setAttr$2(path, elem, key, varIdent, {
1941
1973
  isSVG,
1942
1974
  isCE,
1943
1975
  tagName,
1944
1976
  dynamic: true,
1945
- prevId: prev
1946
- })
1947
- )
1948
- )
1977
+ prevId: propMember,
1978
+ }),
1979
+ ),
1980
+ ),
1949
1981
  );
1950
1982
  } else {
1951
- const prev = key.startsWith("style:") ? identifier : undefined;
1983
+ const prev = key.startsWith("style:") ? varIdent : undefined;
1952
1984
  statements.push(
1953
1985
  t__namespace.expressionStatement(
1954
1986
  t__namespace.logicalExpression(
1955
1987
  "&&",
1956
- t__namespace.binaryExpression("!==", identifier, t__namespace.memberExpression(prevId, identifier)),
1988
+ t__namespace.binaryExpression("!==", varIdent, propMember),
1957
1989
  setAttr$2(
1958
1990
  path,
1959
1991
  elem,
1960
1992
  key,
1961
- t__namespace.assignmentExpression("=", t__namespace.memberExpression(prevId, identifier), identifier),
1962
- { isSVG, isCE, tagName, dynamic: true, prevId: prev }
1963
- )
1964
- )
1965
- )
1993
+ t__namespace.assignmentExpression("=", propMember, varIdent),
1994
+ { isSVG, isCE, tagName, dynamic: true, prevId: prev },
1995
+ ),
1996
+ ),
1997
+ ),
1966
1998
  );
1967
1999
  }
1968
2000
  });
@@ -1972,13 +2004,15 @@ function wrapDynamics$1(path, dynamics) {
1972
2004
  t__namespace.arrowFunctionExpression(
1973
2005
  [prevId],
1974
2006
  t__namespace.blockStatement([
1975
- t__namespace.variableDeclaration("const", declarations),
2007
+ t__namespace.variableDeclaration("var", declarations),
1976
2008
  ...statements,
1977
- t__namespace.returnStatement(prevId)
1978
- ])
2009
+ t__namespace.returnStatement(prevId),
2010
+ ]),
1979
2011
  ),
1980
- t__namespace.objectExpression(identifiers.map(id => t__namespace.objectProperty(id, t__namespace.identifier("undefined"))))
1981
- ])
2012
+ t__namespace.objectExpression(
2013
+ properties.map((id) => t__namespace.objectProperty(id, t__namespace.identifier("undefined"))),
2014
+ ),
2015
+ ]),
1982
2016
  );
1983
2017
  }
1984
2018
 
@@ -2050,7 +2084,7 @@ function appendTemplates(path, templates) {
2050
2084
  const declarators = templates.map(template => {
2051
2085
  return t__namespace.variableDeclarator(template.id, template.template);
2052
2086
  });
2053
- path.node.body.unshift(t__namespace.variableDeclaration("const", declarators));
2087
+ path.node.body.unshift(t__namespace.variableDeclaration("var", declarators));
2054
2088
  }
2055
2089
 
2056
2090
  function appendToTemplate(template, value) {
@@ -2261,17 +2295,16 @@ function normalizeAttributes(path) {
2261
2295
  if (classAttributes.length > 1) {
2262
2296
  const first = classAttributes[0].node,
2263
2297
  values = [],
2264
- quasis = [t__namespace.TemplateElement({ raw: "" })];
2298
+ quasis = [t__namespace.templateElement({ raw: "" })];
2265
2299
  for (let i = 0; i < classAttributes.length; i++) {
2266
2300
  const attr = classAttributes[i].node,
2267
2301
  isLast = i === classAttributes.length - 1;
2268
2302
  if (!t__namespace.isJSXExpressionContainer(attr.value)) {
2269
2303
  const prev = quasis.pop();
2270
2304
  quasis.push(
2271
- t__namespace.TemplateElement({
2305
+ t__namespace.templateElement({
2272
2306
  raw:
2273
2307
  (prev ? prev.value.raw : "") +
2274
- (i ? " " : "") +
2275
2308
  `${attr.value.value}` +
2276
2309
  (isLast ? "" : " ")
2277
2310
  })
@@ -2281,18 +2314,19 @@ function normalizeAttributes(path) {
2281
2314
  if (attr.name.name === "classList") {
2282
2315
  if (t__namespace.isObjectExpression(expr) && !expr.properties.some(p => t__namespace.isSpreadElement(p))) {
2283
2316
  transformClasslistObject(path, expr, values, quasis);
2317
+ if (!isLast) quasis[quasis.length - 1].value.raw += " ";
2284
2318
  i && attributes.splice(attributes.indexOf(classAttributes[i]), 1);
2285
2319
  continue;
2286
2320
  }
2287
2321
  expr = t__namespace.callExpression(registerImportMethod(path, "ssrClassList"), [expr]);
2288
2322
  }
2289
2323
  values.push(t__namespace.logicalExpression("||", expr, t__namespace.stringLiteral("")));
2290
- quasis.push(t__namespace.TemplateElement({ raw: isLast ? "" : " " }));
2324
+ quasis.push(t__namespace.templateElement({ raw: isLast ? "" : " " }));
2291
2325
  }
2292
2326
  i && attributes.splice(attributes.indexOf(classAttributes[i]), 1);
2293
2327
  }
2294
- first.name = t__namespace.JSXIdentifier("class");
2295
- first.value = t__namespace.JSXExpressionContainer(t__namespace.TemplateLiteral(quasis, values));
2328
+ first.name = t__namespace.jsxIdentifier("class");
2329
+ first.value = t__namespace.jsxExpressionContainer(t__namespace.templateLiteral(quasis, values));
2296
2330
  }
2297
2331
  if (styleAttributes.length) transformToObject("style", attributes, styleAttributes);
2298
2332
  return attributes;
@@ -2318,7 +2352,7 @@ function transformAttributes$1(path, results, info) {
2318
2352
  ((t__namespace.isJSXNamespacedName(node.name) && reservedNameSpace) || ChildProperties.has(key)) &&
2319
2353
  !t__namespace.isJSXExpressionContainer(value)
2320
2354
  ) {
2321
- node.value = value = t__namespace.JSXExpressionContainer(value || t__namespace.JSXEmptyExpression());
2355
+ node.value = value = t__namespace.jsxExpressionContainer(value || t__namespace.jsxEmptyExpression());
2322
2356
  }
2323
2357
 
2324
2358
  if (
@@ -2385,7 +2419,7 @@ function transformAttributes$1(path, results, info) {
2385
2419
  !value.expression.properties.some(p => t__namespace.isSpreadElement(p))
2386
2420
  ) {
2387
2421
  const values = [],
2388
- quasis = [t__namespace.TemplateElement({ raw: "" })];
2422
+ quasis = [t__namespace.templateElement({ raw: "" })];
2389
2423
  transformClasslistObject(path, value.expression, values, quasis);
2390
2424
  if (!values.length) value.expression = t__namespace.stringLiteral(quasis[0].value.raw);
2391
2425
  else if (values.length === 1 && !quasis[0].value.raw && !quasis[1].value.raw) {
@@ -2447,19 +2481,19 @@ function transformClasslistObject(path, expr, values, quasis) {
2447
2481
  if (!prop.computed) {
2448
2482
  const prev = quasis.pop();
2449
2483
  quasis.push(
2450
- t__namespace.TemplateElement({
2484
+ t__namespace.templateElement({
2451
2485
  raw:
2452
2486
  (prev ? prev.value.raw : "") + (i ? " " : "") + `${key.value}` + (isLast ? "" : " ")
2453
2487
  })
2454
2488
  );
2455
2489
  } else {
2456
2490
  values.push(key);
2457
- quasis.push(t__namespace.TemplateElement({ raw: isLast ? "" : " " }));
2491
+ quasis.push(t__namespace.templateElement({ raw: isLast ? "" : " " }));
2458
2492
  }
2459
2493
  }
2460
2494
  } else {
2461
2495
  values.push(t__namespace.conditionalExpression(prop.value, key, t__namespace.stringLiteral("")));
2462
- quasis.push(t__namespace.TemplateElement({ raw: isLast ? "" : " " }));
2496
+ quasis.push(t__namespace.templateElement({ raw: isLast ? "" : " " }));
2463
2497
  }
2464
2498
  });
2465
2499
  }
@@ -2697,7 +2731,7 @@ function transformAttributes(path, results) {
2697
2731
  reservedNameSpace &&
2698
2732
  !t__namespace.isJSXExpressionContainer(value)
2699
2733
  ) {
2700
- node.value = value = t__namespace.JSXExpressionContainer(value || t__namespace.JSXEmptyExpression());
2734
+ node.value = value = t__namespace.jsxExpressionContainer(value || t__namespace.jsxEmptyExpression());
2701
2735
  }
2702
2736
  if (t__namespace.isJSXExpressionContainer(value)) {
2703
2737
  if (key === "ref") {
@@ -2711,7 +2745,7 @@ function transformAttributes(path, results) {
2711
2745
  if (t__namespace.isLVal(value.expression)) {
2712
2746
  const refIdentifier = path.scope.generateUidIdentifier("_ref$");
2713
2747
  results.exprs.unshift(
2714
- t__namespace.variableDeclaration("const", [
2748
+ t__namespace.variableDeclaration("var", [
2715
2749
  t__namespace.variableDeclarator(refIdentifier, value.expression)
2716
2750
  ]),
2717
2751
  t__namespace.expressionStatement(
@@ -2749,7 +2783,7 @@ function transformAttributes(path, results) {
2749
2783
  } else if (t__namespace.isCallExpression(value.expression)) {
2750
2784
  const refIdentifier = path.scope.generateUidIdentifier("_ref$");
2751
2785
  results.exprs.unshift(
2752
- t__namespace.variableDeclaration("const", [
2786
+ t__namespace.variableDeclaration("var", [
2753
2787
  t__namespace.variableDeclarator(refIdentifier, value.expression)
2754
2788
  ]),
2755
2789
  t__namespace.expressionStatement(
@@ -2996,7 +3030,7 @@ function processSpreads(path, attributes, { elem, hasChildren, wrapConditionals
2996
3030
  function createTemplate(path, result, wrap) {
2997
3031
  const config = getConfig(path);
2998
3032
  if (result.id) {
2999
- result.decl = t__namespace.variableDeclaration("const", result.declarations);
3033
+ result.decl = t__namespace.variableDeclaration("var", result.declarations);
3000
3034
  if (
3001
3035
  !(result.exprs.length || result.dynamics.length || result.postExprs.length) &&
3002
3036
  result.decl.declarations.length === 1
@@ -3046,29 +3080,37 @@ function wrapDynamics(path, dynamics) {
3046
3080
  ])
3047
3081
  );
3048
3082
  }
3049
- const declarations = [],
3050
- statements = [],
3051
- identifiers = [],
3052
- prevId = t__namespace.identifier("_p$");
3053
- dynamics.forEach(({ elem, key, value }) => {
3054
- const identifier = path.scope.generateUidIdentifier("v$");
3055
- identifiers.push(identifier);
3056
- declarations.push(t__namespace.variableDeclarator(identifier, value));
3057
- const prev = t__namespace.memberExpression(prevId, identifier);
3083
+
3084
+ const prevId = t__namespace.identifier("_p$");
3085
+
3086
+ /** @type {t.VariableDeclarator[]} */
3087
+ const declarations = [];
3088
+ /** @type {t.ExpressionStatement[]} */
3089
+ const statements = [];
3090
+ /** @type {t.Identifier[]} */
3091
+ const properties = [];
3092
+
3093
+ dynamics.forEach(({ elem, key, value }, index) => {
3094
+ const varIdent = path.scope.generateUidIdentifier("v$");
3095
+
3096
+ const propIdent = t__namespace.identifier(getNumberedId(index));
3097
+ const propMember = t__namespace.memberExpression(prevId, propIdent);
3098
+
3099
+ properties.push(propIdent);
3100
+ declarations.push(t__namespace.variableDeclarator(varIdent, value));
3101
+
3058
3102
  statements.push(
3059
3103
  t__namespace.expressionStatement(
3060
3104
  t__namespace.logicalExpression(
3061
3105
  "&&",
3062
- t__namespace.binaryExpression("!==", identifier, t__namespace.memberExpression(prevId, identifier)),
3063
- t__namespace.assignmentExpression("=", t__namespace.memberExpression(prevId, identifier), setAttr(
3064
- path,
3065
- elem,
3066
- key,
3067
- identifier,
3068
- { dynamic: true, prevId: prev }
3069
- ))
3070
- )
3071
- )
3106
+ t__namespace.binaryExpression("!==", varIdent, propMember),
3107
+ t__namespace.assignmentExpression(
3108
+ "=",
3109
+ propMember,
3110
+ setAttr(path, elem, key, varIdent, { dynamic: true, prevId: propMember }),
3111
+ ),
3112
+ ),
3113
+ ),
3072
3114
  );
3073
3115
  });
3074
3116
 
@@ -3077,13 +3119,15 @@ function wrapDynamics(path, dynamics) {
3077
3119
  t__namespace.arrowFunctionExpression(
3078
3120
  [prevId],
3079
3121
  t__namespace.blockStatement([
3080
- t__namespace.variableDeclaration("const", declarations),
3122
+ t__namespace.variableDeclaration("var", declarations),
3081
3123
  ...statements,
3082
- t__namespace.returnStatement(prevId)
3083
- ])
3124
+ t__namespace.returnStatement(prevId),
3125
+ ]),
3084
3126
  ),
3085
- t__namespace.objectExpression(identifiers.map(id => t__namespace.objectProperty(id, t__namespace.identifier("undefined"))))
3086
- ])
3127
+ t__namespace.objectExpression(
3128
+ properties.map((id) => t__namespace.objectProperty(id, t__namespace.identifier("undefined"))),
3129
+ ),
3130
+ ]),
3087
3131
  );
3088
3132
  }
3089
3133
 
@@ -3167,7 +3211,7 @@ function transformComponent(path) {
3167
3211
  t__namespace.identifier("ref"),
3168
3212
  [t__namespace.identifier("r$")],
3169
3213
  t__namespace.blockStatement([
3170
- t__namespace.variableDeclaration("const", [
3214
+ t__namespace.variableDeclaration("var", [
3171
3215
  t__namespace.variableDeclarator(refIdentifier, value.expression)
3172
3216
  ]),
3173
3217
  t__namespace.expressionStatement(
@@ -3194,7 +3238,7 @@ function transformComponent(path) {
3194
3238
  t__namespace.identifier("ref"),
3195
3239
  [t__namespace.identifier("r$")],
3196
3240
  t__namespace.blockStatement([
3197
- t__namespace.variableDeclaration("const", [
3241
+ t__namespace.variableDeclaration("var", [
3198
3242
  t__namespace.variableDeclarator(refIdentifier, value.expression)
3199
3243
  ]),
3200
3244
  t__namespace.expressionStatement(
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.37.9",
4
+ "version": "0.37.13",
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": "2079bbeb5908166253370dd02ba1ce99afb2a2d4"
34
+ "gitHead": "ae2bc5ecd4f8dd61df0b2eb5c4ed0ae7589b6a6b"
35
35
  }