Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jsx.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.JSXAttribute = JSXAttribute;
  6. exports.JSXIdentifier = JSXIdentifier;
  7. exports.JSXNamespacedName = JSXNamespacedName;
  8. exports.JSXMemberExpression = JSXMemberExpression;
  9. exports.JSXSpreadAttribute = JSXSpreadAttribute;
  10. exports.JSXExpressionContainer = JSXExpressionContainer;
  11. exports.JSXSpreadChild = JSXSpreadChild;
  12. exports.JSXText = JSXText;
  13. exports.JSXElement = JSXElement;
  14. exports.JSXOpeningElement = JSXOpeningElement;
  15. exports.JSXClosingElement = JSXClosingElement;
  16. exports.JSXEmptyExpression = JSXEmptyExpression;
  17. exports.JSXFragment = JSXFragment;
  18. exports.JSXOpeningFragment = JSXOpeningFragment;
  19. exports.JSXClosingFragment = JSXClosingFragment;
  20. var t = require("@babel/types");
  21. function JSXAttribute(node) {
  22. this.print(node.name, node);
  23. if (node.value) {
  24. this.token("=");
  25. this.print(node.value, node);
  26. }
  27. }
  28. function JSXIdentifier(node) {
  29. this.word(node.name);
  30. }
  31. function JSXNamespacedName(node) {
  32. this.print(node.namespace, node);
  33. this.token(":");
  34. this.print(node.name, node);
  35. }
  36. function JSXMemberExpression(node) {
  37. this.print(node.object, node);
  38. this.token(".");
  39. this.print(node.property, node);
  40. }
  41. function JSXSpreadAttribute(node) {
  42. this.token("{");
  43. this.token("...");
  44. this.print(node.argument, node);
  45. this.token("}");
  46. }
  47. function JSXExpressionContainer(node) {
  48. this.token("{");
  49. this.print(node.expression, node);
  50. this.token("}");
  51. }
  52. function JSXSpreadChild(node) {
  53. this.token("{");
  54. this.token("...");
  55. this.print(node.expression, node);
  56. this.token("}");
  57. }
  58. function JSXText(node) {
  59. const raw = this.getPossibleRaw(node);
  60. if (raw != null) {
  61. this.token(raw);
  62. } else {
  63. this.token(node.value);
  64. }
  65. }
  66. function JSXElement(node) {
  67. const open = node.openingElement;
  68. this.print(open, node);
  69. if (open.selfClosing) return;
  70. this.indent();
  71. for (const child of node.children) {
  72. this.print(child, node);
  73. }
  74. this.dedent();
  75. this.print(node.closingElement, node);
  76. }
  77. function spaceSeparator() {
  78. this.space();
  79. }
  80. function JSXOpeningElement(node) {
  81. this.token("<");
  82. this.print(node.name, node);
  83. this.print(node.typeParameters, node);
  84. if (node.attributes.length > 0) {
  85. this.space();
  86. this.printJoin(node.attributes, node, {
  87. separator: spaceSeparator
  88. });
  89. }
  90. if (node.selfClosing) {
  91. this.space();
  92. this.token("/>");
  93. } else {
  94. this.token(">");
  95. }
  96. }
  97. function JSXClosingElement(node) {
  98. this.token("</");
  99. this.print(node.name, node);
  100. this.token(">");
  101. }
  102. function JSXEmptyExpression(node) {
  103. this.printInnerComments(node);
  104. }
  105. function JSXFragment(node) {
  106. this.print(node.openingFragment, node);
  107. this.indent();
  108. for (const child of node.children) {
  109. this.print(child, node);
  110. }
  111. this.dedent();
  112. this.print(node.closingFragment, node);
  113. }
  114. function JSXOpeningFragment() {
  115. this.token("<");
  116. this.token(">");
  117. }
  118. function JSXClosingFragment() {
  119. this.token("</");
  120. this.token(">");
  121. }