@depup/tanstack__react-query 5.91.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/build/codemods/src/utils/index.cjs +208 -0
  4. package/build/codemods/src/utils/transformers/query-cache-transformer.cjs +124 -0
  5. package/build/codemods/src/utils/transformers/query-client-transformer.cjs +53 -0
  6. package/build/codemods/src/utils/transformers/use-query-like-transformer.cjs +38 -0
  7. package/build/codemods/src/v4/key-transformation.cjs +181 -0
  8. package/build/codemods/src/v4/replace-import-specifier.cjs +25 -0
  9. package/build/codemods/src/v4/utils/replacers/key-replacer.cjs +164 -0
  10. package/build/codemods/src/v5/is-loading/is-loading.cjs +244 -0
  11. package/build/codemods/src/v5/keep-previous-data/README.md +32 -0
  12. package/build/codemods/src/v5/keep-previous-data/keep-previous-data.cjs +271 -0
  13. package/build/codemods/src/v5/keep-previous-data/utils/already-has-placeholder-data-property.cjs +26 -0
  14. package/build/codemods/src/v5/remove-overloads/remove-overloads.cjs +58 -0
  15. package/build/codemods/src/v5/remove-overloads/transformers/filter-aware-usage-transformer.cjs +271 -0
  16. package/build/codemods/src/v5/remove-overloads/transformers/query-fn-aware-usage-transformer.cjs +185 -0
  17. package/build/codemods/src/v5/remove-overloads/utils/index.cjs +123 -0
  18. package/build/codemods/src/v5/remove-overloads/utils/unknown-usage-error.cjs +27 -0
  19. package/build/codemods/src/v5/rename-hydrate/rename-hydrate.cjs +55 -0
  20. package/build/codemods/src/v5/rename-properties/rename-properties.cjs +41 -0
  21. package/build/legacy/HydrationBoundary.cjs +91 -0
  22. package/build/legacy/HydrationBoundary.cjs.map +1 -0
  23. package/build/legacy/HydrationBoundary.d.cts +2 -0
  24. package/build/legacy/HydrationBoundary.d.ts +2 -0
  25. package/build/legacy/HydrationBoundary.js +57 -0
  26. package/build/legacy/HydrationBoundary.js.map +1 -0
  27. package/build/legacy/IsRestoringProvider.cjs +47 -0
  28. package/build/legacy/IsRestoringProvider.cjs.map +1 -0
  29. package/build/legacy/IsRestoringProvider.d.cts +2 -0
  30. package/build/legacy/IsRestoringProvider.d.ts +2 -0
  31. package/build/legacy/IsRestoringProvider.js +12 -0
  32. package/build/legacy/IsRestoringProvider.js.map +1 -0
  33. package/build/legacy/QueryClientProvider.cjs +72 -0
  34. package/build/legacy/QueryClientProvider.cjs.map +1 -0
  35. package/build/legacy/QueryClientProvider.d.cts +4 -0
  36. package/build/legacy/QueryClientProvider.d.ts +4 -0
  37. package/build/legacy/QueryClientProvider.js +36 -0
  38. package/build/legacy/QueryClientProvider.js.map +1 -0
  39. package/build/legacy/QueryErrorResetBoundary.cjs +67 -0
  40. package/build/legacy/QueryErrorResetBoundary.cjs.map +1 -0
  41. package/build/legacy/QueryErrorResetBoundary.d.cts +8 -0
  42. package/build/legacy/QueryErrorResetBoundary.d.ts +8 -0
  43. package/build/legacy/QueryErrorResetBoundary.js +32 -0
  44. package/build/legacy/QueryErrorResetBoundary.js.map +1 -0
  45. package/build/legacy/_tsup-dts-rollup.d.cts +993 -0
  46. package/build/legacy/_tsup-dts-rollup.d.ts +993 -0
  47. package/build/legacy/errorBoundaryUtils.cjs +69 -0
  48. package/build/legacy/errorBoundaryUtils.cjs.map +1 -0
  49. package/build/legacy/errorBoundaryUtils.d.cts +3 -0
  50. package/build/legacy/errorBoundaryUtils.d.ts +3 -0
  51. package/build/legacy/errorBoundaryUtils.js +33 -0
  52. package/build/legacy/errorBoundaryUtils.js.map +1 -0
  53. package/build/legacy/index.cjs +97 -0
  54. package/build/legacy/index.cjs.map +1 -0
  55. package/build/legacy/index.d.cts +206 -0
  56. package/build/legacy/index.d.ts +206 -0
  57. package/build/legacy/index.js +54 -0
  58. package/build/legacy/index.js.map +1 -0
  59. package/build/legacy/infiniteQueryOptions.cjs +33 -0
  60. package/build/legacy/infiniteQueryOptions.cjs.map +1 -0
  61. package/build/legacy/infiniteQueryOptions.d.cts +4 -0
  62. package/build/legacy/infiniteQueryOptions.d.ts +4 -0
  63. package/build/legacy/infiniteQueryOptions.js +8 -0
  64. package/build/legacy/infiniteQueryOptions.js.map +1 -0
  65. package/build/legacy/mutationOptions.cjs +33 -0
  66. package/build/legacy/mutationOptions.cjs.map +1 -0
  67. package/build/legacy/mutationOptions.d.cts +1 -0
  68. package/build/legacy/mutationOptions.d.ts +1 -0
  69. package/build/legacy/mutationOptions.js +8 -0
  70. package/build/legacy/mutationOptions.js.map +1 -0
  71. package/build/legacy/queryOptions.cjs +33 -0
  72. package/build/legacy/queryOptions.cjs.map +1 -0
  73. package/build/legacy/queryOptions.d.cts +4 -0
  74. package/build/legacy/queryOptions.d.ts +4 -0
  75. package/build/legacy/queryOptions.js +8 -0
  76. package/build/legacy/queryOptions.js.map +1 -0
  77. package/build/legacy/suspense.cjs +58 -0
  78. package/build/legacy/suspense.cjs.map +1 -0
  79. package/build/legacy/suspense.d.cts +5 -0
  80. package/build/legacy/suspense.d.ts +5 -0
  81. package/build/legacy/suspense.js +29 -0
  82. package/build/legacy/suspense.js.map +1 -0
  83. package/build/legacy/types.cjs +19 -0
  84. package/build/legacy/types.cjs.map +1 -0
  85. package/build/legacy/types.d.cts +24 -0
  86. package/build/legacy/types.d.ts +24 -0
  87. package/build/legacy/types.js +1 -0
  88. package/build/legacy/types.js.map +1 -0
  89. package/build/legacy/useBaseQuery.cjs +133 -0
  90. package/build/legacy/useBaseQuery.cjs.map +1 -0
  91. package/build/legacy/useBaseQuery.d.cts +1 -0
  92. package/build/legacy/useBaseQuery.d.ts +1 -0
  93. package/build/legacy/useBaseQuery.js +108 -0
  94. package/build/legacy/useBaseQuery.js.map +1 -0
  95. package/build/legacy/useInfiniteQuery.cjs +40 -0
  96. package/build/legacy/useInfiniteQuery.cjs.map +1 -0
  97. package/build/legacy/useInfiniteQuery.d.cts +1 -0
  98. package/build/legacy/useInfiniteQuery.d.ts +1 -0
  99. package/build/legacy/useInfiniteQuery.js +16 -0
  100. package/build/legacy/useInfiniteQuery.js.map +1 -0
  101. package/build/legacy/useIsFetching.cjs +56 -0
  102. package/build/legacy/useIsFetching.cjs.map +1 -0
  103. package/build/legacy/useIsFetching.d.cts +1 -0
  104. package/build/legacy/useIsFetching.d.ts +1 -0
  105. package/build/legacy/useIsFetching.js +22 -0
  106. package/build/legacy/useIsFetching.js.map +1 -0
  107. package/build/legacy/useMutation.cjs +74 -0
  108. package/build/legacy/useMutation.cjs.map +1 -0
  109. package/build/legacy/useMutation.d.cts +1 -0
  110. package/build/legacy/useMutation.d.ts +1 -0
  111. package/build/legacy/useMutation.js +45 -0
  112. package/build/legacy/useMutation.js.map +1 -0
  113. package/build/legacy/useMutationState.cjs +86 -0
  114. package/build/legacy/useMutationState.cjs.map +1 -0
  115. package/build/legacy/useMutationState.d.cts +2 -0
  116. package/build/legacy/useMutationState.d.ts +2 -0
  117. package/build/legacy/useMutationState.js +51 -0
  118. package/build/legacy/useMutationState.js.map +1 -0
  119. package/build/legacy/usePrefetchInfiniteQuery.cjs +37 -0
  120. package/build/legacy/usePrefetchInfiniteQuery.cjs.map +1 -0
  121. package/build/legacy/usePrefetchInfiniteQuery.d.cts +1 -0
  122. package/build/legacy/usePrefetchInfiniteQuery.d.ts +1 -0
  123. package/build/legacy/usePrefetchInfiniteQuery.js +12 -0
  124. package/build/legacy/usePrefetchInfiniteQuery.js.map +1 -0
  125. package/build/legacy/usePrefetchQuery.cjs +37 -0
  126. package/build/legacy/usePrefetchQuery.cjs.map +1 -0
  127. package/build/legacy/usePrefetchQuery.d.cts +1 -0
  128. package/build/legacy/usePrefetchQuery.d.ts +1 -0
  129. package/build/legacy/usePrefetchQuery.js +12 -0
  130. package/build/legacy/usePrefetchQuery.js.map +1 -0
  131. package/build/legacy/useQueries.cjs +128 -0
  132. package/build/legacy/useQueries.cjs.map +1 -0
  133. package/build/legacy/useQueries.d.cts +3 -0
  134. package/build/legacy/useQueries.d.ts +3 -0
  135. package/build/legacy/useQueries.js +107 -0
  136. package/build/legacy/useQueries.js.map +1 -0
  137. package/build/legacy/useQuery.cjs +36 -0
  138. package/build/legacy/useQuery.cjs.map +1 -0
  139. package/build/legacy/useQuery.d.cts +1 -0
  140. package/build/legacy/useQuery.d.ts +1 -0
  141. package/build/legacy/useQuery.js +12 -0
  142. package/build/legacy/useQuery.js.map +1 -0
  143. package/build/legacy/useSuspenseInfiniteQuery.cjs +51 -0
  144. package/build/legacy/useSuspenseInfiniteQuery.cjs.map +1 -0
  145. package/build/legacy/useSuspenseInfiniteQuery.d.cts +1 -0
  146. package/build/legacy/useSuspenseInfiniteQuery.d.ts +1 -0
  147. package/build/legacy/useSuspenseInfiniteQuery.js +27 -0
  148. package/build/legacy/useSuspenseInfiniteQuery.js.map +1 -0
  149. package/build/legacy/useSuspenseQueries.cjs +56 -0
  150. package/build/legacy/useSuspenseQueries.cjs.map +1 -0
  151. package/build/legacy/useSuspenseQueries.d.cts +3 -0
  152. package/build/legacy/useSuspenseQueries.d.ts +3 -0
  153. package/build/legacy/useSuspenseQueries.js +32 -0
  154. package/build/legacy/useSuspenseQueries.js.map +1 -0
  155. package/build/legacy/useSuspenseQuery.cjs +52 -0
  156. package/build/legacy/useSuspenseQuery.cjs.map +1 -0
  157. package/build/legacy/useSuspenseQuery.d.cts +1 -0
  158. package/build/legacy/useSuspenseQuery.d.ts +1 -0
  159. package/build/legacy/useSuspenseQuery.js +28 -0
  160. package/build/legacy/useSuspenseQuery.js.map +1 -0
  161. package/build/modern/HydrationBoundary.cjs +91 -0
  162. package/build/modern/HydrationBoundary.cjs.map +1 -0
  163. package/build/modern/HydrationBoundary.d.cts +2 -0
  164. package/build/modern/HydrationBoundary.d.ts +2 -0
  165. package/build/modern/HydrationBoundary.js +57 -0
  166. package/build/modern/HydrationBoundary.js.map +1 -0
  167. package/build/modern/IsRestoringProvider.cjs +47 -0
  168. package/build/modern/IsRestoringProvider.cjs.map +1 -0
  169. package/build/modern/IsRestoringProvider.d.cts +2 -0
  170. package/build/modern/IsRestoringProvider.d.ts +2 -0
  171. package/build/modern/IsRestoringProvider.js +12 -0
  172. package/build/modern/IsRestoringProvider.js.map +1 -0
  173. package/build/modern/QueryClientProvider.cjs +72 -0
  174. package/build/modern/QueryClientProvider.cjs.map +1 -0
  175. package/build/modern/QueryClientProvider.d.cts +4 -0
  176. package/build/modern/QueryClientProvider.d.ts +4 -0
  177. package/build/modern/QueryClientProvider.js +36 -0
  178. package/build/modern/QueryClientProvider.js.map +1 -0
  179. package/build/modern/QueryErrorResetBoundary.cjs +67 -0
  180. package/build/modern/QueryErrorResetBoundary.cjs.map +1 -0
  181. package/build/modern/QueryErrorResetBoundary.d.cts +8 -0
  182. package/build/modern/QueryErrorResetBoundary.d.ts +8 -0
  183. package/build/modern/QueryErrorResetBoundary.js +32 -0
  184. package/build/modern/QueryErrorResetBoundary.js.map +1 -0
  185. package/build/modern/_tsup-dts-rollup.d.cts +993 -0
  186. package/build/modern/_tsup-dts-rollup.d.ts +993 -0
  187. package/build/modern/errorBoundaryUtils.cjs +69 -0
  188. package/build/modern/errorBoundaryUtils.cjs.map +1 -0
  189. package/build/modern/errorBoundaryUtils.d.cts +3 -0
  190. package/build/modern/errorBoundaryUtils.d.ts +3 -0
  191. package/build/modern/errorBoundaryUtils.js +33 -0
  192. package/build/modern/errorBoundaryUtils.js.map +1 -0
  193. package/build/modern/index.cjs +97 -0
  194. package/build/modern/index.cjs.map +1 -0
  195. package/build/modern/index.d.cts +206 -0
  196. package/build/modern/index.d.ts +206 -0
  197. package/build/modern/index.js +54 -0
  198. package/build/modern/index.js.map +1 -0
  199. package/build/modern/infiniteQueryOptions.cjs +33 -0
  200. package/build/modern/infiniteQueryOptions.cjs.map +1 -0
  201. package/build/modern/infiniteQueryOptions.d.cts +4 -0
  202. package/build/modern/infiniteQueryOptions.d.ts +4 -0
  203. package/build/modern/infiniteQueryOptions.js +8 -0
  204. package/build/modern/infiniteQueryOptions.js.map +1 -0
  205. package/build/modern/mutationOptions.cjs +33 -0
  206. package/build/modern/mutationOptions.cjs.map +1 -0
  207. package/build/modern/mutationOptions.d.cts +1 -0
  208. package/build/modern/mutationOptions.d.ts +1 -0
  209. package/build/modern/mutationOptions.js +8 -0
  210. package/build/modern/mutationOptions.js.map +1 -0
  211. package/build/modern/queryOptions.cjs +33 -0
  212. package/build/modern/queryOptions.cjs.map +1 -0
  213. package/build/modern/queryOptions.d.cts +4 -0
  214. package/build/modern/queryOptions.d.ts +4 -0
  215. package/build/modern/queryOptions.js +8 -0
  216. package/build/modern/queryOptions.js.map +1 -0
  217. package/build/modern/suspense.cjs +58 -0
  218. package/build/modern/suspense.cjs.map +1 -0
  219. package/build/modern/suspense.d.cts +5 -0
  220. package/build/modern/suspense.d.ts +5 -0
  221. package/build/modern/suspense.js +29 -0
  222. package/build/modern/suspense.js.map +1 -0
  223. package/build/modern/types.cjs +19 -0
  224. package/build/modern/types.cjs.map +1 -0
  225. package/build/modern/types.d.cts +24 -0
  226. package/build/modern/types.d.ts +24 -0
  227. package/build/modern/types.js +1 -0
  228. package/build/modern/types.js.map +1 -0
  229. package/build/modern/useBaseQuery.cjs +130 -0
  230. package/build/modern/useBaseQuery.cjs.map +1 -0
  231. package/build/modern/useBaseQuery.d.cts +1 -0
  232. package/build/modern/useBaseQuery.d.ts +1 -0
  233. package/build/modern/useBaseQuery.js +105 -0
  234. package/build/modern/useBaseQuery.js.map +1 -0
  235. package/build/modern/useInfiniteQuery.cjs +40 -0
  236. package/build/modern/useInfiniteQuery.cjs.map +1 -0
  237. package/build/modern/useInfiniteQuery.d.cts +1 -0
  238. package/build/modern/useInfiniteQuery.d.ts +1 -0
  239. package/build/modern/useInfiniteQuery.js +16 -0
  240. package/build/modern/useInfiniteQuery.js.map +1 -0
  241. package/build/modern/useIsFetching.cjs +56 -0
  242. package/build/modern/useIsFetching.cjs.map +1 -0
  243. package/build/modern/useIsFetching.d.cts +1 -0
  244. package/build/modern/useIsFetching.d.ts +1 -0
  245. package/build/modern/useIsFetching.js +22 -0
  246. package/build/modern/useIsFetching.js.map +1 -0
  247. package/build/modern/useMutation.cjs +74 -0
  248. package/build/modern/useMutation.cjs.map +1 -0
  249. package/build/modern/useMutation.d.cts +1 -0
  250. package/build/modern/useMutation.d.ts +1 -0
  251. package/build/modern/useMutation.js +45 -0
  252. package/build/modern/useMutation.js.map +1 -0
  253. package/build/modern/useMutationState.cjs +86 -0
  254. package/build/modern/useMutationState.cjs.map +1 -0
  255. package/build/modern/useMutationState.d.cts +2 -0
  256. package/build/modern/useMutationState.d.ts +2 -0
  257. package/build/modern/useMutationState.js +51 -0
  258. package/build/modern/useMutationState.js.map +1 -0
  259. package/build/modern/usePrefetchInfiniteQuery.cjs +37 -0
  260. package/build/modern/usePrefetchInfiniteQuery.cjs.map +1 -0
  261. package/build/modern/usePrefetchInfiniteQuery.d.cts +1 -0
  262. package/build/modern/usePrefetchInfiniteQuery.d.ts +1 -0
  263. package/build/modern/usePrefetchInfiniteQuery.js +12 -0
  264. package/build/modern/usePrefetchInfiniteQuery.js.map +1 -0
  265. package/build/modern/usePrefetchQuery.cjs +37 -0
  266. package/build/modern/usePrefetchQuery.cjs.map +1 -0
  267. package/build/modern/usePrefetchQuery.d.cts +1 -0
  268. package/build/modern/usePrefetchQuery.d.ts +1 -0
  269. package/build/modern/usePrefetchQuery.js +12 -0
  270. package/build/modern/usePrefetchQuery.js.map +1 -0
  271. package/build/modern/useQueries.cjs +128 -0
  272. package/build/modern/useQueries.cjs.map +1 -0
  273. package/build/modern/useQueries.d.cts +3 -0
  274. package/build/modern/useQueries.d.ts +3 -0
  275. package/build/modern/useQueries.js +107 -0
  276. package/build/modern/useQueries.js.map +1 -0
  277. package/build/modern/useQuery.cjs +36 -0
  278. package/build/modern/useQuery.cjs.map +1 -0
  279. package/build/modern/useQuery.d.cts +1 -0
  280. package/build/modern/useQuery.d.ts +1 -0
  281. package/build/modern/useQuery.js +12 -0
  282. package/build/modern/useQuery.js.map +1 -0
  283. package/build/modern/useSuspenseInfiniteQuery.cjs +51 -0
  284. package/build/modern/useSuspenseInfiniteQuery.cjs.map +1 -0
  285. package/build/modern/useSuspenseInfiniteQuery.d.cts +1 -0
  286. package/build/modern/useSuspenseInfiniteQuery.d.ts +1 -0
  287. package/build/modern/useSuspenseInfiniteQuery.js +27 -0
  288. package/build/modern/useSuspenseInfiniteQuery.js.map +1 -0
  289. package/build/modern/useSuspenseQueries.cjs +56 -0
  290. package/build/modern/useSuspenseQueries.cjs.map +1 -0
  291. package/build/modern/useSuspenseQueries.d.cts +3 -0
  292. package/build/modern/useSuspenseQueries.d.ts +3 -0
  293. package/build/modern/useSuspenseQueries.js +32 -0
  294. package/build/modern/useSuspenseQueries.js.map +1 -0
  295. package/build/modern/useSuspenseQuery.cjs +52 -0
  296. package/build/modern/useSuspenseQuery.cjs.map +1 -0
  297. package/build/modern/useSuspenseQuery.d.cts +1 -0
  298. package/build/modern/useSuspenseQuery.d.ts +1 -0
  299. package/build/modern/useSuspenseQuery.js +28 -0
  300. package/build/modern/useSuspenseQuery.js.map +1 -0
  301. package/build/query-codemods/eslint.config.js +18 -0
  302. package/build/query-codemods/package.json +38 -0
  303. package/build/query-codemods/root.eslint.config.js +64 -0
  304. package/build/query-codemods/tsconfig.json +8 -0
  305. package/build/query-codemods/vite.config.ts +30 -0
  306. package/changes.json +5 -0
  307. package/package.json +104 -0
  308. package/src/HydrationBoundary.tsx +111 -0
  309. package/src/IsRestoringProvider.ts +7 -0
  310. package/src/QueryClientProvider.tsx +45 -0
  311. package/src/QueryErrorResetBoundary.tsx +56 -0
  312. package/src/errorBoundaryUtils.ts +82 -0
  313. package/src/index.ts +56 -0
  314. package/src/infiniteQueryOptions.ts +149 -0
  315. package/src/mutationOptions.ts +41 -0
  316. package/src/queryOptions.ts +87 -0
  317. package/src/suspense.ts +80 -0
  318. package/src/types.ts +242 -0
  319. package/src/useBaseQuery.ts +170 -0
  320. package/src/useInfiniteQuery.ts +81 -0
  321. package/src/useIsFetching.ts +24 -0
  322. package/src/useMutation.ts +69 -0
  323. package/src/useMutationState.ts +75 -0
  324. package/src/usePrefetchInfiniteQuery.tsx +30 -0
  325. package/src/usePrefetchQuery.tsx +19 -0
  326. package/src/useQueries.ts +328 -0
  327. package/src/useQuery.ts +52 -0
  328. package/src/useSuspenseInfiniteQuery.ts +50 -0
  329. package/src/useSuspenseQueries.ts +211 -0
  330. package/src/useSuspenseQuery.ts +34 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-present Tanner Linsley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @depup/tanstack__react-query
