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