babel-plugin-jsx-dom-expressions 0.29.19 → 0.30.6

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 +514 -117
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -30,21 +30,6 @@ function _interopNamespace(e) {
30
30
  var SyntaxJSX__default = /*#__PURE__*/_interopDefaultLegacy(SyntaxJSX);
31
31
  var t__namespace = /*#__PURE__*/_interopNamespace(t);
32
32
 
33
- var config = {
34
- moduleName: "dom",
35
- generate: "dom",
36
- hydratable: false,
37
- delegateEvents: true,
38
- delegatedEvents: [],
39
- builtIns: [],
40
- requireImportSource: false,
41
- wrapConditionals: true,
42
- contextToCustomElements: false,
43
- staticMarker: "@once",
44
- effectWrapper: "effect",
45
- memoWrapper: "memo"
46
- };
47
-
48
33
  const booleans = [
49
34
  "allowfullscreen",
50
35
  "async",
@@ -235,12 +220,16 @@ const reservedNameSpaces = new Set([
235
220
  "attr"
236
221
  ]);
237
222
 
223
+ function getConfig(path) {
224
+ return path.hub.file.metadata.config;
225
+ }
226
+
238
227
  function registerImportMethod(path, name) {
239
228
  const imports =
240
229
  path.scope.getProgramParent().data.imports ||
241
230
  (path.scope.getProgramParent().data.imports = new Set());
242
231
  if (!imports.has(name)) {
243
- helperModuleImports.addNamed(path, name, config.moduleName, {
232
+ helperModuleImports.addNamed(path, name, getConfig(path).moduleName, {
244
233
  nameHint: `_$${name}`
245
234
  });
246
235
  imports.add(name);
@@ -282,6 +271,7 @@ function isComponent(tagName) {
282
271
  }
283
272
 
284
273
  function isDynamic(path, { checkMember, checkTags, checkCallExpressions = true, native }) {
274
+ const config = getConfig(path);
285
275
  if (config.generate === "ssr" && native) {
286
276
  checkMember = false;
287
277
  checkCallExpressions = false;
@@ -379,11 +369,33 @@ function toPropertyName(name) {
379
369
  return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
380
370
  }
381
371
 
382
- function transformCondition(path, deep) {
383
- const expr = path.node;
384
- if (config.memoWrapper) {
385
- registerImportMethod(path, config.memoWrapper);
372
+ function wrappedByText(list, startIndex) {
373
+ let index = startIndex,
374
+ wrapped;
375
+ while (--index >= 0) {
376
+ const node = list[index];
377
+ if (!node) continue;
378
+ if (node.text) {
379
+ wrapped = true;
380
+ break;
381
+ }
382
+ if (node.id) return false;
383
+ }
384
+ if (!wrapped) return false;
385
+ index = startIndex;
386
+ while (++index < list.length) {
387
+ const node = list[index];
388
+ if (!node) continue;
389
+ if (node.text) return true;
390
+ if (node.id) return false;
386
391
  }
392
+ return false;
393
+ }
394
+
395
+ function transformCondition(path, inline, deep) {
396
+ const config = getConfig(path);
397
+ const expr = path.node;
398
+ registerImportMethod(path, config.memoWrapper);
387
399
  let dTest, cond, id;
388
400
  if (
389
401
  t__namespace.isConditionalExpression(expr) &&
@@ -395,15 +407,20 @@ function transformCondition(path, deep) {
395
407
  dTest = isDynamic(path.get("test"), { checkMember: true });
396
408
  if (dTest) {
397
409
  cond = expr.test;
398
- id = path.scope.generateUidIdentifier("_c$");
399
410
  if (!t__namespace.isBinaryExpression(cond))
400
411
  cond = t__namespace.unaryExpression("!", t__namespace.unaryExpression("!", cond, true), true);
412
+ id = inline
413
+ ? t__namespace.callExpression(t__namespace.identifier(`_$${config.memoWrapper}`), [
414
+ t__namespace.arrowFunctionExpression([], cond),
415
+ t__namespace.booleanLiteral(true)
416
+ ])
417
+ : path.scope.generateUidIdentifier("_c$");
401
418
  expr.test = t__namespace.callExpression(id, []);
402
419
  if (t__namespace.isConditionalExpression(expr.consequent) || t__namespace.isLogicalExpression(expr.consequent)) {
403
- expr.consequent = transformCondition(path.get("consequent"), true);
420
+ expr.consequent = transformCondition(path.get("consequent"), inline, true);
404
421
  }
405
422
  if (t__namespace.isConditionalExpression(expr.alternate) || t__namespace.isLogicalExpression(expr.alternate)) {
406
- expr.alternate = transformCondition(path.get("alternate"), true);
423
+ expr.alternate = transformCondition(path.get("alternate"), inline, true);
407
424
  }
408
425
  }
409
426
  } else if (t__namespace.isLogicalExpression(expr)) {
@@ -419,13 +436,20 @@ function transformCondition(path, deep) {
419
436
  }));
420
437
  if (dTest) {
421
438
  cond = nextPath.node.left;
422
- id = path.scope.generateUidIdentifier("_c$");
423
439
  if (!t__namespace.isBinaryExpression(cond))
424
440
  cond = t__namespace.unaryExpression("!", t__namespace.unaryExpression("!", cond, true), true);
441
+ id = inline
442
+ ? t__namespace.callExpression(t__namespace.identifier(`_$${config.memoWrapper}`), [
443
+ t__namespace.arrowFunctionExpression([], cond),
444
+ t__namespace.booleanLiteral(true)
445
+ ])
446
+ : path.scope.generateUidIdentifier("_c$");
425
447
  nextPath.node.left = t__namespace.callExpression(id, []);
426
448
  }
427
449
  }
428
450
  if (dTest) {
451
+ if (inline) return t__namespace.arrowFunctionExpression([], expr);
452
+
429
453
  const statements = [
430
454
  t__namespace.variableDeclaration("const", [
431
455
  t__namespace.variableDeclarator(
@@ -498,8 +522,9 @@ function escapeHTML(s, attr) {
498
522
  return left < s.length ? out + s.substring(left) : out;
499
523
  }
500
524
 
501
- function transformElement$1(path, info) {
525
+ function transformElement$2(path, info) {
502
526
  let tagName = getTagName(path.node),
527
+ config = getConfig(path),
503
528
  wrapSVG = info.topLevel && tagName != "svg" && SVGElements.has(tagName),
504
529
  voidTag = VoidElements.indexOf(tagName) > -1,
505
530
  results = {
@@ -514,13 +539,13 @@ function transformElement$1(path, info) {
514
539
  if (tagName === "html" && config.hydratable) results.skipTemplate = true;
515
540
  if (wrapSVG) results.template = "<svg>" + results.template;
516
541
  if (!info.skipId) results.id = path.scope.generateUidIdentifier("el$");
517
- transformAttributes$1(path, results);
542
+ transformAttributes$2(path, results);
518
543
  if (config.contextToCustomElements && (tagName === "slot" || tagName.indexOf("-") > -1)) {
519
544
  contextToCustomElement(path, results);
520
545
  }
521
546
  results.template += ">";
522
547
  if (!voidTag) {
523
- transformChildren$1(path, results);
548
+ transformChildren$2(path, results, config);
524
549
  results.template += `</${tagName}>`;
525
550
  }
526
551
  if (info.topLevel && config.hydratable && results.hasHydratableEvent) {
@@ -533,7 +558,7 @@ function transformElement$1(path, info) {
533
558
  return results;
534
559
  }
535
560
 
536
- function setAttr$1(path, elem, name, value, { isSVG, dynamic, prevId, isCE }) {
561
+ function setAttr$2(path, elem, name, value, { isSVG, dynamic, prevId, isCE }) {
537
562
  // pull out namespace
538
563
  let parts, namespace;
539
564
  if ((parts = name.split(":")) && parts[1] && reservedNameSpaces.has(parts[0])) {
@@ -629,7 +654,7 @@ function detectResolvableEventHandler(attribute, handler) {
629
654
  return t__namespace.isFunction(handler);
630
655
  }
631
656
 
632
- function transformAttributes$1(path, results) {
657
+ function transformAttributes$2(path, results) {
633
658
  let elem = results.id,
634
659
  hasHydratableEvent = false,
635
660
  children,
@@ -638,7 +663,8 @@ function transformAttributes$1(path, results) {
638
663
  tagName = getTagName(path.node),
639
664
  isSVG = SVGElements.has(tagName),
640
665
  isCE = tagName.includes("-"),
641
- hasChildren = path.node.children.length > 0;
666
+ hasChildren = path.node.children.length > 0,
667
+ config = getConfig(path);
642
668
 
643
669
  // preprocess styles
644
670
  const styleAttribute = attributes.find(
@@ -777,7 +803,9 @@ function transformAttributes$1(path, results) {
777
803
  isDynamic(attribute.get("argument"), {
778
804
  checkMember: true
779
805
  })
780
- ? t__namespace.arrowFunctionExpression([], node.argument)
806
+ ? t__namespace.isCallExpression(node.argument) && !node.argument.arguments.length
807
+ ? node.argument.callee
808
+ : t__namespace.arrowFunctionExpression([], node.argument)
781
809
  : node.argument,
782
810
  t__namespace.booleanLiteral(isSVG),
783
811
  t__namespace.booleanLiteral(hasChildren)
@@ -795,6 +823,16 @@ function transformAttributes$1(path, results) {
795
823
  : node.name.name,
796
824
  reservedNameSpace =
797
825
  t__namespace.isJSXNamespacedName(node.name) && reservedNameSpaces.has(node.name.namespace.name);
826
+ if (t__namespace.isJSXExpressionContainer(value)) {
827
+ const evaluated = attribute.get("value").get("expression").evaluate().value;
828
+ let type;
829
+ if (
830
+ evaluated !== undefined &&
831
+ ((type = typeof evaluated) === "string" || type === "number")
832
+ ) {
833
+ value = t__namespace.stringLiteral(String(evaluated));
834
+ }
835
+ }
798
836
  if (
799
837
  t__namespace.isJSXNamespacedName(node.name) &&
800
838
  reservedNameSpace &&
@@ -1006,7 +1044,7 @@ function transformAttributes$1(path, results) {
1006
1044
  results.dynamics.push({ elem: nextElem, key, value: value.expression, isSVG, isCE });
1007
1045
  } else {
1008
1046
  results.exprs.push(
1009
- t__namespace.expressionStatement(setAttr$1(attribute, elem, key, value.expression, { isSVG, isCE }))
1047
+ t__namespace.expressionStatement(setAttr$2(attribute, elem, key, value.expression, { isSVG, isCE }))
1010
1048
  );
1011
1049
  }
1012
1050
  } else {
@@ -1018,7 +1056,7 @@ function transformAttributes$1(path, results) {
1018
1056
  key = Aliases[key] || key;
1019
1057
  if (value && ChildProperties.has(key)) {
1020
1058
  results.exprs.push(
1021
- t__namespace.expressionStatement(setAttr$1(attribute, elem, key, value, { isSVG, isCE }))
1059
+ t__namespace.expressionStatement(setAttr$2(attribute, elem, key, value, { isSVG, isCE }))
1022
1060
  );
1023
1061
  } else {
1024
1062
  !isSVG && (key = key.toLowerCase());
@@ -1034,31 +1072,7 @@ function transformAttributes$1(path, results) {
1034
1072
  results.hasHydratableEvent = results.hasHydratableEvent || hasHydratableEvent;
1035
1073
  }
1036
1074
 
1037
- function wrappedByText(list, startIndex) {
1038
- let index = startIndex,
1039
- wrapped;
1040
- while (--index >= 0) {
1041
- const node = list[index];
1042
- if (!node) continue;
1043
- if (node.text) {
1044
- wrapped = true;
1045
- break;
1046
- }
1047
- if (node.id) return false;
1048
- }
1049
- if (!wrapped) return false;
1050
- index = startIndex;
1051
- while (++index < list.length) {
1052
- const node = list[index];
1053
- if (!node) continue;
1054
- if (node.text) return true;
1055
- if (node.id) return false;
1056
- }
1057
- return false;
1058
- }
1059
-
1060
- function transformChildren$1(path, results) {
1061
- const { hydratable } = config;
1075
+ function transformChildren$2(path, results, config) {
1062
1076
  let tempPath = results.id && results.id.name,
1063
1077
  tagName = getTagName(path.node),
1064
1078
  nextPlaceholder,
@@ -1068,7 +1082,7 @@ function transformChildren$1(path, results) {
1068
1082
  .map(
1069
1083
  (child, index) =>
1070
1084
  transformNode(child, {
1071
- skipId: !results.id || !detectExpressions(filteredChildren, index)
1085
+ skipId: !results.id || !detectExpressions(filteredChildren, index, config)
1072
1086
  })
1073
1087
  // combine adjacent textNodes
1074
1088
  )
@@ -1085,7 +1099,7 @@ function transformChildren$1(path, results) {
1085
1099
  if (!child) return;
1086
1100
  results.template += child.template;
1087
1101
  if (child.id) {
1088
- if (hydratable && tagName === "html") {
1102
+ if (config.hydratable && tagName === "html") {
1089
1103
  registerImportMethod(path, "getNextMatch");
1090
1104
  }
1091
1105
  const walk = t__namespace.memberExpression(
@@ -1095,7 +1109,7 @@ function transformChildren$1(path, results) {
1095
1109
  results.decl.push(
1096
1110
  t__namespace.variableDeclarator(
1097
1111
  child.id,
1098
- hydratable && tagName === "html"
1112
+ config.hydratable && tagName === "html"
1099
1113
  ? t__namespace.callExpression(t__namespace.identifier("_$getNextMatch"), [
1100
1114
  walk,
1101
1115
  t__namespace.stringLiteral(child.tagName)
@@ -1113,7 +1127,7 @@ function transformChildren$1(path, results) {
1113
1127
  } else if (child.exprs.length) {
1114
1128
  registerImportMethod(path, "insert");
1115
1129
  const multi = checkLength(filteredChildren),
1116
- markers = hydratable && multi;
1130
+ markers = config.hydratable && multi;
1117
1131
  // boxed by textNodes
1118
1132
  if (markers || wrappedByText(childNodes, index)) {
1119
1133
  let exprId, contentId;
@@ -1141,7 +1155,7 @@ function transformChildren$1(path, results) {
1141
1155
  t__namespace.callExpression(t__namespace.identifier("_$insert"), [
1142
1156
  results.id,
1143
1157
  child.exprs[0],
1144
- nextChild(childNodes, index) || t__namespace.nullLiteral()
1158
+ nextChild$1(childNodes, index) || t__namespace.nullLiteral()
1145
1159
  ])
1146
1160
  )
1147
1161
  );
@@ -1150,7 +1164,7 @@ function transformChildren$1(path, results) {
1150
1164
  t__namespace.expressionStatement(
1151
1165
  t__namespace.callExpression(
1152
1166
  t__namespace.identifier("_$insert"),
1153
- hydratable
1167
+ config.hydratable
1154
1168
  ? [
1155
1169
  results.id,
1156
1170
  child.exprs[0],
@@ -1179,7 +1193,8 @@ function transformChildren$1(path, results) {
1179
1193
  }
1180
1194
 
1181
1195
  function createPlaceholder(path, results, tempPath, i, char) {
1182
- const exprId = path.scope.generateUidIdentifier("el$");
1196
+ const exprId = path.scope.generateUidIdentifier("el$"),
1197
+ config = getConfig(path);
1183
1198
  let contentId;
1184
1199
  results.template += `<!${char}>`;
1185
1200
  if (config.hydratable && char === "/") {
@@ -1206,12 +1221,12 @@ function createPlaceholder(path, results, tempPath, i, char) {
1206
1221
  return [exprId, contentId];
1207
1222
  }
1208
1223
 
1209
- function nextChild(children, index) {
1210
- return children[index + 1] && (children[index + 1].id || nextChild(children, index + 1));
1224
+ function nextChild$1(children, index) {
1225
+ return children[index + 1] && (children[index + 1].id || nextChild$1(children, index + 1));
1211
1226
  }
1212
1227
 
1213
1228
  // reduce unnecessary refs
1214
- function detectExpressions(children, index) {
1229
+ function detectExpressions(children, index, config) {
1215
1230
  if (children[index - 1]) {
1216
1231
  const node = children[index - 1].node;
1217
1232
  if (
@@ -1248,7 +1263,7 @@ function detectExpressions(children, index) {
1248
1263
  )
1249
1264
  return true;
1250
1265
  const nextChildren = filterChildren(children[i].get("children"));
1251
- if (nextChildren.length) if (detectExpressions(nextChildren, 0)) return true;
1266
+ if (nextChildren.length) if (detectExpressions(nextChildren, 0, config)) return true;
1252
1267
  }
1253
1268
  }
1254
1269
  }
@@ -1266,7 +1281,8 @@ function contextToCustomElement(path, results) {
1266
1281
  );
1267
1282
  }
1268
1283
 
1269
- function createTemplate$1(path, result, wrap) {
1284
+ function createTemplate$2(path, result, wrap) {
1285
+ const config = getConfig(path);
1270
1286
  if (result.id) {
1271
1287
  registerTemplate(path, result);
1272
1288
  if (
@@ -1281,7 +1297,7 @@ function createTemplate$1(path, result, wrap) {
1281
1297
  t__namespace.blockStatement([
1282
1298
  result.decl,
1283
1299
  ...result.exprs.concat(
1284
- wrapDynamics(path, result.dynamics) || [],
1300
+ wrapDynamics$1(path, result.dynamics) || [],
1285
1301
  result.postExprs || []
1286
1302
  ),
1287
1303
  t__namespace.returnStatement(result.id)
@@ -1320,7 +1336,7 @@ function appendTemplates$1(path, templates) {
1320
1336
  }
1321
1337
 
1322
1338
  function registerTemplate(path, results) {
1323
- const { hydratable } = config;
1339
+ const { hydratable } = getConfig(path);
1324
1340
  let decl;
1325
1341
  if (results.template.length) {
1326
1342
  let templateDef, templateId;
@@ -1354,8 +1370,9 @@ function registerTemplate(path, results) {
1354
1370
  results.decl = t__namespace.variableDeclaration("const", results.decl);
1355
1371
  }
1356
1372
 
1357
- function wrapDynamics(path, dynamics) {
1373
+ function wrapDynamics$1(path, dynamics) {
1358
1374
  if (!dynamics.length) return;
1375
+ const config = getConfig(path);
1359
1376
  registerImportMethod(path, config.effectWrapper);
1360
1377
 
1361
1378
  const effectWrapperId = `_$${config.effectWrapper}`;
@@ -1370,7 +1387,7 @@ function wrapDynamics(path, dynamics) {
1370
1387
  t__namespace.callExpression(t__namespace.identifier(effectWrapperId), [
1371
1388
  t__namespace.arrowFunctionExpression(
1372
1389
  prevValue ? [prevValue] : [],
1373
- setAttr$1(path, dynamics[0].elem, dynamics[0].key, dynamics[0].value, {
1390
+ setAttr$2(path, dynamics[0].elem, dynamics[0].key, dynamics[0].value, {
1374
1391
  isSVG: dynamics[0].isSVG,
1375
1392
  isCE: dynamics[0].isCE,
1376
1393
  dynamic: true,
@@ -1395,7 +1412,7 @@ function wrapDynamics(path, dynamics) {
1395
1412
  t__namespace.assignmentExpression(
1396
1413
  "=",
1397
1414
  prev,
1398
- setAttr$1(path, elem, key, identifier, { isSVG, isCE, dynamic: true, prevId: prev })
1415
+ setAttr$2(path, elem, key, identifier, { isSVG, isCE, dynamic: true, prevId: prev })
1399
1416
  )
1400
1417
  )
1401
1418
  );
@@ -1405,7 +1422,7 @@ function wrapDynamics(path, dynamics) {
1405
1422
  t__namespace.logicalExpression(
1406
1423
  "&&",
1407
1424
  t__namespace.binaryExpression("!==", identifier, t__namespace.memberExpression(prevId, identifier)),
1408
- setAttr$1(
1425
+ setAttr$2(
1409
1426
  path,
1410
1427
  elem,
1411
1428
  key,
@@ -1442,8 +1459,9 @@ function appendToTemplate(template, value) {
1442
1459
  if (array && array.length) template.push.apply(template, array);
1443
1460
  }
1444
1461
 
1445
- function transformElement(path, info) {
1462
+ function transformElement$1(path, info) {
1446
1463
  let tagName = getTagName(path.node),
1464
+ config = getConfig(path),
1447
1465
  voidTag = VoidElements.indexOf(tagName) > -1,
1448
1466
  results = {
1449
1467
  template: [`<${tagName}`],
@@ -1457,10 +1475,10 @@ function transformElement(path, info) {
1457
1475
  results.template.push("");
1458
1476
  results.templateValues.push(t__namespace.callExpression(t__namespace.identifier("_$ssrHydrationKey"), []));
1459
1477
  }
1460
- transformAttributes(path, results);
1478
+ transformAttributes$1(path, results);
1461
1479
  appendToTemplate(results.template, ">");
1462
1480
  if (!voidTag) {
1463
- transformChildren(path, results);
1481
+ transformChildren$1(path, results, config);
1464
1482
  appendToTemplate(results.template, `</${tagName}>`);
1465
1483
  }
1466
1484
  return results;
@@ -1472,7 +1490,7 @@ function toAttribute(key, isSVG) {
1472
1490
  return key;
1473
1491
  }
1474
1492
 
1475
- function setAttr(results, name, value, isSVG) {
1493
+ function setAttr$1(results, name, value, isSVG) {
1476
1494
  // strip out namespaces for now, everything at this point is an attribute
1477
1495
  let parts;
1478
1496
  if ((parts = name.split(":")) && parts[1] && reservedNameSpaces.has(parts[0])) {
@@ -1556,7 +1574,7 @@ function transformToObject(attrName, attributes, selectedAttributes) {
1556
1574
  }
1557
1575
  }
1558
1576
 
1559
- function transformAttributes(path, results) {
1577
+ function transformAttributes$1(path, results) {
1560
1578
  let children;
1561
1579
  const tagName = getTagName(path.node),
1562
1580
  isSVG = SVGElements.has(tagName),
@@ -1628,7 +1646,9 @@ function transformAttributes(path, results) {
1628
1646
  checkMember: true,
1629
1647
  native: true
1630
1648
  })
1631
- ? t__namespace.arrowFunctionExpression([], node.argument)
1649
+ ? t__namespace.isCallExpression(node.argument) && !node.argument.arguments.length
1650
+ ? node.argument.callee
1651
+ : t__namespace.arrowFunctionExpression([], node.argument)
1632
1652
  : node.argument,
1633
1653
  t__namespace.booleanLiteral(isSVG),
1634
1654
  t__namespace.booleanLiteral(hasChildren)
@@ -1745,7 +1765,7 @@ function transformAttributes(path, results) {
1745
1765
  doEscape ? escapeExpression(path, value.expression, true) : value.expression
1746
1766
  );
1747
1767
  else if (doEscape) value.expression = escapeExpression(path, value.expression, true);
1748
- setAttr(results, key, value.expression, isSVG);
1768
+ setAttr$1(results, key, value.expression, isSVG);
1749
1769
  }
1750
1770
  } else {
1751
1771
  if (key === "$ServerOnly") return;
@@ -1791,9 +1811,8 @@ function transformClasslistObject(path, expr, values, quasis) {
1791
1811
  });
1792
1812
  }
1793
1813
 
1794
- function transformChildren(path, results) {
1795
- const { hydratable } = config,
1796
- doNotEscape = path.doNotEscape;
1814
+ function transformChildren$1(path, results, { hydratable }) {
1815
+ const doNotEscape = path.doNotEscape;
1797
1816
  const filteredChildren = filterChildren(path.get("children"));
1798
1817
  filteredChildren.forEach(node => {
1799
1818
  const child = transformNode(node, { doNotEscape });
@@ -1819,7 +1838,7 @@ function transformChildren(path, results) {
1819
1838
  });
1820
1839
  }
1821
1840
 
1822
- function createTemplate(path, result) {
1841
+ function createTemplate$1(path, result) {
1823
1842
  if (!result.template) {
1824
1843
  return result.exprs[0];
1825
1844
  }
@@ -1865,11 +1884,343 @@ function appendTemplates(path, templates) {
1865
1884
  path.node.body.unshift(t__namespace.variableDeclaration("const", declarators));
1866
1885
  }
1867
1886
 
1887
+ function transformElement(path, info) {
1888
+ let tagName = getTagName(path.node),
1889
+ results = {
1890
+ id: path.scope.generateUidIdentifier("el$"),
1891
+ decl: [],
1892
+ exprs: [],
1893
+ dynamics: [],
1894
+ postExprs: [],
1895
+ tagName
1896
+ };
1897
+
1898
+ registerImportMethod(path, "createElement");
1899
+ results.decl.push(
1900
+ t__namespace.variableDeclarator(
1901
+ results.id,
1902
+ t__namespace.callExpression(t__namespace.identifier("_$createElement"), [t__namespace.stringLiteral(tagName)])
1903
+ )
1904
+ );
1905
+
1906
+ transformAttributes(path, results);
1907
+ transformChildren(path, results);
1908
+
1909
+ return results;
1910
+ }
1911
+
1912
+ function transformAttributes(path, results) {
1913
+ let children;
1914
+ const elem = results.id,
1915
+ spread = t__namespace.identifier("_$spread"),
1916
+ hasChildren = path.node.children.length > 0,
1917
+ config = getConfig(path);
1918
+
1919
+ path
1920
+ .get("openingElement")
1921
+ .get("attributes")
1922
+ .forEach(attribute => {
1923
+ const node = attribute.node;
1924
+ if (t__namespace.isJSXSpreadAttribute(node)) {
1925
+ registerImportMethod(attribute, "spread");
1926
+ results.exprs.push(
1927
+ t__namespace.expressionStatement(
1928
+ t__namespace.callExpression(spread, [
1929
+ elem,
1930
+ isDynamic(attribute.get("argument"), {
1931
+ checkMember: true
1932
+ })
1933
+ ? t__namespace.isCallExpression(node.argument) && !node.argument.arguments.length
1934
+ ? node.argument.callee
1935
+ : t__namespace.arrowFunctionExpression([], node.argument)
1936
+ : node.argument,
1937
+ t__namespace.booleanLiteral(hasChildren)
1938
+ ])
1939
+ )
1940
+ );
1941
+ return;
1942
+ }
1943
+
1944
+ let value = node.value,
1945
+ key = t__namespace.isJSXNamespacedName(node.name)
1946
+ ? `${node.name.namespace.name}:${node.name.name.name}`
1947
+ : node.name.name,
1948
+ reservedNameSpace = t__namespace.isJSXNamespacedName(node.name) && node.name.namespace.name === "use";
1949
+ if (
1950
+ t__namespace.isJSXNamespacedName(node.name) &&
1951
+ reservedNameSpace &&
1952
+ !t__namespace.isJSXExpressionContainer(value)
1953
+ ) {
1954
+ node.value = value = t__namespace.JSXExpressionContainer(value || t__namespace.JSXEmptyExpression());
1955
+ }
1956
+ if (t__namespace.isJSXExpressionContainer(value)) {
1957
+ if (key === "ref") {
1958
+ // Normalize expressions for non-null and type-as
1959
+ while (
1960
+ t__namespace.isTSNonNullExpression(value.expression) ||
1961
+ t__namespace.isTSAsExpression(value.expression)
1962
+ ) {
1963
+ value.expression = value.expression.expression;
1964
+ }
1965
+ if (t__namespace.isLVal(value.expression)) {
1966
+ const refIdentifier = path.scope.generateUidIdentifier("_ref$");
1967
+ results.exprs.unshift(
1968
+ t__namespace.variableDeclaration("const", [
1969
+ t__namespace.variableDeclarator(refIdentifier, value.expression)
1970
+ ]),
1971
+ t__namespace.expressionStatement(
1972
+ t__namespace.conditionalExpression(
1973
+ t__namespace.binaryExpression(
1974
+ "===",
1975
+ t__namespace.unaryExpression("typeof", refIdentifier),
1976
+ t__namespace.stringLiteral("function")
1977
+ ),
1978
+ t__namespace.callExpression(refIdentifier, [elem]),
1979
+ t__namespace.assignmentExpression("=", value.expression, elem)
1980
+ )
1981
+ )
1982
+ );
1983
+ } else if (t__namespace.isFunction(value.expression)) {
1984
+ results.exprs.unshift(
1985
+ t__namespace.expressionStatement(t__namespace.callExpression(value.expression, [elem]))
1986
+ );
1987
+ } else if (t__namespace.isCallExpression(value.expression)) {
1988
+ const refIdentifier = path.scope.generateUidIdentifier("_ref$");
1989
+ results.exprs.unshift(
1990
+ t__namespace.variableDeclaration("const", [
1991
+ t__namespace.variableDeclarator(refIdentifier, value.expression)
1992
+ ]),
1993
+ t__namespace.expressionStatement(
1994
+ t__namespace.logicalExpression(
1995
+ "&&",
1996
+ t__namespace.binaryExpression(
1997
+ "===",
1998
+ t__namespace.unaryExpression("typeof", refIdentifier),
1999
+ t__namespace.stringLiteral("function")
2000
+ ),
2001
+ t__namespace.callExpression(refIdentifier, [elem])
2002
+ )
2003
+ )
2004
+ );
2005
+ }
2006
+ } else if (key.startsWith("use:")) {
2007
+ results.exprs.unshift(
2008
+ t__namespace.expressionStatement(
2009
+ t__namespace.callExpression(t__namespace.identifier(node.name.name.name), [
2010
+ elem,
2011
+ t__namespace.arrowFunctionExpression(
2012
+ [],
2013
+ t__namespace.isJSXEmptyExpression(value.expression)
2014
+ ? t__namespace.booleanLiteral(true)
2015
+ : value.expression
2016
+ )
2017
+ ])
2018
+ )
2019
+ );
2020
+ } else if (key === "children") {
2021
+ children = value;
2022
+ } else if (
2023
+ config.effectWrapper &&
2024
+ isDynamic(attribute.get("value").get("expression"), {
2025
+ checkMember: true
2026
+ })
2027
+ ) {
2028
+ results.dynamics.push({ elem, key, value: value.expression });
2029
+ } else {
2030
+ results.exprs.push(
2031
+ t__namespace.expressionStatement(setAttr(attribute, elem, key, value.expression))
2032
+ );
2033
+ }
2034
+ } else {
2035
+ results.exprs.push(t__namespace.expressionStatement(setAttr(attribute, elem, key, value)));
2036
+ }
2037
+ });
2038
+ if (!hasChildren && children) {
2039
+ path.node.children.push(children);
2040
+ }
2041
+ }
2042
+
2043
+ function setAttr(path, elem, name, value, { prevId } = {}) {
2044
+ registerImportMethod(path, "setProp");
2045
+ if (!value) value = t__namespace.booleanLiteral(true);
2046
+ return t__namespace.callExpression(
2047
+ t__namespace.identifier("_$setProp"),
2048
+ prevId ? [elem, t__namespace.stringLiteral(name), value, prevId] : [elem, t__namespace.stringLiteral(name), value]
2049
+ );
2050
+ }
2051
+
2052
+ function transformChildren(path, results) {
2053
+ const filteredChildren = filterChildren(path.get("children")),
2054
+ multi = checkLength(filteredChildren),
2055
+ childNodes = filteredChildren.map(transformNode).reduce((memo, child) => {
2056
+ if (!child) return memo;
2057
+ const i = memo.length;
2058
+ if (child.text && i && memo[i - 1].text) {
2059
+ memo[i - 1].template += child.template;
2060
+ } else memo.push(child);
2061
+ return memo;
2062
+ }, []);
2063
+
2064
+ const appends = [];
2065
+ childNodes.forEach((child, index) => {
2066
+ if (!child) return;
2067
+ if (child.id) {
2068
+ registerImportMethod(path, "insertNode");
2069
+ let insert = child.id;
2070
+ if (child.text) {
2071
+ registerImportMethod(path, "createTextNode");
2072
+ if (multi) {
2073
+ results.decl.push(
2074
+ t__namespace.variableDeclarator(
2075
+ child.id,
2076
+ t__namespace.callExpression(t__namespace.identifier("_$createTextNode"), [
2077
+ t__namespace.stringLiteral(htmlEntities.decode(child.template))
2078
+ ])
2079
+ )
2080
+ );
2081
+ } else
2082
+ insert = t__namespace.callExpression(t__namespace.identifier("_$createTextNode"), [
2083
+ t__namespace.stringLiteral(htmlEntities.decode(child.template))
2084
+ ]);
2085
+ }
2086
+ appends.push(
2087
+ t__namespace.expressionStatement(t__namespace.callExpression(t__namespace.identifier("_$insertNode"), [results.id, insert]))
2088
+ );
2089
+ results.decl.push(...child.decl);
2090
+ results.exprs.push(...child.exprs);
2091
+ results.dynamics.push(...child.dynamics);
2092
+ } else if (child.exprs.length) {
2093
+ registerImportMethod(path, "insert");
2094
+ if (multi) {
2095
+ results.exprs.push(
2096
+ t__namespace.expressionStatement(
2097
+ t__namespace.callExpression(t__namespace.identifier("_$insert"), [
2098
+ results.id,
2099
+ child.exprs[0],
2100
+ nextChild(childNodes, index) || t__namespace.nullLiteral()
2101
+ ])
2102
+ )
2103
+ );
2104
+ } else {
2105
+ results.exprs.push(
2106
+ t__namespace.expressionStatement(
2107
+ t__namespace.callExpression(t__namespace.identifier("_$insert"), [results.id, child.exprs[0]])
2108
+ )
2109
+ );
2110
+ }
2111
+ }
2112
+ });
2113
+ results.exprs.unshift(...appends);
2114
+ }
2115
+
2116
+ function nextChild(children, index) {
2117
+ return children[index + 1] && (children[index + 1].id || nextChild(children, index + 1));
2118
+ }
2119
+
2120
+ function createTemplate(path, result, wrap) {
2121
+ const config = getConfig(path);
2122
+ if (result.id) {
2123
+ result.decl = t__namespace.variableDeclaration("const", result.decl);
2124
+ if (
2125
+ !(result.exprs.length || result.dynamics.length || result.postExprs.length) &&
2126
+ result.decl.declarations.length === 1
2127
+ ) {
2128
+ return result.decl.declarations[0].init;
2129
+ } else {
2130
+ return t__namespace.callExpression(
2131
+ t__namespace.arrowFunctionExpression(
2132
+ [],
2133
+ t__namespace.blockStatement([
2134
+ result.decl,
2135
+ ...result.exprs.concat(
2136
+ wrapDynamics(path, result.dynamics) || [],
2137
+ result.postExprs || []
2138
+ ),
2139
+ t__namespace.returnStatement(result.id)
2140
+ ])
2141
+ ),
2142
+ []
2143
+ );
2144
+ }
2145
+ }
2146
+ if (wrap && result.dynamic && config.memoWrapper) {
2147
+ registerImportMethod(path, config.memoWrapper);
2148
+ return t__namespace.callExpression(t__namespace.identifier(`_$${config.memoWrapper}`), [result.exprs[0]]);
2149
+ }
2150
+ return result.exprs[0];
2151
+ }
2152
+
2153
+ function wrapDynamics(path, dynamics) {
2154
+ if (!dynamics.length) return;
2155
+ const config = getConfig(path);
2156
+ registerImportMethod(path, config.effectWrapper);
2157
+
2158
+ const effectWrapperId = `_$${config.effectWrapper}`;
2159
+
2160
+ if (dynamics.length === 1) {
2161
+ const prevValue = t__namespace.identifier("_$p");
2162
+
2163
+ return t__namespace.expressionStatement(
2164
+ t__namespace.callExpression(t__namespace.identifier(effectWrapperId), [
2165
+ t__namespace.arrowFunctionExpression(
2166
+ [prevValue],
2167
+ setAttr(path, dynamics[0].elem, dynamics[0].key, dynamics[0].value, {
2168
+ dynamic: true,
2169
+ prevId: prevValue
2170
+ })
2171
+ )
2172
+ ])
2173
+ );
2174
+ }
2175
+ const decls = [],
2176
+ statements = [],
2177
+ identifiers = [],
2178
+ prevId = t__namespace.identifier("_p$");
2179
+ dynamics.forEach(({ elem, key, value }) => {
2180
+ const identifier = path.scope.generateUidIdentifier("v$");
2181
+ identifiers.push(identifier);
2182
+ decls.push(t__namespace.variableDeclarator(identifier, value));
2183
+ const prev = t__namespace.memberExpression(prevId, identifier);
2184
+ statements.push(
2185
+ t__namespace.expressionStatement(
2186
+ t__namespace.logicalExpression(
2187
+ "&&",
2188
+ t__namespace.binaryExpression("!==", identifier, t__namespace.memberExpression(prevId, identifier)),
2189
+ t__namespace.assignmentExpression("=", t__namespace.memberExpression(prevId, identifier), setAttr(
2190
+ path,
2191
+ elem,
2192
+ key,
2193
+ identifier,
2194
+ { dynamic: true, prevId: prev }
2195
+ ))
2196
+ )
2197
+ )
2198
+ );
2199
+ });
2200
+
2201
+ return t__namespace.expressionStatement(
2202
+ t__namespace.callExpression(t__namespace.identifier(effectWrapperId), [
2203
+ t__namespace.arrowFunctionExpression(
2204
+ [prevId],
2205
+ t__namespace.blockStatement([
2206
+ t__namespace.variableDeclaration("const", decls),
2207
+ ...statements,
2208
+ t__namespace.returnStatement(prevId)
2209
+ ])
2210
+ ),
2211
+ t__namespace.objectExpression(identifiers.map(id => t__namespace.objectProperty(id, t__namespace.identifier("undefined"))))
2212
+ ])
2213
+ );
2214
+ }
2215
+
1868
2216
  function transformComponent(path) {
1869
- let props = [],
2217
+ let exprs = [],
2218
+ config = getConfig(path),
2219
+ tagName = getTagName(path.node),
2220
+ props = [],
1870
2221
  runningObject = [],
1871
- exprs = [],
1872
- tagName = getTagName(path.node);
2222
+ dynamicSpread = false,
2223
+ hasChildren = path.node.children.length > 0;
1873
2224
 
1874
2225
  if (config.builtIns.indexOf(tagName) > -1 && !path.scope.hasBinding(tagName)) {
1875
2226
  registerImportMethod(path, tagName);
@@ -1886,25 +2237,37 @@ function transformComponent(path) {
1886
2237
  props.push(t__namespace.objectExpression(runningObject));
1887
2238
  runningObject = [];
1888
2239
  }
1889
- props.push(node.argument);
2240
+ props.push(
2241
+ isDynamic(attribute.get("argument"), {
2242
+ checkMember: true
2243
+ }) && (dynamicSpread = true)
2244
+ ? t__namespace.isCallExpression(node.argument) && !node.argument.arguments.length
2245
+ ? node.argument.callee
2246
+ : t__namespace.arrowFunctionExpression([], node.argument)
2247
+ : node.argument
2248
+ );
1890
2249
  } else {
1891
2250
  const value = node.value || t__namespace.booleanLiteral(true),
1892
2251
  key = t__namespace.isJSXNamespacedName(node.name)
1893
2252
  ? `${node.name.namespace.name}:${node.name.name.name}`
1894
2253
  : node.name.name,
1895
2254
  wrapName = t__namespace.isValidIdentifier(key) ? t__namespace.identifier : t__namespace.stringLiteral;
2255
+ if (hasChildren && key === "children") return;
1896
2256
  if (t__namespace.isJSXExpressionContainer(value))
1897
2257
  if (key === "ref") {
1898
2258
  if (config.generate === "ssr") return;
1899
2259
  // Normalize expressions for non-null and type-as
1900
- while (t__namespace.isTSNonNullExpression(value.expression) || t__namespace.isTSAsExpression(value.expression)) {
2260
+ while (
2261
+ t__namespace.isTSNonNullExpression(value.expression) ||
2262
+ t__namespace.isTSAsExpression(value.expression)
2263
+ ) {
1901
2264
  value.expression = value.expression.expression;
1902
2265
  }
1903
2266
  let binding,
1904
- isFunction =
1905
- t__namespace.isIdentifier(value.expression) &&
1906
- (binding = path.scope.getBinding(value.expression.name)) &&
1907
- binding.kind === "const";
2267
+ isFunction =
2268
+ t__namespace.isIdentifier(value.expression) &&
2269
+ (binding = path.scope.getBinding(value.expression.name)) &&
2270
+ binding.kind === "const";
1908
2271
  if (!isFunction && t__namespace.isLVal(value.expression)) {
1909
2272
  const refIdentifier = path.scope.generateUidIdentifier("_ref$");
1910
2273
  runningObject.push(
@@ -1969,12 +2332,8 @@ function transformComponent(path) {
1969
2332
  config.generate !== "ssr" &&
1970
2333
  (t__namespace.isLogicalExpression(value.expression) ||
1971
2334
  t__namespace.isConditionalExpression(value.expression))
1972
- ? transformCondition(attribute.get("value").get("expression"))
2335
+ ? transformCondition(attribute.get("value").get("expression"), true)
1973
2336
  : t__namespace.arrowFunctionExpression([], value.expression);
1974
- if (expr.length > 1) {
1975
- exprs.push(expr[0]);
1976
- expr = expr[1];
1977
- }
1978
2337
  runningObject.push(
1979
2338
  t__namespace.objectMethod(
1980
2339
  "get",
@@ -1989,7 +2348,7 @@ function transformComponent(path) {
1989
2348
  }
1990
2349
  });
1991
2350
 
1992
- const childResult = transformComponentChildren(path.get("children"));
2351
+ const childResult = transformComponentChildren(path.get("children"), config);
1993
2352
  if (childResult && childResult[0]) {
1994
2353
  if (childResult[1]) {
1995
2354
  const body =
@@ -2008,7 +2367,7 @@ function transformComponent(path) {
2008
2367
  }
2009
2368
  if (runningObject.length || !props.length) props.push(t__namespace.objectExpression(runningObject));
2010
2369
 
2011
- if (props.length > 1) {
2370
+ if (props.length > 1 || dynamicSpread) {
2012
2371
  registerImportMethod(path, "mergeProps");
2013
2372
  props = [t__namespace.callExpression(t__namespace.identifier("_$mergeProps"), props)];
2014
2373
  }
@@ -2029,15 +2388,20 @@ function transformComponent(path) {
2029
2388
  return { exprs, template: "", component: true };
2030
2389
  }
2031
2390
 
2032
- function transformComponentChildren(children) {
2033
- const createTemplate$2 = config.generate === "ssr" ? createTemplate : createTemplate$1,
2391
+ function transformComponentChildren(children, config) {
2392
+ const createTemplate$3 =
2393
+ config.generate === "universal"
2394
+ ? createTemplate
2395
+ : config.generate === "ssr"
2396
+ ? createTemplate$1
2397
+ : createTemplate$2,
2034
2398
  filteredChildren = filterChildren(children);
2035
2399
  if (!filteredChildren.length) return;
2036
2400
  let dynamic = false;
2037
2401
 
2038
2402
  let transformedChildren = filteredChildren.reduce((memo, path) => {
2039
2403
  if (t__namespace.isJSXText(path.node)) {
2040
- const v = htmlEntities.decode(trimWhitespace(path.node.extra.raw));
2404
+ const v = htmlEntities.decode(trimWhitespace(path.node.extra.raw));
2041
2405
  if (v.length) memo.push(t__namespace.stringLiteral(v));
2042
2406
  } else {
2043
2407
  const child = transformNode(path, {
@@ -2045,7 +2409,7 @@ function transformComponentChildren(children) {
2045
2409
  componentChild: true
2046
2410
  });
2047
2411
  dynamic = dynamic || child.dynamic;
2048
- memo.push(createTemplate$2(path, child, filteredChildren.length > 1));
2412
+ memo.push(createTemplate$3(path, child, filteredChildren.length > 1));
2049
2413
  }
2050
2414
  return memo;
2051
2415
  }, []);
@@ -2072,8 +2436,13 @@ function transformComponentChildren(children) {
2072
2436
  return [transformedChildren, dynamic];
2073
2437
  }
2074
2438
 
2075
- function transformFragmentChildren(children, results) {
2076
- const createTemplate$2 = config.generate === "ssr" ? createTemplate : createTemplate$1,
2439
+ function transformFragmentChildren(children, results, config) {
2440
+ const createTemplate$3 =
2441
+ config.generate === "universal"
2442
+ ? createTemplate
2443
+ : config.generate === "ssr"
2444
+ ? createTemplate$1
2445
+ : createTemplate$2,
2077
2446
  filteredChildren = filterChildren(children),
2078
2447
  singleChild = filteredChildren.length === 1,
2079
2448
  childNodes = filteredChildren.reduce((memo, path) => {
@@ -2082,15 +2451,15 @@ function transformFragmentChildren(children, results) {
2082
2451
  if (v.length) memo.push(t__namespace.stringLiteral(v));
2083
2452
  } else {
2084
2453
  const child = transformNode(path, { topLevel: true, fragmentChild: true });
2085
- memo.push(createTemplate$2(path, child, !singleChild));
2454
+ memo.push(createTemplate$3(path, child, !singleChild));
2086
2455
  }
2087
2456
  return memo;
2088
2457
  }, []);
2089
2458
  results.exprs.push(singleChild ? childNodes[0] : t__namespace.arrayExpression(childNodes));
2090
2459
  }
2091
2460
 
2092
- function transformJSX(path, { opts }) {
2093
- Object.assign(config, opts);
2461
+ function transformJSX(path) {
2462
+ const config = getConfig(path);
2094
2463
  const replace = transformThis(path);
2095
2464
  const result = transformNode(
2096
2465
  path,
@@ -2100,7 +2469,12 @@ function transformJSX(path, { opts }) {
2100
2469
  topLevel: true
2101
2470
  }
2102
2471
  );
2103
- const template = config.generate === "ssr" ? createTemplate : createTemplate$1;
2472
+ const template =
2473
+ config.generate === "universal"
2474
+ ? createTemplate
2475
+ : config.generate === "ssr"
2476
+ ? createTemplate$1
2477
+ : createTemplate$2;
2104
2478
  path.replaceWith(replace(template(path, result, false)));
2105
2479
  }
2106
2480
 
@@ -2128,16 +2502,22 @@ function transformThis(path) {
2128
2502
  }
2129
2503
 
2130
2504
  function transformNode(path, info = {}) {
2505
+ const config = getConfig(path);
2131
2506
  const node = path.node;
2132
2507
  let staticValue;
2133
2508
  if (t__namespace.isJSXElement(node)) {
2134
2509
  let tagName = getTagName(node);
2135
2510
  if (isComponent(tagName)) return transformComponent(path);
2136
- const element = config.generate === "ssr" ? transformElement : transformElement$1;
2511
+ const element =
2512
+ config.generate === "universal"
2513
+ ? transformElement
2514
+ : config.generate === "ssr"
2515
+ ? transformElement$1
2516
+ : transformElement$2;
2137
2517
  return element(path, info);
2138
2518
  } else if (t__namespace.isJSXFragment(node)) {
2139
2519
  let results = { template: "", decl: [], exprs: [], dynamics: [] };
2140
- transformFragmentChildren(path.get("children"), results);
2520
+ transformFragmentChildren(path.get("children"), results, config);
2141
2521
  return results;
2142
2522
  } else if (t__namespace.isJSXText(node) || (staticValue = getStaticExpression(path))) {
2143
2523
  const text =
@@ -2173,7 +2553,7 @@ function transformNode(path, info = {}) {
2173
2553
  config.wrapConditionals &&
2174
2554
  config.generate !== "ssr" &&
2175
2555
  (t__namespace.isLogicalExpression(node.expression) || t__namespace.isConditionalExpression(node.expression))
2176
- ? transformCondition(path.get("expression"))
2556
+ ? transformCondition(path.get("expression"), info.componentChild)
2177
2557
  : !info.componentChild &&
2178
2558
  (config.generate !== "ssr" || info.fragmentChild) &&
2179
2559
  t__namespace.isCallExpression(node.expression) &&
@@ -2216,6 +2596,7 @@ function transformNode(path, info = {}) {
2216
2596
 
2217
2597
  // add to the top/bottom of the module.
2218
2598
  var postprocess = path => {
2599
+ const config = getConfig(path);
2219
2600
  if (path.scope.data.events) {
2220
2601
  registerImportMethod(path, "delegateEvents");
2221
2602
  path.node.body.push(
@@ -2232,7 +2613,23 @@ var postprocess = path => {
2232
2613
  }
2233
2614
  };
2234
2615
 
2235
- var preprocess = path => {
2616
+ var config = {
2617
+ moduleName: "dom",
2618
+ generate: "dom",
2619
+ hydratable: false,
2620
+ delegateEvents: true,
2621
+ delegatedEvents: [],
2622
+ builtIns: [],
2623
+ requireImportSource: false,
2624
+ wrapConditionals: true,
2625
+ contextToCustomElements: false,
2626
+ staticMarker: "@once",
2627
+ effectWrapper: "effect",
2628
+ memoWrapper: "memo"
2629
+ };
2630
+
2631
+ var preprocess = (path, { opts }) => {
2632
+ path.hub.file.metadata.config = Object.assign({}, config, opts);
2236
2633
  const lib = config.requireImportSource;
2237
2634
  if (lib) {
2238
2635
  const comments = path.hub.file.ast.comments;
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.29.19",
4
+ "version": "0.30.6",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,5 +23,5 @@
23
23
  "@babel/types": "^7.11.5",
24
24
  "html-entities": "2.3.2"
25
25
  },
26
- "gitHead": "93a44cd3e222afc855780f32ab28c098452922a5"
26
+ "gitHead": "a2cc48a877bd4edff32f398c6c84d0b7bf6d584e"
27
27
  }