Removes duplicate import statements from a babel ast.
(ast)
| 494 | |
| 495 | /** Removes duplicate import statements from a babel ast. */ |
| 496 | function removeDuplicateImports(ast) { |
| 497 | let declared = new Set(); |
| 498 | traverse.default(ast, { |
| 499 | noScope: true, |
| 500 | ImportSpecifier(specifier) { |
| 501 | if (declared.has(specifier.node.local.name)) { |
| 502 | specifier.remove(); |
| 503 | } else { |
| 504 | declared.add(specifier.node.local.name); |
| 505 | } |
| 506 | } |
| 507 | }); |
| 508 | } |
| 509 | |
| 510 | /** Removes circular dependencies from the CSS, which breaks webpack. */ |
| 511 | function removeCircularDeps(file, seen = new Set()) { |
no outgoing calls
no test coverage detected