@@ -192,18 +192,22 @@ export function transformModule(
192
192
imports . flatMap ( importStmt => importStmt . specifiers . map ( specifier => specifier . local . value ) )
193
193
) ;
194
194
const exportFromedNames = new Set (
195
- exportFroms . flatMap ( exportStmt => exportStmt . specifiers . map ( specifier => {
196
- if ( specifier . type === "ExportNamespaceSpecifier" ) {
197
- return specifier . name . value ;
198
- } else if ( specifier . type === "ExportDefaultSpecifier" ) {
199
- // When will this happen?
200
- return specifier . exported . value ;
201
- } else {
202
- return ( specifier . exported || specifier . orig ) . value ;
203
- }
204
- } ) )
195
+ exportFroms . flatMap ( exportStmt =>
196
+ exportStmt . specifiers . map ( specifier => {
197
+ if ( specifier . type === "ExportNamespaceSpecifier" ) {
198
+ return specifier . name . value ;
199
+ } else if ( specifier . type === "ExportDefaultSpecifier" ) {
200
+ // When will this happen?
201
+ return specifier . exported . value ;
202
+ } else {
203
+ return ( specifier . exported || specifier . orig ) . value ;
204
+ }
205
+ } )
206
+ )
207
+ ) ;
208
+ const exportedNamesDeclaration = makeVariablesDeclaration (
209
+ exportedNames . filter ( name => ! importedNames . has ( name ) && ! exportFromedNames . has ( name ) )
205
210
) ;
206
- const exportedNamesDeclaration = makeVariablesDeclaration ( exportedNames . filter ( name => ! importedNames . has ( name ) && ! exportFromedNames . has ( name ) ) ) ;
207
211
208
212
const warppedStatements = topLevelStatements . flatMap < SWC . Statement > ( stmt => {
209
213
if ( stmt . type === "VariableDeclaration" ) {
@@ -368,7 +372,12 @@ export function transformModule(
368
372
* export { ..., __tla };
369
373
*/
370
374
371
- const newTopLevel : SWC . ModuleItem [ ] = [ ...imports , ...newImportsByExportFroms , ...exportFroms , exportedNamesDeclaration ] ;
375
+ const newTopLevel : SWC . ModuleItem [ ] = [
376
+ ...imports ,
377
+ ...newImportsByExportFroms ,
378
+ ...exportFroms ,
379
+ exportedNamesDeclaration
380
+ ] ;
372
381
373
382
if ( exportedNames . length > 0 || bundleInfo [ moduleName ] ?. importedBy ?. length > 0 ) {
374
383
// If the chunk is being imported, append export of the TLA promise to export list
0 commit comments