| 287 | } |
| 288 | |
| 289 | function pushModule( |
| 290 | source: string, |
| 291 | key: "imports" | "exports", |
| 292 | specifiers: t.ModuleSpecifier[] | t.ExportAllDeclaration, |
| 293 | ) { |
| 294 | let module: ModuleMetadata | undefined; |
| 295 | modules.forEach(function (m) { |
| 296 | if (m.key === source) { |
| 297 | module = m; |
| 298 | } |
| 299 | }); |
| 300 | if (!module) { |
| 301 | modules.push( |
| 302 | (module = { key: source, imports: [], exports: [] }), |
| 303 | ); |
| 304 | } |
| 305 | module[key] = module[key].concat(specifiers); |
| 306 | } |
| 307 | |
| 308 | function buildExportCall(name: string, val: t.Expression) { |
| 309 | return t.expressionStatement( |