babel-plugin-jsx-dom-expressions 0.34.0 → 0.34.1

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 +10 -6
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1570,12 +1570,12 @@ function appendToTemplate(template, value) {
1570
1570
  }
1571
1571
 
1572
1572
  function transformElement$2(path, info) {
1573
+ const config = getConfig(path);
1573
1574
  // contains spread attributes
1574
1575
  if (path.node.openingElement.attributes.some(a => t__namespace.isJSXSpreadAttribute(a)))
1575
- return createElement(path, info);
1576
+ return createElement(path, { ...info, ...config });
1576
1577
 
1577
1578
  const tagName = getTagName(path.node),
1578
- config = getConfig(path),
1579
1579
  voidTag = VoidElements.indexOf(tagName) > -1,
1580
1580
  results = {
1581
1581
  template: [`<${tagName}`],
@@ -1926,6 +1926,8 @@ function transformClasslistObject(path, expr, values, quasis) {
1926
1926
  function transformChildren$1(path, results, { hydratable }) {
1927
1927
  const doNotEscape = path.doNotEscape;
1928
1928
  const filteredChildren = filterChildren(path.get("children"));
1929
+ const multi = checkLength(filteredChildren),
1930
+ markers = hydratable && multi;
1929
1931
  filteredChildren.forEach(node => {
1930
1932
  if (t__namespace.isJSXElement(node.node) && getTagName(node.node) === "head") {
1931
1933
  const child = transformNode(node, { doNotEscape, hydratable: false });
@@ -1950,9 +1952,6 @@ function transformChildren$1(path, results, { hydratable }) {
1950
1952
  appendToTemplate(results.template, child.template);
1951
1953
  results.templateValues.push.apply(results.templateValues, child.templateValues || []);
1952
1954
  if (child.exprs.length) {
1953
- const multi = checkLength(filteredChildren),
1954
- markers = hydratable && multi;
1955
-
1956
1955
  if (!doNotEscape) child.exprs[0] = escapeExpression(path, child.exprs[0]);
1957
1956
 
1958
1957
  // boxed by textNodes
@@ -1969,19 +1968,24 @@ function transformChildren$1(path, results, { hydratable }) {
1969
1968
  });
1970
1969
  }
1971
1970
 
1972
- function createElement(path, { topLevel }) {
1971
+ function createElement(path, { topLevel, hydratable }) {
1973
1972
  const tagName = getTagName(path.node),
1974
1973
  config = getConfig(path),
1975
1974
  attributes = normalizeAttributes(path);
1976
1975
 
1977
1976
  const filteredChildren = filterChildren(path.get("children")),
1977
+ multi = checkLength(filteredChildren),
1978
+ markers = hydratable && multi,
1978
1979
  childNodes = filteredChildren.reduce((memo, path) => {
1979
1980
  if (t__namespace.isJSXText(path.node)) {
1980
1981
  const v = htmlEntities.decode(trimWhitespace(path.node.extra.raw));
1981
1982
  if (v.length) memo.push(t__namespace.stringLiteral(v));
1982
1983
  } else {
1983
1984
  const child = transformNode(path);
1985
+ if (markers && child.exprs.length) memo.push(t__namespace.stringLiteral("<!--#-->"));
1986
+ if (hydratable && child.exprs.length) child.exprs[0] = t__namespace.arrowFunctionExpression([], child.exprs[0]);
1984
1987
  memo.push(getCreateTemplate(config, path, child)(path, child, true));
1988
+ if (markers && child.exprs.length) memo.push(t__namespace.stringLiteral("<!--/-->"));
1985
1989
  }
1986
1990
  return memo;
1987
1991
  }, []);
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.34.0",
4
+ "version": "0.34.1",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "peerDependencies": {
28
28
  "@babel/core": "^7.0.0"
29
29
  },
30
- "gitHead": "4a2f5a8af46437c71b0c30a5242213fc87669515"
30
+ "gitHead": "5e49406921a4fde147b9b64edbfa8fc8c096fbda"
31
31
  }