2
+
3
+ > Dependency-bumped version of [@tanstack/react-query](https://www.npmjs.com/package/@tanstack/react-query)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/tanstack__react-query
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [@tanstack/react-query](https://www.npmjs.com/package/@tanstack/react-query) @ 5.91.0 |
17
+ | Processed | 2026-03-18 |
18
+ | Smoke test | failed |
19
+ | Deps updated | 0 |
20
+
21
+ ---
22
+
23
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@tanstack/react-query
24
+
25
+ License inherited from the original package.
@@ -0,0 +1,208 @@
1
+ module.exports = ({ root, jscodeshift }) => {
2
+ const findImportIdentifierOf = (importSpecifiers, identifier) => {
3
+ const specifier = importSpecifiers
4
+ .filter((node) => node.value.imported.name === identifier)
5
+ .paths()
6
+
7
+ if (specifier.length > 0) {
8
+ return specifier[0].value.local
9
+ }
10
+
11
+ return jscodeshift.identifier(identifier)
12
+ }
13
+
14
+ const findImportSpecifiers = (packageName) =>
15
+ root
16
+ .find(jscodeshift.ImportDeclaration, {
17
+ source: {
18
+ value: packageName,
19
+ },
20
+ })
21
+ .find(jscodeshift.ImportSpecifier, {})
22
+
23
+ const locateImports = (
24
+ identifiers,
25
+ packageName = '@tanstack/react-query',
26
+ ) => {
27
+ const findNamespaceImportIdentifier = () => {
28
+ const specifier = root
29
+ .find(jscodeshift.ImportDeclaration, {
30
+ source: {
31
+ value: packageName,
32
+ },
33
+ })
34
+ .find(jscodeshift.ImportNamespaceSpecifier)
35
+ .paths()
36
+
37
+ return specifier.length > 0 ? specifier[0].value.local : null
38
+ }
39
+
40
+ /**
41
+ * First, we search for the namespace import identifier because if we have any, we assume the consumer uses
42
+ * namespace imports. In this case, we won't search for named imports at all.
43
+ */
44
+ const namespaceImportIdentifier = findNamespaceImportIdentifier()
45
+
46
+ if (namespaceImportIdentifier) {
47
+ const identifierMap = {}
48
+
49
+ for (const identifier of identifiers) {
50
+ identifierMap[identifier] = jscodeshift.identifier(identifier)
51
+ }
52
+
53
+ return {
54
+ namespace: namespaceImportIdentifier,
55
+ ...identifierMap,
56
+ }
57
+ }
58
+
59
+ const importSpecifiers = findImportSpecifiers(packageName)
60
+ const identifierMap = {}
61
+
62
+ for (const identifier of identifiers) {
63
+ identifierMap[identifier] = findImportIdentifierOf(
64
+ importSpecifiers,
65
+ identifier,
66
+ )
67
+ }
68
+
69
+ return {
70
+ namespace: null,
71
+ ...identifierMap,
72
+ }
73
+ }
74
+
75
+ const findAllMethodCalls = () =>
76
+ root
77
+ // First, we need to find all method calls.
78
+ .find(jscodeshift.CallExpression, {
79
+ callee: {
80
+ type: jscodeshift.MemberExpression.name,
81
+ property: {
82
+ type: jscodeshift.Identifier.name,
83
+ },
84
+ },
85
+ })
86
+
87
+ const findQueryClientIdentifiers = (importIdentifiers) =>
88
+ root
89
+ .find(jscodeshift.VariableDeclarator, {})
90
+ .filter((node) => {
91
+ if (node.value.init) {
92
+ const initializer = node.value.init
93
+
94
+ return (
95
+ isClassInstantiationOf(
96
+ initializer,
97
+ getSelectorByImports(importIdentifiers, 'QueryClient'),
98
+ ) ||
99
+ isFunctionCallOf(
100
+ initializer,
101
+ getSelectorByImports(importIdentifiers, 'useQueryClient'),
102
+ )
103
+ )
104
+ }
105
+
106
+ return false
107
+ })
108
+ .paths()
109
+ .map((node) => node.value.id.name)
110
+
111
+ const isCallExpression = (node) =>
112
+ jscodeshift.match(node, { type: jscodeshift.CallExpression.name })
113
+
114
+ const isIdentifier = (node) =>
115
+ jscodeshift.match(node, { type: jscodeshift.Identifier.name })
116
+
117
+ const isMemberExpression = (node) =>
118
+ jscodeshift.match(node, { type: jscodeshift.MemberExpression.name })
119
+
120
+ const isNewExpression = (node) =>
121
+ jscodeshift.match(node, { type: jscodeshift.NewExpression.name })
122
+
123
+ const isArrayExpression = (node) =>
124
+ jscodeshift.match(node, { type: jscodeshift.ArrayExpression.name })
125
+
126
+ const isObjectExpression = (node) =>
127
+ jscodeshift.match(node, { type: jscodeshift.ObjectExpression.name })
128
+
129
+ const isObjectProperty = (node) =>
130
+ jscodeshift.match(node, { type: jscodeshift.ObjectProperty.name })
131
+
132
+ const isSpreadElement = (node) =>
133
+ jscodeshift.match(node, { type: jscodeshift.SpreadElement.name })
134
+
135
+ /**
136
+ * @param {import('jscodeshift').Node} node
137
+ * @returns {boolean}
138
+ */
139
+ const isFunctionDefinition = (node) => {
140
+ const isArrowFunctionExpression = jscodeshift.match(node, {
141
+ type: jscodeshift.ArrowFunctionExpression.name,
142
+ })
143
+ const isFunctionExpression = jscodeshift.match(node, {
144
+ type: jscodeshift.FunctionExpression.name,
145
+ })
146
+
147
+ return isArrowFunctionExpression || isFunctionExpression
148
+ }
149
+
150
+ const warn = (message) => {
151
+ if (process.env.NODE_ENV !== 'test') {
152
+ console.warn(message)
153
+ }
154
+ }
155
+
156
+ const isClassInstantiationOf = (node, selector) => {
157
+ if (!isNewExpression(node)) {
158
+ return false
159
+ }
160
+
161
+ const parts = selector.split('.')
162
+
163
+ return parts.length === 1
164
+ ? isIdentifier(node.callee) && node.callee.name === parts[0]
165
+ : isMemberExpression(node.callee) &&
166
+ node.callee.object.name === parts[0] &&
167
+ node.callee.property.name === parts[1]
168
+ }
169
+
170
+ const isFunctionCallOf = (node, selector) => {
171
+ if (!isCallExpression(node)) {
172
+ return false
173
+ }
174
+
175
+ const parts = selector.split('.')
176
+
177
+ return parts.length === 1
178
+ ? isIdentifier(node.callee) && node.callee.name === parts[0]
179
+ : isMemberExpression(node.callee) &&
180
+ node.callee.object.name === parts[0] &&
181
+ node.callee.property.name === parts[1]
182
+ }
183
+
184
+ const getSelectorByImports = (imports, path) =>
185
+ imports.namespace
186
+ ? `${imports.namespace.name}.${imports[path].name}`
187
+ : imports[path].name
188
+
189
+ return {
190
+ findAllMethodCalls,
191
+ getSelectorByImports,
192
+ isCallExpression,
193
+ isClassInstantiationOf,
194
+ isFunctionCallOf,
195
+ isIdentifier,
196
+ isMemberExpression,
197
+ isArrayExpression,
198
+ isObjectExpression,
199
+ isObjectProperty,
200
+ isSpreadElement,
201
+ isFunctionDefinition,
202
+ locateImports,
203
+ warn,
204
+ queryClient: {
205
+ findQueryClientIdentifiers,
206
+ },
207
+ }
208
+ }
@@ -0,0 +1,124 @@
1
+ module.exports = ({
2
+ jscodeshift,
3
+ utils,
4
+ root,
5
+ packageName = '@tanstack/react-query',
6
+ }) => {
7
+ const isGetQueryCacheMethodCall = (
8
+ initializer,
9
+ importIdentifiers,
10
+ knownQueryClientIds,
11
+ ) => {
12
+ const isKnownQueryClient = (node) =>
13
+ utils.isIdentifier(node) && knownQueryClientIds.includes(node.name)
14
+
15
+ const isGetQueryCacheIdentifier = (node) =>
16
+ utils.isIdentifier(node) && node.name === 'getQueryCache'
17
+
18
+ const isValidInitializer = (node) =>
19
+ utils.isCallExpression(node) && utils.isMemberExpression(node.callee)
20
+
21
+ if (isValidInitializer(initializer)) {
22
+ const instance = initializer.callee.object
23
+
24
+ return (
25
+ isGetQueryCacheIdentifier(initializer.callee.property) &&
26
+ (isKnownQueryClient(instance) ||
27
+ utils.isFunctionCallOf(
28
+ instance,
29
+ utils.getSelectorByImports(importIdentifiers, 'useQueryClient'),
30
+ ))
31
+ )
32
+ }
33
+
34
+ return false
35
+ }
36
+
37
+ const findQueryCacheInstantiations = (
38
+ importIdentifiers,
39
+ knownQueryClientIds,
40
+ ) =>
41
+ root.find(jscodeshift.VariableDeclarator, {}).filter((node) => {
42
+ if (node.value.init) {
43
+ const initializer = node.value.init
44
+
45
+ return (
46
+ utils.isClassInstantiationOf(
47
+ initializer,
48
+ utils.getSelectorByImports(importIdentifiers, 'QueryCache'),
49
+ ) ||
50
+ isGetQueryCacheMethodCall(
51
+ initializer,
52
+ importIdentifiers,
53
+ knownQueryClientIds,
54
+ )
55
+ )
56
+ }
57
+
58
+ return false
59
+ })
60
+
61
+ const filterQueryCacheMethodCalls = (node) =>
62
+ utils.isIdentifier(node) && ['find', 'findAll'].includes(node.name)
63
+
64
+ const findQueryCacheMethodCalls = (importIdentifiers) => {
65
+ /**
66
+ * Here we collect all query client instantiations. We have to make aware of them because the query cache can be
67
+ * accessed by the query client as well.
68
+ */
69
+ const queryClientIdentifiers =
70
+ utils.queryClient.findQueryClientIdentifiers(importIdentifiers)
71
+ /**
72
+ * Here we collect all query cache instantiations. The reason is simple: the methods can be called on query cache
73
+ * instances, to locate the possible usages we need to be aware of the identifier names.
74
+ */
75
+ const queryCacheIdentifiers = findQueryCacheInstantiations(
76
+ importIdentifiers,
77
+ queryClientIdentifiers,
78
+ )
79
+ .paths()
80
+ .map((node) => node.value.id.name)
81
+
82
+ return (
83
+ utils
84
+ // First, we need to find all method calls.
85
+ .findAllMethodCalls()
86
+ // Then we narrow the collection to all `fetch` and `fetchAll` methods.
87
+ .filter((node) =>
88
+ filterQueryCacheMethodCalls(node.value.callee.property),
89
+ )
90
+ .filter((node) => {
91
+ const object = node.value.callee.object
92
+
93
+ // If the method is called on a `QueryCache` instance, we keep it in the collection.
94
+ if (utils.isIdentifier(object)) {
95
+ return queryCacheIdentifiers.includes(object.name)
96
+ }
97
+
98
+ // If the method is called on a `QueryClient` instance, we keep it in the collection.
99
+ if (utils.isCallExpression(object)) {
100
+ return isGetQueryCacheMethodCall(
101
+ object,
102
+ importIdentifiers,
103
+ queryClientIdentifiers,
104
+ )
105
+ }
106
+
107
+ return false
108
+ })
109
+ )
110
+ }
111
+
112
+ const execute = (replacer) => {
113
+ findQueryCacheMethodCalls(
114
+ utils.locateImports(
115
+ ['QueryCache', 'QueryClient', 'useQueryClient'],
116
+ packageName,
117
+ ),
118
+ ).replaceWith(replacer)
119
+ }
120
+
121
+ return {
122
+ execute,
123
+ }
124
+ }
@@ -0,0 +1,53 @@
1
+ module.exports = ({
2
+ jscodeshift,
3
+ utils,
4
+ root,
5
+ packageName = '@tanstack/react-query',
6
+ }) => {
7
+ const filterQueryClientMethodCalls = (node, methods) =>
8
+ utils.isIdentifier(node) && methods.includes(node.name)
9
+
10
+ const findQueryClientMethodCalls = (importIdentifiers, methods) => {
11
+ /**
12
+ * Here we collect all query client instantiations. We have to make aware of them because some method calls might
13
+ * be invoked on these instances.
14
+ */
15
+ const queryClientIdentifiers =
16
+ utils.queryClient.findQueryClientIdentifiers(importIdentifiers)
17
+
18
+ return (
19
+ utils
20
+ // First, we need to find all method calls.
21
+ .findAllMethodCalls()
22
+ // Then we narrow the collection to `QueryClient` methods.
23
+ .filter((node) =>
24
+ filterQueryClientMethodCalls(node.value.callee.property, methods),
25
+ )
26
+ .filter((node) => {
27
+ const object = node.value.callee.object
28
+
29
+ // If the method is called on a `QueryClient` instance, we keep it in the collection.
30
+ if (utils.isIdentifier(object)) {
31
+ return queryClientIdentifiers.includes(object.name)
32
+ }
33
+
34
+ // If the method is called on the return value of `useQueryClient` hook, we keep it in the collection.
35
+ return utils.isFunctionCallOf(
36
+ object,
37
+ utils.getSelectorByImports(importIdentifiers, 'useQueryClient'),
38
+ )
39
+ })
40
+ )
41
+ }
42
+
43
+ const execute = (methods, replacer) => {
44
+ findQueryClientMethodCalls(
45
+ utils.locateImports(['QueryClient', 'useQueryClient'], packageName),
46
+ methods,
47
+ ).replaceWith(replacer)
48
+ }
49
+
50
+ return {
51
+ execute,
52
+ }
53
+ }
@@ -0,0 +1,38 @@
1
+ module.exports = ({
2
+ jscodeshift,
3
+ utils,
4
+ root,
5
+ packageName = '@tanstack/react-query',
6
+ }) => {
7
+ const filterUseQueryLikeHookCalls = (node, importIdentifiers, hooks) => {
8
+ for (const hook of hooks) {
9
+ const selector = utils.getSelectorByImports(importIdentifiers, hook)
10
+
11
+ if (utils.isFunctionCallOf(node, selector)) {
12
+ return true
13
+ }
14
+ }
15
+
16
+ return false
17
+ }
18
+
19
+ const findUseQueryLikeHookCalls = (importIdentifiers, hooks) =>
20
+ root
21
+ // First, we need to find all call expressions.
22
+ .find(jscodeshift.CallExpression, {})
23
+ // Then we narrow the collection to the `useQuery` like hook calls.
24
+ .filter((node) =>
25
+ filterUseQueryLikeHookCalls(node.value, importIdentifiers, hooks),
26
+ )
27
+
28
+ const execute = (hooks, replacer) => {
29
+ findUseQueryLikeHookCalls(
30
+ utils.locateImports(hooks, packageName),
31
+ hooks,
32
+ ).replaceWith(replacer)
33
+ }
34
+
35
+ return {
36
+ execute,
37
+ }
38
+ }
@@ -0,0 +1,181 @@
1
+ const createUtilsObject = require('../utils/index.cjs')
2
+ const createKeyReplacer = require('./utils/replacers/key-replacer.cjs')
3
+ const createUseQueryLikeTransformer = require('../utils/transformers/use-query-like-transformer.cjs')
4
+ const createQueryClientTransformer = require('../utils/transformers/query-client-transformer.cjs')
5
+ const createQueryCacheTransformer = require('../utils/transformers/query-cache-transformer.cjs')
6
+
7
+ const transformQueryClientUsages = ({
8
+ jscodeshift,
9
+ utils,
10
+ root,
11
+ filePath,
12
+ packageName,
13
+ }) => {
14
+ const transformer = createQueryClientTransformer({
15
+ jscodeshift,
16
+ utils,
17
+ root,
18
+ packageName,
19
+ })
20
+ const replacer = createKeyReplacer({ jscodeshift, root, filePath })
21
+
22
+ transformer.execute(
23
+ [
24
+ // Not object syntax-aware methods.
25
+ 'getMutationDefaults',
26
+ 'getQueriesData',
27
+ 'getQueryData',
28
+ 'getQueryDefaults',
29
+ 'getQueryState',
30
+ 'isFetching',
31
+ 'setMutationDefaults',
32
+ 'setQueriesData',
33
+ 'setQueryData',
34
+ 'setQueryDefaults',
35
+ // Object syntax-aware methods.
36
+ 'cancelQueries',
37
+ 'fetchInfiniteQuery',
38
+ 'fetchQuery',
39
+ 'invalidateQueries',
40
+ 'prefetchInfiniteQuery',
41
+ 'prefetchQuery',
42
+ 'refetchQueries',
43
+ 'removeQueries',
44
+ 'resetQueries',
45
+ ],
46
+ replacer,
47
+ )
48
+ }
49
+
50
+ const transformUseQueriesUsages = ({
51
+ jscodeshift,
52
+ utils,
53
+ root,
54
+ packageName,
55
+ }) => {
56
+ const transformer = createUseQueryLikeTransformer({
57
+ jscodeshift,
58
+ utils,
59
+ root,
60
+ packageName,
61
+ })
62
+ const replacer = ({ node }) => {
63
+ /**
64
+ * When the node doesn't have the 'original' property, that means the codemod has been already applied,
65
+ * so we don't need to do any changes.
66
+ */
67
+ if (!node.original) {
68
+ return node
69
+ }
70
+
71
+ const newCallExpression = jscodeshift.callExpression(node.original.callee, [
72
+ jscodeshift.objectExpression([
73
+ jscodeshift.property(
74
+ 'init',
75
+ jscodeshift.identifier('queries'),
76
+ node.original.arguments[0],
77
+ ),
78
+ ]),
79
+ ])
80
+
81
+ // TODO: This should be part of one function!
82
+ if (node.typeParameters) {
83
+ newCallExpression.typeArguments = node.typeParameters
84
+ }
85
+
86
+ return newCallExpression
87
+ }
88
+
89
+ transformer.execute(['useQueries'], replacer)
90
+ }
91
+
92
+ const transformUseQueryLikeUsages = ({
93
+ jscodeshift,
94
+ utils,
95
+ root,
96
+ filePath,
97
+ packageName,
98
+ }) => {
99
+ const transformer = createUseQueryLikeTransformer({
100
+ jscodeshift,
101
+ utils,
102
+ root,
103
+ packageName,
104
+ })
105
+
106
+ transformer.execute(
107
+ ['useQuery', 'useInfiniteQuery', 'useIsFetching', 'useIsMutating'],
108
+ createKeyReplacer({
109
+ jscodeshift,
110
+ root,
111
+ filePath,
112
+ keyName: 'queryKey',
113
+ }),
114
+ )
115
+ transformer.execute(
116
+ ['useMutation'],
117
+ createKeyReplacer({
118
+ jscodeshift,
119
+ root,
120
+ filePath,
121
+ keyName: 'mutationKey',
122
+ }),
123
+ )
124
+ }
125
+
126
+ const transformQueryCacheUsages = ({
127
+ jscodeshift,
128
+ utils,
129
+ root,
130
+ filePath,
131
+ packageName,
132
+ }) => {
133
+ const transformer = createQueryCacheTransformer({
134
+ jscodeshift,
135
+ utils,
136
+ root,
137
+ packageName,
138
+ })
139
+ const replacer = createKeyReplacer({ jscodeshift, root, filePath })
140
+
141
+ transformer.execute(replacer)
142
+ }
143
+
144
+ module.exports = (file, api) => {
145
+ const jscodeshift = api.jscodeshift
146
+ const root = jscodeshift(file.source)
147
+
148
+ // TODO: Execute the transformers only when it contains a `react-query` import!
149
+
150
+ const utils = createUtilsObject({ root, jscodeshift })
151
+ const filePath = file.path
152
+ const packageName = 'react-query'
153
+
154
+ // This function transforms usages like `useQuery` and `useMutation`.
155
+ transformUseQueryLikeUsages({
156
+ jscodeshift,
157
+ utils,
158
+ root,
159
+ filePath,
160
+ packageName,
161
+ })
162
+ // This function transforms usages of `useQueries`.
163
+ transformUseQueriesUsages({
164
+ jscodeshift,
165
+ utils,
166
+ root,
167
+ packageName,
168
+ })
169
+ // This function transforms usages of `QueryClient`.
170
+ transformQueryClientUsages({
171
+ jscodeshift,
172
+ utils,
173
+ root,
174
+ filePath,
175
+ packageName,
176
+ })
177
+ // This function transforms usages of `QueryCache`.
178
+ transformQueryCacheUsages({ jscodeshift, utils, root, filePath, packageName })
179
+
180
+ return root.toSource({ quote: 'single', lineTerminator: '\n' })
181
+ }
@@ -0,0 +1,25 @@
1
+ module.exports = (file, api) => {
2
+ const jscodeshift = api.jscodeshift
3
+ const root = jscodeshift(file.source)
4
+
5
+ const replacements = [
6
+ { from: 'react-query', to: '@tanstack/react-query' },
7
+ { from: 'react-query/devtools', to: '@tanstack/react-query-devtools' },
8
+ ]
9
+
10
+ replacements.forEach(({ from, to }) => {
11
+ root
12
+ .find(jscodeshift.ImportDeclaration, {
13
+ source: {
14
+ value: from,
15
+ },
16
+ })
17
+ .replaceWith(({ node }) => {
18
+ node.source.value = to
19
+
20
+ return node
21
+ })
22
+ })
23
+
24
+ return root.toSource({ quote: 'single', lineTerminator: '\n' })
25
+ }