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

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 (3) hide show
  1. package/README.md +14 -1
  2. package/index.js +10 -3
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -130,7 +130,7 @@ Array of Component exports from module, that aren't included by default with the
130
130
 
131
131
  - Type: `string`
132
132
  - Default: `effect`
133
-
133
+
134
134
  This plugin leverages a heuristic for reactive wrapping and lazy evaluation of JSX expressions. This option indicates the reactive wrapper function name (`effect`), defaults to `effect`.
135
135
 
136
136
  ### staticMarker
@@ -147,6 +147,19 @@ Comment decorator string indicates the static expression, used to tell the compi
147
147
 
148
148
  Memos let you efficiently use a derived value in many reactive computations. This option indicates the memo function name, defaults to `memo`.
149
149
 
150
+ ### validate
151
+
152
+ - Type: `boolean`
153
+ - Default: `true`
154
+
155
+ Checks for properly formed HTML by checking for elements that would not be allowed in certain parent elements. This validation isn't complete but includes places where browser would "correct" it and break the DOM walks.
156
+
157
+ ### omitNestedClosingTags
158
+
159
+ - Type: `boolean`
160
+ - Default: `true`
161
+
162
+ Removes unnecessary closing tags from the template output. This may not work in all browser-like environments the same. The solution has been tested again Chrome/Edge/Firefox/Safari.
150
163
 
151
164
  ## Special Binding
152
165
 
package/index.js CHANGED
@@ -707,7 +707,8 @@ const alwaysClose = [
707
707
  "select",
708
708
  "iframe",
709
709
  "script",
710
- "template"
710
+ "template",
711
+ "fieldset"
711
712
  ];
712
713
 
713
714
  function transformElement$3(path, info) {
@@ -757,7 +758,9 @@ function transformElement$3(path, info) {
757
758
  results.template += ">";
758
759
  if (!voidTag) {
759
760
  // always close tags can still be skipped if they have no closing parents and are the last element
760
- const toBeClosed = !info.lastElement || (info.toBeClosed && info.toBeClosed.has(tagName));
761
+ const toBeClosed =
762
+ !info.lastElement ||
763
+ (info.toBeClosed && (!config.omitNestedClosingTags || info.toBeClosed.has(tagName)));
761
764
  if (toBeClosed) {
762
765
  results.toBeClosed = new Set(info.toBeClosed || alwaysClose);
763
766
  results.toBeClosed.add(tagName);
@@ -832,7 +835,10 @@ function setAttr$2(path, elem, name, value, { isSVG, dynamic, prevId, isCE, tagN
832
835
  t__namespace.memberExpression(elem, t__namespace.identifier("classList")),
833
836
  t__namespace.identifier("toggle")
834
837
  ),
835
- [t__namespace.stringLiteral(name), value]
838
+ [
839
+ t__namespace.stringLiteral(name),
840
+ dynamic ? value : t__namespace.unaryExpression("!", t__namespace.unaryExpression("!", value))
841
+ ]
836
842
  );
837
843
  }
838
844
 
@@ -3451,6 +3457,7 @@ var config = {
3451
3457
  builtIns: [],
3452
3458
  requireImportSource: false,
3453
3459
  wrapConditionals: true,
3460
+ omitNestedClosingTags: false,
3454
3461
  contextToCustomElements: false,
3455
3462
  staticMarker: "@once",
3456
3463
  effectWrapper: "effect",
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.8",
4
+ "version": "0.36.10",
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": "cf9fd37dbf6665f6f520243214d0bb73a9898d30"
34
+ "gitHead": "1d04cc14bbde62e06d852eac9e85252359c6b304"
35
35
  }