babel-plugin-jsx-dom-expressions 0.37.11 → 0.37.16

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 +16 -14
  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
@@ -1142,7 +1142,9 @@ function transformAttributes$2(path, results) {
1142
1142
  evaluated !== undefined &&
1143
1143
  ((type = typeof evaluated) === "string" || type === "number")
1144
1144
  ) {
1145
- value = t__namespace.stringLiteral(String(evaluated));
1145
+ if (type === "number" && (Properties.has(key) || key.startsWith("prop:"))) {
1146
+ value = t__namespace.jsxExpressionContainer(t__namespace.numericLiteral(evaluated));
1147
+ } else value = t__namespace.stringLiteral(String(evaluated));
1146
1148
  }
1147
1149
  }
1148
1150
  if (
@@ -1173,7 +1175,7 @@ function transformAttributes$2(path, results) {
1173
1175
  if (!isFunction && t__namespace.isLVal(value.expression)) {
1174
1176
  const refIdentifier = path.scope.generateUidIdentifier("_ref$");
1175
1177
  results.exprs.unshift(
1176
- t__namespace.variableDeclaration("const", [
1178
+ t__namespace.variableDeclaration("var", [
1177
1179
  t__namespace.variableDeclarator(refIdentifier, value.expression)
1178
1180
  ]),
1179
1181
  t__namespace.expressionStatement(
@@ -1203,7 +1205,7 @@ function transformAttributes$2(path, results) {
1203
1205
  } else if (t__namespace.isCallExpression(value.expression)) {
1204
1206
  const refIdentifier = path.scope.generateUidIdentifier("_ref$");
1205
1207
  results.exprs.unshift(
1206
- t__namespace.variableDeclaration("const", [
1208
+ t__namespace.variableDeclaration("var", [
1207
1209
  t__namespace.variableDeclarator(refIdentifier, value.expression)
1208
1210
  ]),
1209
1211
  t__namespace.expressionStatement(
@@ -1863,7 +1865,7 @@ function appendTemplates$1(path, templates) {
1863
1865
  )
1864
1866
  );
1865
1867
  });
1866
- path.node.body.unshift(t__namespace.variableDeclaration("const", declarators));
1868
+ path.node.body.unshift(t__namespace.variableDeclaration("var", declarators));
1867
1869
  }
1868
1870
 
1869
1871
  function registerTemplate(path, results) {
@@ -1899,7 +1901,7 @@ function registerTemplate(path, results) {
1899
1901
  );
1900
1902
  }
1901
1903
  results.declarations.unshift(decl);
1902
- results.decl = t__namespace.variableDeclaration("const", results.declarations);
1904
+ results.decl = t__namespace.variableDeclaration("var", results.declarations);
1903
1905
  }
1904
1906
 
1905
1907
  function wrapDynamics$1(path, dynamics) {
@@ -2004,7 +2006,7 @@ function wrapDynamics$1(path, dynamics) {
2004
2006
  t__namespace.arrowFunctionExpression(
2005
2007
  [prevId],
2006
2008
  t__namespace.blockStatement([
2007
- t__namespace.variableDeclaration("const", declarations),
2009
+ t__namespace.variableDeclaration("var", declarations),
2008
2010
  ...statements,
2009
2011
  t__namespace.returnStatement(prevId),
2010
2012
  ]),
@@ -2084,7 +2086,7 @@ function appendTemplates(path, templates) {
2084
2086
  const declarators = templates.map(template => {
2085
2087
  return t__namespace.variableDeclarator(template.id, template.template);
2086
2088
  });
2087
- path.node.body.unshift(t__namespace.variableDeclaration("const", declarators));
2089
+ path.node.body.unshift(t__namespace.variableDeclaration("var", declarators));
2088
2090
  }
2089
2091
 
2090
2092
  function appendToTemplate(template, value) {
@@ -2745,7 +2747,7 @@ function transformAttributes(path, results) {
2745
2747
  if (t__namespace.isLVal(value.expression)) {
2746
2748
  const refIdentifier = path.scope.generateUidIdentifier("_ref$");
2747
2749
  results.exprs.unshift(
2748
- t__namespace.variableDeclaration("const", [
2750
+ t__namespace.variableDeclaration("var", [
2749
2751
  t__namespace.variableDeclarator(refIdentifier, value.expression)
2750
2752
  ]),
2751
2753
  t__namespace.expressionStatement(
@@ -2783,7 +2785,7 @@ function transformAttributes(path, results) {
2783
2785
  } else if (t__namespace.isCallExpression(value.expression)) {
2784
2786
  const refIdentifier = path.scope.generateUidIdentifier("_ref$");
2785
2787
  results.exprs.unshift(
2786
- t__namespace.variableDeclaration("const", [
2788
+ t__namespace.variableDeclaration("var", [
2787
2789
  t__namespace.variableDeclarator(refIdentifier, value.expression)
2788
2790
  ]),
2789
2791
  t__namespace.expressionStatement(
@@ -3030,7 +3032,7 @@ function processSpreads(path, attributes, { elem, hasChildren, wrapConditionals
3030
3032
  function createTemplate(path, result, wrap) {
3031
3033
  const config = getConfig(path);
3032
3034
  if (result.id) {
3033
- result.decl = t__namespace.variableDeclaration("const", result.declarations);
3035
+ result.decl = t__namespace.variableDeclaration("var", result.declarations);
3034
3036
  if (
3035
3037
  !(result.exprs.length || result.dynamics.length || result.postExprs.length) &&
3036
3038
  result.decl.declarations.length === 1
@@ -3119,7 +3121,7 @@ function wrapDynamics(path, dynamics) {
3119
3121
  t__namespace.arrowFunctionExpression(
3120
3122
  [prevId],
3121
3123
  t__namespace.blockStatement([
3122
- t__namespace.variableDeclaration("const", declarations),
3124
+ t__namespace.variableDeclaration("var", declarations),
3123
3125
  ...statements,
3124
3126
  t__namespace.returnStatement(prevId),
3125
3127
  ]),
@@ -3211,7 +3213,7 @@ function transformComponent(path) {
3211
3213
  t__namespace.identifier("ref"),
3212
3214
  [t__namespace.identifier("r$")],
3213
3215
  t__namespace.blockStatement([
3214
- t__namespace.variableDeclaration("const", [
3216
+ t__namespace.variableDeclaration("var", [
3215
3217
  t__namespace.variableDeclarator(refIdentifier, value.expression)
3216
3218
  ]),
3217
3219
  t__namespace.expressionStatement(
@@ -3238,7 +3240,7 @@ function transformComponent(path) {
3238
3240
  t__namespace.identifier("ref"),
3239
3241
  [t__namespace.identifier("r$")],
3240
3242
  t__namespace.blockStatement([
3241
- t__namespace.variableDeclaration("const", [
3243
+ t__namespace.variableDeclaration("var", [
3242
3244
  t__namespace.variableDeclarator(refIdentifier, value.expression)
3243
3245
  ]),
3244
3246
  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.11",
4
+ "version": "0.37.16",
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": "74d433381256e4355adc644124026fe0a2ef9875"
34
+ "gitHead": "1c561b9430ff5b16391443338eb07f7a6ca98e20"
35
35
  }