import { API , FileInfo } from 'jscodeshift' ; export default function transformer ( file , api ) { const j = api . jscodeshift ; const root = j ( file . source ) ; root . find ( j . ImportDeclaration , { source : { value : '@workday/canvas-kit-react/tokens' } } ) . forEach ( importDeclaration => { const specifiers = importDeclaration . value . specifiers ; if ( specifiers ?. length === 1 ) { const specifier = specifiers [ 0 ] ; if ( specifier . type === 'ImportSpecifier' && specifier . imported . name === 'InputProvider' ) { importDeclaration . value . source . value = '@workday/canvas-kit-react/common' ; return ; } } specifiers ?. forEach ( ( specifier , index ) => { if ( specifier . type === 'ImportSpecifier' && specifier . imported . name === 'InputProvider' ) { importDeclaration . value . specifiers ?. splice ( specifiers ?. indexOf ( specifier ) , 1 ) ; importDeclaration . insertAfter ( j . importDeclaration ( [ j . importSpecifier ( j . identifier ( 'InputProvider' ) ) ] , j . stringLiteral ( '@workday/canvas-kit-react/common' ) ) ) ; } return specifier ; } ) ; } ) ; return root . toSource ( ) ; }