MCPcopy Index your code
hub / github.com/adobe/react-spectrum / removeDuplicateImports

Function removeDuplicateImports

scripts/extractStarter.mjs:496–508  ·  view source on GitHub ↗

Removes duplicate import statements from a babel ast.

(ast)

Source from the content-addressed store, hash-verified

494
495/** Removes duplicate import statements from a babel ast. */
496function 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. */
511function removeCircularDeps(file, seen = new Set()) {

Callers 2

processJSFunction · 0.85
generateStoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected