11import type { namedTypes } from "ast-types" ;
22import type * as j from "jscodeshift" ;
3+
34import { reorderGenericArguments } from "./util/reorderGenericArguments.js" ;
45// {
56// // completely removed in AC4
@@ -180,8 +181,11 @@ export const renames: Array<IdentifierRename | ModuleRename> = [
180181 { from : "UseBackgroundQueryResult" , to : "Result" } ,
181182 ] . map (
182183 moveInto ( {
183- from : { module : "@apollo/client/react" } ,
184- to : { namespace : "useBackgroundQuery" } ,
184+ from : {
185+ module : "@apollo/client/react" ,
186+ alternativeModules : [ "@apollo/client" ] ,
187+ } ,
188+ to : { namespace : "useBackgroundQuery" , alternativeModules : [ ] } ,
185189 importType : "type" ,
186190 } )
187191 ) ,
@@ -193,8 +197,11 @@ export const renames: Array<IdentifierRename | ModuleRename> = [
193197 { from : "LazyQueryResultTuple" , to : "ResultTuple" } ,
194198 ] . map (
195199 moveInto ( {
196- from : { module : "@apollo/client/react" } ,
197- to : { namespace : "useLazyQuery" } ,
200+ from : {
201+ module : "@apollo/client/react" ,
202+ alternativeModules : [ "@apollo/client" ] ,
203+ } ,
204+ to : { namespace : "useLazyQuery" , alternativeModules : [ ] } ,
198205 importType : "type" ,
199206 } )
200207 ) ,
@@ -205,8 +212,11 @@ export const renames: Array<IdentifierRename | ModuleRename> = [
205212 { from : "UseLoadableQueryResult" , to : "Result" } ,
206213 ] . map (
207214 moveInto ( {
208- from : { module : "@apollo/client/react" } ,
209- to : { namespace : "useLoadableQuery" } ,
215+ from : {
216+ module : "@apollo/client/react" ,
217+ alternativeModules : [ "@apollo/client" ] ,
218+ } ,
219+ to : { namespace : "useLoadableQuery" , alternativeModules : [ ] } ,
210220 importType : "type" ,
211221 } )
212222 ) ,
@@ -228,8 +238,11 @@ export const renames: Array<IdentifierRename | ModuleRename> = [
228238 } ,
229239 ] . map (
230240 moveInto ( {
231- from : { module : "@apollo/client/react" } ,
232- to : { namespace : "useMutation" } ,
241+ from : {
242+ module : "@apollo/client/react" ,
243+ alternativeModules : [ "@apollo/client" ] ,
244+ } ,
245+ to : { namespace : "useMutation" , alternativeModules : [ ] } ,
233246 importType : "type" ,
234247 } )
235248 ) ,
@@ -244,8 +257,11 @@ export const renames: Array<IdentifierRename | ModuleRename> = [
244257 } ,
245258 ] . map (
246259 moveInto ( {
247- from : { module : "@apollo/client/react" } ,
248- to : { namespace : "useSubscription" } ,
260+ from : {
261+ module : "@apollo/client/react" ,
262+ alternativeModules : [ "@apollo/client" ] ,
263+ } ,
264+ to : { namespace : "useSubscription" , alternativeModules : [ ] } ,
249265 importType : "type" ,
250266 } )
251267 ) ,
@@ -254,16 +270,24 @@ export const renames: Array<IdentifierRename | ModuleRename> = [
254270 { from : "QueryResult" , to : "Result" } ,
255271 ] . map (
256272 moveInto ( {
257- from : { module : "@apollo/client/react" } ,
258- to : { namespace : "useQuery" } ,
273+ from : {
274+ module : "@apollo/client/react" ,
275+ alternativeModules : [ "@apollo/client" ] ,
276+ } ,
277+ to : { namespace : "useQuery" , alternativeModules : [ ] } ,
259278 importType : "type" ,
260279 } )
261280 ) ,
262281 ...[
263- { from : "SuspenseQueryHookFetchPolicy" , to : "FetchPolicy" } ,
282+ {
283+ from : "SuspenseQueryHookFetchPolicy" ,
284+ to : "FetchPolicy" ,
285+ alternativeModules : [ "@apollo/client" ] ,
286+ } ,
264287 {
265288 from : "SuspenseQueryHookOptions" ,
266289 to : "Options" ,
290+ alternativeModules : [ ] ,
267291 postProcess : reorderGenerics ( [ 1 ] ) ,
268292 } ,
269293 { from : "UseSuspenseQueryResult" , to : "Result" } ,
@@ -276,8 +300,11 @@ export const renames: Array<IdentifierRename | ModuleRename> = [
276300 ) ,
277301 ...[ { from : "UseQueryRefHandlersResult" , to : "Result" } ] . map (
278302 moveInto ( {
279- from : { module : "@apollo/client/react" } ,
280- to : { namespace : "useQueryRefHandlers" } ,
303+ from : {
304+ module : "@apollo/client/react" ,
305+ alternativeModules : [ "@apollo/client" ] ,
306+ } ,
307+ to : { namespace : "useQueryRefHandlers" , alternativeModules : [ ] } ,
281308 importType : "type" ,
282309 } )
283310 ) ,
@@ -286,15 +313,21 @@ export const renames: Array<IdentifierRename | ModuleRename> = [
286313 { from : "UseFragmentResult" , to : "Result" } ,
287314 ] . map (
288315 moveInto ( {
289- from : { module : "@apollo/client/react" } ,
290- to : { namespace : "useFragment" } ,
316+ from : {
317+ module : "@apollo/client/react" ,
318+ alternativeModules : [ "@apollo/client" ] ,
319+ } ,
320+ to : { namespace : "useFragment" , alternativeModules : [ ] } ,
291321 importType : "type" ,
292322 } )
293323 ) ,
294324 ...[ { from : "UseReadQueryResult" , to : "Result" } ] . map (
295325 moveInto ( {
296- from : { module : "@apollo/client/react" } ,
297- to : { namespace : "useReadQuery" } ,
326+ from : {
327+ module : "@apollo/client/react" ,
328+ alternativeModules : [ "@apollo/client" ] ,
329+ } ,
330+ to : { namespace : "useReadQuery" , alternativeModules : [ ] } ,
298331 importType : "type" ,
299332 } )
300333 ) ,
@@ -303,8 +336,11 @@ export const renames: Array<IdentifierRename | ModuleRename> = [
303336 { from : "UseSuspenseFragmentResult" , to : "Result" } ,
304337 ] . map (
305338 moveInto ( {
306- from : { module : "@apollo/client/react" } ,
307- to : { namespace : "useSuspenseFragment" } ,
339+ from : {
340+ module : "@apollo/client/react" ,
341+ alternativeModules : [ "@apollo/client" ] ,
342+ } ,
343+ to : { namespace : "useSuspenseFragment" , alternativeModules : [ ] } ,
308344 importType : "type" ,
309345 } )
310346 ) ,
0 commit comments