babel-plugin-jsx-dom-expressions 0.36.6 → 0.36.8

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 +12 -17
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -251,13 +251,7 @@ const reservedNameSpaces = new Set([
251
251
  "attr"
252
252
  ]);
253
253
 
254
- const nonSpreadNameSpaces = new Set([
255
- "class",
256
- "style",
257
- "use",
258
- "prop",
259
- "attr"
260
- ]);
254
+ const nonSpreadNameSpaces = new Set(["class", "style", "use", "prop", "attr"]);
261
255
 
262
256
  function getConfig(path) {
263
257
  return path.hub.file.metadata.config;
@@ -594,7 +588,8 @@ function convertJSXIdentifier(node) {
594
588
  }
595
589
 
596
590
  function canNativeSpread(key, { checkNameSpaces } = {}) {
597
- if (checkNameSpaces && key.includes(":") && nonSpreadNameSpaces.has(key.split(":")[0])) return false;
591
+ if (checkNameSpaces && key.includes(":") && nonSpreadNameSpaces.has(key.split(":")[0]))
592
+ return false;
598
593
  // TODO: figure out how to detect definitely function ref
599
594
  if (key === "ref") return false;
600
595
  return true;
@@ -690,7 +685,7 @@ const BlockElements = [
690
685
  "pre",
691
686
  "section",
692
687
  "table",
693
- "ul",
688
+ "ul"
694
689
  ];
695
690
 
696
691
  const alwaysClose = [
@@ -766,8 +761,8 @@ function transformElement$3(path, info) {
766
761
  if (toBeClosed) {
767
762
  results.toBeClosed = new Set(info.toBeClosed || alwaysClose);
768
763
  results.toBeClosed.add(tagName);
769
- if (InlineElements.includes(tagName)) results.toBeClosed.add(...BlockElements);
770
- }
764
+ if (InlineElements.includes(tagName)) BlockElements.forEach(i => results.toBeClosed.add(i));
765
+ } else results.toBeClosed = info.toBeClosed;
771
766
  transformChildren$2(path, results, config);
772
767
  if (toBeClosed) results.template += `</${tagName}>`;
773
768
  }
@@ -1393,7 +1388,7 @@ function findLastElement(children, hydratable) {
1393
1388
  if (
1394
1389
  hydratable ||
1395
1390
  t__namespace.isJSXText(node) ||
1396
- getStaticExpression(children[i]) ||
1391
+ getStaticExpression(children[i]) !== false ||
1397
1392
  (t__namespace.isJSXElement(node) && (tagName = getTagName(node)) && !isComponent(tagName))
1398
1393
  ) {
1399
1394
  lastElement = i;
@@ -1572,7 +1567,7 @@ function detectExpressions(children, index, config) {
1572
1567
  if (
1573
1568
  t__namespace.isJSXExpressionContainer(node) &&
1574
1569
  !t__namespace.isJSXEmptyExpression(node.expression) &&
1575
- !getStaticExpression(children[index - 1])
1570
+ getStaticExpression(children[index - 1]) === false
1576
1571
  )
1577
1572
  return true;
1578
1573
  let tagName;
@@ -1581,7 +1576,7 @@ function detectExpressions(children, index, config) {
1581
1576
  for (let i = index; i < children.length; i++) {
1582
1577
  const child = children[i].node;
1583
1578
  if (t__namespace.isJSXExpressionContainer(child)) {
1584
- if (!t__namespace.isJSXEmptyExpression(child.expression) && !getStaticExpression(children[i]))
1579
+ if (!t__namespace.isJSXEmptyExpression(child.expression) && getStaticExpression(children[i]) === false)
1585
1580
  return true;
1586
1581
  } else if (t__namespace.isJSXElement(child)) {
1587
1582
  const tagName = getTagName(child);
@@ -3316,7 +3311,7 @@ function transformNode(path, info = {}) {
3316
3311
  // <><div /><Component /></>
3317
3312
  transformFragmentChildren(path.get("children"), results, config);
3318
3313
  return results;
3319
- } else if (t__namespace.isJSXText(node) || (staticValue = getStaticExpression(path))) {
3314
+ } else if (t__namespace.isJSXText(node) || (staticValue = getStaticExpression(path)) !== false) {
3320
3315
  const text =
3321
3316
  staticValue !== undefined
3322
3317
  ? info.doNotEscape
@@ -3412,8 +3407,8 @@ function transformElement(config, path, info = {}) {
3412
3407
  // <div ...></div>
3413
3408
  // const element = getTransformElemet(config, path, tagName);
3414
3409
 
3415
- const tagRenderer = (config.renderers ?? []).find(
3416
- renderer => renderer.elements.includes(tagName)
3410
+ const tagRenderer = (config.renderers ?? []).find(renderer =>
3411
+ renderer.elements.includes(tagName)
3417
3412
  );
3418
3413
 
3419
3414
  if (tagRenderer?.name === "dom" || getConfig(path).generate === "dom") {
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.36.6",
4
+ "version": "0.36.8",
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": "35c4a68d712cb008adf5e37bc0fd79d7e941491b"
34
+ "gitHead": "cf9fd37dbf6665f6f520243214d0bb73a9898d30"
35
35
  }