@builder.io/mitosis 0.5.35 → 0.5.36
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.
|
@@ -912,6 +912,8 @@ function convertExportDefaultToReturn(code) {
|
|
|
912
912
|
try {
|
|
913
913
|
const { types } = babel;
|
|
914
914
|
const body = (0, parsers_1.parseCode)(code);
|
|
915
|
+
if (body.length === 0)
|
|
916
|
+
return code;
|
|
915
917
|
const newBody = body.slice();
|
|
916
918
|
for (let i = 0; i < body.length; i++) {
|
|
917
919
|
const statement = body[i];
|
|
@@ -273,11 +273,9 @@ const jsxElementToJson = (node) => {
|
|
|
273
273
|
// <Foo myProp={"hello"} />
|
|
274
274
|
memo.properties[key] = expression.value;
|
|
275
275
|
}
|
|
276
|
-
else if (types.isArrowFunctionExpression(expression)) {
|
|
276
|
+
else if (key.startsWith('on') && types.isArrowFunctionExpression(expression)) {
|
|
277
277
|
// <Foo myProp={() => {}} />
|
|
278
|
-
const args =
|
|
279
|
-
? expression.params.map((node) => node === null || node === void 0 ? void 0 : node.name)
|
|
280
|
-
: [];
|
|
278
|
+
const args = expression.params.map((node) => node === null || node === void 0 ? void 0 : node.name);
|
|
281
279
|
memo.bindings[key] = (0, bindings_1.createSingleBinding)({
|
|
282
280
|
code: (0, generator_1.default)(expression.body, { compact: true }).code,
|
|
283
281
|
async: expression.async === true ? true : undefined,
|