Skip to content

Commit 1da6fb7

Browse files
committed
Remove an unused array
1 parent 477c211 commit 1da6fb7

File tree

1 file changed

+14
-13
lines changed
  • packages/babel-plugin-transform-jsx-to-tagged-templates/src

1 file changed

+14
-13
lines changed

packages/babel-plugin-transform-jsx-to-tagged-templates/src/index.mjs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ export default function jsxToTaggedTemplatesBabelPlugin({ types: t }, options =
5353
const open = node.openingElement;
5454
const { name } = open.name;
5555

56-
const toProcess = [];
57-
5856
if (name.match(/^[A-Z]/)) {
5957
raw('<');
6058
expr(t.identifier(name));
@@ -90,21 +88,24 @@ export default function jsxToTaggedTemplatesBabelPlugin({ types: t }, options =
9088
}
9189
}
9290

93-
const children = t.react.buildChildren(node);
94-
if (htmlOutput || children && children.length !== 0) {
91+
if (htmlOutput || node.children && node.children.length !== 0) {
9592
raw('>');
96-
for (let i = 0; i < children.length; i++) {
97-
let child = children[i];
98-
if (t.isStringLiteral(child)) {
93+
for (let i = 0; i < node.children.length; i++) {
94+
let child = node.children[i];
95+
if (t.isJSXText(child)) {
9996
// @todo - expose `whitespace: true` option?
100-
raw(child.value);
101-
}
102-
else if (t.isJSXElement(child)) {
103-
processNode(child);
97+
raw(child.value.trim());
10498
}
10599
else {
106-
expr(child);
107-
toProcess.push(child);
100+
if (t.isJSXExpressionContainer(child)) {
101+
child = child.expression;
102+
}
103+
if (t.isJSXElement(child)) {
104+
processNode(child);
105+
}
106+
else {
107+
expr(child);
108+
}
108109
}
109110
}
110111

0 commit comments

Comments
 (0)