| 279 | } |
| 280 | |
| 281 | function pushModule( |
| 282 | source: string, |
| 283 | key: "imports" | "exports", |
| 284 | specifiers: t.ModuleSpecifier[] | t.ExportAllDeclaration, |
| 285 | ) { |
| 286 | let module: ModuleMetadata | undefined; |
| 287 | modules.forEach(function (m) { |
| 288 | if (m.key === source) { |
| 289 | module = m; |
| 290 | } |
| 291 | }); |
| 292 | if (!module) { |
| 293 | modules.push( |
| 294 | (module = { key: source, imports: [], exports: [] }), |
| 295 | ); |
| 296 | } |
| 297 | module[key] = module[key].concat(specifiers); |
| 298 | } |
| 299 | |
| 300 | function buildExportCall(name: string, val: t.Expression) { |
| 301 | return t.expressionStatement( |