babel-plugin-jsx-dom-expressions 0.31.4 → 0.31.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 +22 -9
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1498,12 +1498,14 @@ function transformElement$1(path, info) {
1498
1498
  };
1499
1499
  if (info.topLevel && config.hydratable) {
1500
1500
  results.template.push("");
1501
- results.templateValues.push(t__namespace.callExpression(registerImportMethod(path, "ssrHydrationKey"), []));
1501
+ results.templateValues.push(
1502
+ t__namespace.callExpression(registerImportMethod(path, "ssrHydrationKey"), [])
1503
+ );
1502
1504
  }
1503
1505
  transformAttributes$1(path, results);
1504
1506
  appendToTemplate(results.template, ">");
1505
1507
  if (!voidTag) {
1506
- transformChildren$1(path, results, {...config, ...info});
1508
+ transformChildren$1(path, results, { ...config, ...info });
1507
1509
  appendToTemplate(results.template, `</${tagName}>`);
1508
1510
  }
1509
1511
  return results;
@@ -1577,7 +1579,7 @@ function transformToObject(attrName, attributes, selectedAttributes) {
1577
1579
  const attr = selectedAttributes[i].node;
1578
1580
  const computed = !t__namespace.isValidIdentifier(attr.name.name.name);
1579
1581
  if (!computed) {
1580
- attr.name.name.type = 'Identifier';
1582
+ attr.name.name.type = "Identifier";
1581
1583
  }
1582
1584
  properties.push(
1583
1585
  t__namespace.objectProperty(
@@ -1749,7 +1751,10 @@ function transformAttributes$1(path, results) {
1749
1751
  ? p.value
1750
1752
  : t__namespace.isTemplateLiteral(p.value) && p.value.expressions.length === 0
1751
1753
  ? t__namespace.stringLiteral(escapeHTML(p.value.quasis[0].value.raw))
1752
- : t__namespace.callExpression(registerImportMethod(path, "escape"), [p.value, t__namespace.booleanLiteral(true)])
1754
+ : t__namespace.callExpression(registerImportMethod(path, "escape"), [
1755
+ p.value,
1756
+ t__namespace.booleanLiteral(true)
1757
+ ])
1753
1758
  )
1754
1759
  );
1755
1760
  let res = props[0];
@@ -1758,7 +1763,9 @@ function transformAttributes$1(path, results) {
1758
1763
  }
1759
1764
  value.expression = res;
1760
1765
  } else {
1761
- value.expression = t__namespace.callExpression(registerImportMethod(path, "ssrStyle"), [value.expression]);
1766
+ value.expression = t__namespace.callExpression(registerImportMethod(path, "ssrStyle"), [
1767
+ value.expression
1768
+ ]);
1762
1769
  }
1763
1770
  doEscape = false;
1764
1771
  }
@@ -1775,7 +1782,9 @@ function transformAttributes$1(path, results) {
1775
1782
  value.expression = values[0];
1776
1783
  } else value.expression = t__namespace.templateLiteral(quasis, values);
1777
1784
  } else {
1778
- value.expression = t__namespace.callExpression(registerImportMethod(path, "ssrClassList"), [value.expression]);
1785
+ value.expression = t__namespace.callExpression(registerImportMethod(path, "ssrClassList"), [
1786
+ value.expression
1787
+ ]);
1779
1788
  }
1780
1789
  key = "class";
1781
1790
  doEscape = false;
@@ -1807,7 +1816,10 @@ function transformClasslistObject(path, expr, values, quasis) {
1807
1816
  let key = prop.key;
1808
1817
  if (t__namespace.isIdentifier(prop.key) && !prop.computed) key = t__namespace.stringLiteral(key.name);
1809
1818
  else if (prop.computed) {
1810
- key = t__namespace.callExpression(registerImportMethod(path, "escape"), [prop.key, t__namespace.booleanLiteral(true)]);
1819
+ key = t__namespace.callExpression(registerImportMethod(path, "escape"), [
1820
+ prop.key,
1821
+ t__namespace.booleanLiteral(true)
1822
+ ]);
1811
1823
  } else key = t__namespace.stringLiteral(escapeHTML(prop.key.value));
1812
1824
  if (t__namespace.isBooleanLiteral(prop.value)) {
1813
1825
  if (prop.value.value === true) {
@@ -1835,7 +1847,7 @@ function transformChildren$1(path, results, { hydratable }) {
1835
1847
  const doNotEscape = path.doNotEscape;
1836
1848
  const filteredChildren = filterChildren(path.get("children"));
1837
1849
  filteredChildren.forEach(node => {
1838
- if (t__namespace.isJSXElement(node.node) && (getTagName(node.node) === "head")) {
1850
+ if (t__namespace.isJSXElement(node.node) && getTagName(node.node) === "head") {
1839
1851
  const child = transformNode(node, { doNotEscape, hydratable: false });
1840
1852
  registerImportMethod(path, "NoHydration");
1841
1853
  results.template.push("");
@@ -1854,6 +1866,7 @@ function transformChildren$1(path, results, { hydratable }) {
1854
1866
  return;
1855
1867
  }
1856
1868
  const child = transformNode(node, { doNotEscape });
1869
+ if (!child) return;
1857
1870
  appendToTemplate(results.template, child.template);
1858
1871
  results.templateValues.push.apply(results.templateValues, child.templateValues || []);
1859
1872
  if (child.exprs.length) {
@@ -2217,7 +2230,7 @@ function convertComponentIdentifier(node) {
2217
2230
 
2218
2231
  function convertJSXIdentifier(node) {
2219
2232
  if (t__namespace.isJSXIdentifier(node)) {
2220
- if (t__namespace.isValidIdentifier(node.name, false)) {
2233
+ if (t__namespace.isValidIdentifier(node.name)) {
2221
2234
  node.type = "Identifier";
2222
2235
  } else {
2223
2236
  return t__namespace.stringLiteral(node.name);
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.31.4",
4
+ "version": "0.31.5",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,5 +23,5 @@
23
23
  "@babel/types": "^7.16.0",
24
24
  "html-entities": "2.3.2"
25
25
  },
26
- "gitHead": "411215d16c3bf06ced1b55ab76fc85108d053f98"
26
+ "gitHead": "4ef6930208d91931a87074733a134b0fcbebe428"
27
27
  }