File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
packages/app/src/sandbox/eval/transpilers/babel/convert-esmodule Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -4,17 +4,17 @@ exports[`convert-esmodule can convert class default exports 1`] = `
4
4
"Object.defineProperty(exports, \\ "__esModule\\ ", {
5
5
value : true
6
6
} );
7
- exports.default = A;
8
7
class A { }
8
+ exports.default = A;
9
9
"
10
10
` ;
11
11
12
12
exports [` convert-esmodule can convert default exports 1` ] = `
13
13
"Object.defineProperty(exports, \\ "__esModule\\ ", {
14
14
value : true
15
15
} );
16
- exports.default = test;
17
16
function test() { }
17
+ exports.default = test;
18
18
"
19
19
` ;
20
20
@@ -140,8 +140,8 @@ exports[`convert-esmodule handles export mutations 1`] = `
140
140
"Object.defineProperty(exports, \\ "__esModule\\ ", {
141
141
value : true
142
142
} );
143
- exports.default = test;
144
143
function test() { }
144
+ exports.default = test;
145
145
exports.default = test = 5;;
146
146
"
147
147
` ;
@@ -150,8 +150,8 @@ exports[`convert-esmodule handles export mutations with no named function 1`] =
150
150
"Object.defineProperty(exports, \\ "__esModule\\ ", {
151
151
value : true
152
152
} );
153
- exports.default = $csb__default;
154
153
function $csb__default() { }
154
+ exports.default = $csb__default;
155
155
"
156
156
` ;
157
157
Original file line number Diff line number Diff line change @@ -170,17 +170,18 @@ export function convertEsModule(code: string) {
170
170
name : varName ,
171
171
} ;
172
172
}
173
+
174
+ program . body [
175
+ i
176
+ ] = statement . declaration as meriyah . ESTree . DeclarationStatement ;
177
+ i ++ ;
178
+
173
179
program . body . splice (
174
180
i ,
175
181
0 ,
176
182
generateExportStatement ( statement . declaration . id . name , 'default' )
177
183
) ;
178
184
i ++ ;
179
-
180
- program . body [
181
- i
182
- ] = statement . declaration as meriyah . ESTree . DeclarationStatement ;
183
- i ++ ;
184
185
} else {
185
186
program . body [ i ] = {
186
187
type : n . VariableDeclaration ,
You can’t perform that action at this time.
0 commit comments