29 lines
737 B
JavaScript
29 lines
737 B
JavaScript
|
|
import movePropIntoSlots from '../utils/movePropIntoSlots';
|
||
|
|
import replaceComponentsWithSlots from '../utils/replaceComponentsWithSlots';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param {import('jscodeshift').FileInfo} file
|
||
|
|
* @param {import('jscodeshift').API} api
|
||
|
|
*/
|
||
|
|
export default function transformer(file, api, options) {
|
||
|
|
const j = api.jscodeshift;
|
||
|
|
const root = j(file.source);
|
||
|
|
const printOptions = options.printOptions;
|
||
|
|
|
||
|
|
replaceComponentsWithSlots(j, {
|
||
|
|
root,
|
||
|
|
packageName: options.packageName,
|
||
|
|
componentName: 'Backdrop',
|
||
|
|
});
|
||
|
|
|
||
|
|
movePropIntoSlots(j, {
|
||
|
|
root,
|
||
|
|
packageName: options.packageName,
|
||
|
|
componentName: 'Backdrop',
|
||
|
|
propName: 'TransitionComponent',
|
||
|
|
slotName: 'transition',
|
||
|
|
});
|
||
|
|
|
||
|
|
return root.toSource(printOptions);
|
||
|
|
}
|