| 640 | Program: { |
| 641 | exit(path) { |
| 642 | let process = (specifiers, importKind) => { |
| 643 | for (let lib in specifiers) { |
| 644 | let names = specifiers[lib]; |
| 645 | if (names.length > 0) { |
| 646 | let monopackage = |
| 647 | lib === '@react-spectrum' ? '@adobe/react-spectrum' : lib.slice(1); |
| 648 | let literal = t.stringLiteral(monopackage); |
| 649 | |
| 650 | let decl = t.importDeclaration( |
| 651 | names.map(s => t.importSpecifier(t.identifier(s), t.identifier(s))), |
| 652 | literal |
| 653 | ); |
| 654 | |
| 655 | decl.importKind = importKind; |
| 656 | path.unshiftContainer('body', [decl]); |
| 657 | } |
| 658 | } |
| 659 | }; |
| 660 | |
| 661 | process(specifiers, 'value'); |
| 662 | process(typeSpecifiers, 'type'); |