File tree Expand file tree Collapse file tree 7 files changed +12
-11
lines changed
src/transforms/v2-to-v3/utils Expand file tree Collapse file tree 7 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 11import { Collection , JSCodeshift } from "jscodeshift" ;
22
3- import { containsRequire } from "../containsRequire " ;
3+ import { hasRequire } from "../has " ;
44import { addV3ClientImports } from "./addV3ClientImports" ;
55import { addV3ClientRequires } from "./addV3ClientRequires" ;
66
@@ -17,6 +17,6 @@ export const addV3ClientModules = (
1717 source : Collection < unknown > ,
1818 options : AddV3ClientModulesOptions
1919) : void =>
20- containsRequire ( j , source )
20+ hasRequire ( j , source )
2121 ? addV3ClientRequires ( j , source , options )
2222 : addV3ClientImports ( j , source , options ) ;
Original file line number Diff line number Diff line change 11import { Collection , JSCodeshift } from "jscodeshift" ;
22
33import { CLIENT_NAMES } from "../config" ;
4- import { containsRequire } from "../containsRequire " ;
4+ import { hasRequire } from "../has " ;
55import { getImportIdentifierName } from "./getImportIdentifierName" ;
66import { getRequireIdentifierName } from "./getRequireIdentifierName" ;
77import { getV2ServiceModulePath } from "./getV2ServiceModulePath" ;
@@ -10,7 +10,7 @@ export const getV2ClientNamesRecord = (
1010 j : JSCodeshift ,
1111 source : Collection < unknown >
1212) : Record < string , string > => {
13- const getIdentifierNameFn = containsRequire ( j , source )
13+ const getIdentifierNameFn = hasRequire ( j , source )
1414 ? getRequireIdentifierName
1515 : getImportIdentifierName ;
1616
Original file line number Diff line number Diff line change 11import { Collection , JSCodeshift } from "jscodeshift" ;
22
33import { PACKAGE_NAME } from "../config" ;
4- import { containsRequire } from "../containsRequire " ;
4+ import { hasRequire } from "../has " ;
55import { getImportIdentifierName } from "./getImportIdentifierName" ;
66import { getRequireIdentifierName } from "./getRequireIdentifierName" ;
77
88export const getV2GlobalName = (
99 j : JSCodeshift ,
1010 source : Collection < unknown >
1111) : string | undefined => {
12- if ( containsRequire ( j , source ) ) {
12+ if ( hasRequire ( j , source ) ) {
1313 return getRequireIdentifierName ( j , source , PACKAGE_NAME ) ;
1414 }
1515 return getImportIdentifierName ( j , source , PACKAGE_NAME ) ;
Original file line number Diff line number Diff line change 11import { Collection , JSCodeshift } from "jscodeshift" ;
22
3- export const containsRequire = ( j : JSCodeshift , source : Collection < unknown > ) =>
3+ export const hasRequire = ( j : JSCodeshift , source : Collection < unknown > ) =>
44 source
55 . find ( j . CallExpression , {
66 callee : { type : "Identifier" , name : "require" } ,
Original file line number Diff line number Diff line change 1+ export * from "./hasRequire" ;
Original file line number Diff line number Diff line change 11import { Collection , JSCodeshift } from "jscodeshift" ;
22
3- import { containsRequire } from "../containsRequire" ;
43import { getV2ClientTypeNames , getV2ServiceModulePath } from "../get" ;
4+ import { hasRequire } from "../has" ;
55import { isV2ClientInputOutputType } from "../isV2ClientInputOutputType" ;
66import { removeImportIdentifierName } from "./removeImportIdentifierName" ;
77import { removeRequireIdentifierName } from "./removeRequireIdentifierName" ;
@@ -24,7 +24,7 @@ export const removeV2ClientModule = (
2424 sourceValue,
2525 } ;
2626
27- if ( containsRequire ( j , source ) ) {
27+ if ( hasRequire ( j , source ) ) {
2828 removeRequireIdentifierName ( j , source , removeIdentifierNameOptions ) ;
2929 } else {
3030 removeImportIdentifierName ( j , source , removeIdentifierNameOptions ) ;
Original file line number Diff line number Diff line change 11import { Collection , JSCodeshift } from "jscodeshift" ;
22
33import { PACKAGE_NAME } from "../config" ;
4- import { containsRequire } from "../containsRequire " ;
4+ import { hasRequire } from "../has " ;
55import { removeImportIdentifierName } from "./removeImportIdentifierName" ;
66import { removeRequireIdentifierName } from "./removeRequireIdentifierName" ;
77
@@ -18,7 +18,7 @@ export const removeV2GlobalModule = (
1818 localName : v2GlobalName ,
1919 sourceValue : PACKAGE_NAME ,
2020 } ;
21- if ( containsRequire ( j , source ) ) {
21+ if ( hasRequire ( j , source ) ) {
2222 removeRequireIdentifierName ( j , source , removeIdentifierNameOptions ) ;
2323 } else {
2424 removeImportIdentifierName ( j , source , removeIdentifierNameOptions ) ;
You can’t perform that action at this time.
0 commit comments