File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1- import jscodeshift from 'jscodeshift' ;
1+ import jscodeshift , { FileInfo } from 'jscodeshift' ;
22
33type Parser = 'babel' | 'babylon' | 'flow' | 'ts' | 'tsx' ;
44
@@ -8,15 +8,18 @@ interface Options {
88
99export default async function applyTransform (
1010 transform : any ,
11- input : string ,
11+ input : string | FileInfo ,
1212 options : Options = {
1313 parser : 'babel' ,
1414 } ,
1515) {
1616 // Handle ES6 modules using default export for the transform
1717 const transformer = transform . default ? transform . default : transform ;
18+
19+ const file = typeof input === 'string' ? { source : input } : input ;
20+
1821 const output = await transformer (
19- { source : input } ,
22+ file ,
2023 {
2124 jscodeshift : jscodeshift . withParser ( options . parser as string ) ,
2225 // eslint-disable-next-line @typescript-eslint/no-empty-function
You can’t perform that action at this time.
0 commit comments