Skip to content

Commit 02ff14a

Browse files
committed
fix ImportExportTranspiler to generate expression statements instead of raw calls
1 parent 724d2f3 commit 02ff14a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/cubejs-schema-compiler/src/compiler/transpilers/ImportExportTranspiler.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ export class ImportExportTranspiler implements TranspilerInterface {
6969

7070
path.replaceWithMultiple([
7171
decl.node,
72-
t.callExpression(t.identifier('addExport'), [
72+
t.expressionStatement(t.callExpression(t.identifier('addExport'), [
7373
t.objectExpression([t.objectProperty(name, name)])
74-
])
74+
]))
7575
]);
7676
return;
7777
}
@@ -80,12 +80,12 @@ export class ImportExportTranspiler implements TranspilerInterface {
8080
if (t.isVariableDeclaration(decl.node)) {
8181
path.replaceWithMultiple([
8282
decl.node,
83-
t.callExpression(t.identifier('addExport'), [
83+
t.expressionStatement(t.callExpression(t.identifier('addExport'), [
8484
t.objectExpression(
8585
// @ts-ignore
8686
decl.get('declarations').map(d => t.objectProperty(d.get('id').node, d.get('id').node))
8787
)
88-
])
88+
]))
8989
]);
9090
return;
9191
}
@@ -97,12 +97,12 @@ export class ImportExportTranspiler implements TranspilerInterface {
9797
return;
9898
}
9999

100-
const addExportCall = t.callExpression(t.identifier('addExport'), [t.objectExpression(<t.ObjectProperty[]>declarations)]);
100+
const addExportCall = t.expressionStatement(t.callExpression(t.identifier('addExport'), [t.objectExpression(<t.ObjectProperty[]>declarations)]));
101101
path.replaceWith(addExportCall);
102102
},
103103
ExportDefaultDeclaration(path) {
104104
// @ts-ignore
105-
path.replaceWith(t.callExpression(t.identifier('setExport'), [path.get('declaration').node]));
105+
path.replaceWith(t.expressionStatement(t.callExpression(t.identifier('setExport'), [path.get('declaration').node])));
106106
}
107107
};
108108
}

0 commit comments

Comments
 (0)