@tanstack/preact-query 5.94.3 → 5.94.4

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 (316) hide show
  1. package/package.json +4 -4
  2. package/build/codemods/src/utils/index.cjs +0 -208
  3. package/build/codemods/src/utils/transformers/query-cache-transformer.cjs +0 -124
  4. package/build/codemods/src/utils/transformers/query-client-transformer.cjs +0 -53
  5. package/build/codemods/src/utils/transformers/use-query-like-transformer.cjs +0 -38
  6. package/build/codemods/src/v4/key-transformation.cjs +0 -181
  7. package/build/codemods/src/v4/replace-import-specifier.cjs +0 -25
  8. package/build/codemods/src/v4/utils/replacers/key-replacer.cjs +0 -164
  9. package/build/codemods/src/v5/is-loading/is-loading.cjs +0 -244
  10. package/build/codemods/src/v5/keep-previous-data/README.md +0 -32
  11. package/build/codemods/src/v5/keep-previous-data/keep-previous-data.cjs +0 -271
  12. package/build/codemods/src/v5/keep-previous-data/utils/already-has-placeholder-data-property.cjs +0 -26
  13. package/build/codemods/src/v5/remove-overloads/remove-overloads.cjs +0 -58
  14. package/build/codemods/src/v5/remove-overloads/transformers/filter-aware-usage-transformer.cjs +0 -271
  15. package/build/codemods/src/v5/remove-overloads/transformers/query-fn-aware-usage-transformer.cjs +0 -185
  16. package/build/codemods/src/v5/remove-overloads/utils/index.cjs +0 -123
  17. package/build/codemods/src/v5/remove-overloads/utils/unknown-usage-error.cjs +0 -27
  18. package/build/codemods/src/v5/rename-hydrate/rename-hydrate.cjs +0 -55
  19. package/build/codemods/src/v5/rename-properties/rename-properties.cjs +0 -41
  20. package/build/legacy/HydrationBoundary.cjs +0 -82
  21. package/build/legacy/HydrationBoundary.cjs.map +0 -1
  22. package/build/legacy/HydrationBoundary.d.cts +0 -2
  23. package/build/legacy/HydrationBoundary.d.ts +0 -2
  24. package/build/legacy/HydrationBoundary.js +0 -57
  25. package/build/legacy/HydrationBoundary.js.map +0 -1
  26. package/build/legacy/IsRestoringProvider.cjs +0 -37
  27. package/build/legacy/IsRestoringProvider.cjs.map +0 -1
  28. package/build/legacy/IsRestoringProvider.d.cts +0 -2
  29. package/build/legacy/IsRestoringProvider.d.ts +0 -2
  30. package/build/legacy/IsRestoringProvider.js +0 -11
  31. package/build/legacy/IsRestoringProvider.js.map +0 -1
  32. package/build/legacy/QueryClientProvider.cjs +0 -62
  33. package/build/legacy/QueryClientProvider.cjs.map +0 -1
  34. package/build/legacy/QueryClientProvider.d.cts +0 -4
  35. package/build/legacy/QueryClientProvider.d.ts +0 -4
  36. package/build/legacy/QueryClientProvider.js +0 -35
  37. package/build/legacy/QueryClientProvider.js.map +0 -1
  38. package/build/legacy/QueryErrorResetBoundary.cjs +0 -57
  39. package/build/legacy/QueryErrorResetBoundary.cjs.map +0 -1
  40. package/build/legacy/QueryErrorResetBoundary.d.cts +0 -8
  41. package/build/legacy/QueryErrorResetBoundary.d.ts +0 -8
  42. package/build/legacy/QueryErrorResetBoundary.js +0 -31
  43. package/build/legacy/QueryErrorResetBoundary.js.map +0 -1
  44. package/build/legacy/_tsup-dts-rollup.d.cts +0 -985
  45. package/build/legacy/_tsup-dts-rollup.d.ts +0 -985
  46. package/build/legacy/errorBoundaryUtils.cjs +0 -57
  47. package/build/legacy/errorBoundaryUtils.cjs.map +0 -1
  48. package/build/legacy/errorBoundaryUtils.d.cts +0 -3
  49. package/build/legacy/errorBoundaryUtils.d.ts +0 -3
  50. package/build/legacy/errorBoundaryUtils.js +0 -30
  51. package/build/legacy/errorBoundaryUtils.js.map +0 -1
  52. package/build/legacy/index.cjs +0 -97
  53. package/build/legacy/index.cjs.map +0 -1
  54. package/build/legacy/index.d.cts +0 -206
  55. package/build/legacy/index.d.ts +0 -206
  56. package/build/legacy/index.js +0 -54
  57. package/build/legacy/index.js.map +0 -1
  58. package/build/legacy/infiniteQueryOptions.cjs +0 -33
  59. package/build/legacy/infiniteQueryOptions.cjs.map +0 -1
  60. package/build/legacy/infiniteQueryOptions.d.cts +0 -4
  61. package/build/legacy/infiniteQueryOptions.d.ts +0 -4
  62. package/build/legacy/infiniteQueryOptions.js +0 -8
  63. package/build/legacy/infiniteQueryOptions.js.map +0 -1
  64. package/build/legacy/mutationOptions.cjs +0 -33
  65. package/build/legacy/mutationOptions.cjs.map +0 -1
  66. package/build/legacy/mutationOptions.d.cts +0 -1
  67. package/build/legacy/mutationOptions.d.ts +0 -1
  68. package/build/legacy/mutationOptions.js +0 -8
  69. package/build/legacy/mutationOptions.js.map +0 -1
  70. package/build/legacy/queryOptions.cjs +0 -33
  71. package/build/legacy/queryOptions.cjs.map +0 -1
  72. package/build/legacy/queryOptions.d.cts +0 -4
  73. package/build/legacy/queryOptions.d.ts +0 -4
  74. package/build/legacy/queryOptions.js +0 -8
  75. package/build/legacy/queryOptions.js.map +0 -1
  76. package/build/legacy/suspense.cjs +0 -58
  77. package/build/legacy/suspense.cjs.map +0 -1
  78. package/build/legacy/suspense.d.cts +0 -5
  79. package/build/legacy/suspense.d.ts +0 -5
  80. package/build/legacy/suspense.js +0 -29
  81. package/build/legacy/suspense.js.map +0 -1
  82. package/build/legacy/types.cjs +0 -19
  83. package/build/legacy/types.cjs.map +0 -1
  84. package/build/legacy/types.d.cts +0 -24
  85. package/build/legacy/types.d.ts +0 -24
  86. package/build/legacy/types.js +0 -1
  87. package/build/legacy/types.js.map +0 -1
  88. package/build/legacy/useBaseQuery.cjs +0 -121
  89. package/build/legacy/useBaseQuery.cjs.map +0 -1
  90. package/build/legacy/useBaseQuery.d.cts +0 -1
  91. package/build/legacy/useBaseQuery.d.ts +0 -1
  92. package/build/legacy/useBaseQuery.js +0 -105
  93. package/build/legacy/useBaseQuery.js.map +0 -1
  94. package/build/legacy/useInfiniteQuery.cjs +0 -39
  95. package/build/legacy/useInfiniteQuery.cjs.map +0 -1
  96. package/build/legacy/useInfiniteQuery.d.cts +0 -1
  97. package/build/legacy/useInfiniteQuery.d.ts +0 -1
  98. package/build/legacy/useInfiniteQuery.js +0 -14
  99. package/build/legacy/useInfiniteQuery.js.map +0 -1
  100. package/build/legacy/useIsFetching.cjs +0 -45
  101. package/build/legacy/useIsFetching.cjs.map +0 -1
  102. package/build/legacy/useIsFetching.d.cts +0 -1
  103. package/build/legacy/useIsFetching.d.ts +0 -1
  104. package/build/legacy/useIsFetching.js +0 -20
  105. package/build/legacy/useIsFetching.js.map +0 -1
  106. package/build/legacy/useMutation.cjs +0 -63
  107. package/build/legacy/useMutation.cjs.map +0 -1
  108. package/build/legacy/useMutation.d.cts +0 -1
  109. package/build/legacy/useMutation.d.ts +0 -1
  110. package/build/legacy/useMutation.js +0 -43
  111. package/build/legacy/useMutation.js.map +0 -1
  112. package/build/legacy/useMutationState.cjs +0 -75
  113. package/build/legacy/useMutationState.cjs.map +0 -1
  114. package/build/legacy/useMutationState.d.cts +0 -2
  115. package/build/legacy/useMutationState.d.ts +0 -2
  116. package/build/legacy/useMutationState.js +0 -49
  117. package/build/legacy/useMutationState.js.map +0 -1
  118. package/build/legacy/usePrefetchInfiniteQuery.cjs +0 -37
  119. package/build/legacy/usePrefetchInfiniteQuery.cjs.map +0 -1
  120. package/build/legacy/usePrefetchInfiniteQuery.d.cts +0 -1
  121. package/build/legacy/usePrefetchInfiniteQuery.d.ts +0 -1
  122. package/build/legacy/usePrefetchInfiniteQuery.js +0 -12
  123. package/build/legacy/usePrefetchInfiniteQuery.js.map +0 -1
  124. package/build/legacy/usePrefetchQuery.cjs +0 -37
  125. package/build/legacy/usePrefetchQuery.cjs.map +0 -1
  126. package/build/legacy/usePrefetchQuery.d.cts +0 -1
  127. package/build/legacy/usePrefetchQuery.d.ts +0 -1
  128. package/build/legacy/usePrefetchQuery.js +0 -12
  129. package/build/legacy/usePrefetchQuery.js.map +0 -1
  130. package/build/legacy/useQueries.cjs +0 -116
  131. package/build/legacy/useQueries.cjs.map +0 -1
  132. package/build/legacy/useQueries.d.cts +0 -3
  133. package/build/legacy/useQueries.d.ts +0 -3
  134. package/build/legacy/useQueries.js +0 -104
  135. package/build/legacy/useQueries.js.map +0 -1
  136. package/build/legacy/useQuery.cjs +0 -35
  137. package/build/legacy/useQuery.cjs.map +0 -1
  138. package/build/legacy/useQuery.d.cts +0 -1
  139. package/build/legacy/useQuery.d.ts +0 -1
  140. package/build/legacy/useQuery.js +0 -10
  141. package/build/legacy/useQuery.js.map +0 -1
  142. package/build/legacy/useSuspenseInfiniteQuery.cjs +0 -50
  143. package/build/legacy/useSuspenseInfiniteQuery.cjs.map +0 -1
  144. package/build/legacy/useSuspenseInfiniteQuery.d.cts +0 -1
  145. package/build/legacy/useSuspenseInfiniteQuery.d.ts +0 -1
  146. package/build/legacy/useSuspenseInfiniteQuery.js +0 -25
  147. package/build/legacy/useSuspenseInfiniteQuery.js.map +0 -1
  148. package/build/legacy/useSuspenseQueries.cjs +0 -55
  149. package/build/legacy/useSuspenseQueries.cjs.map +0 -1
  150. package/build/legacy/useSuspenseQueries.d.cts +0 -3
  151. package/build/legacy/useSuspenseQueries.d.ts +0 -3
  152. package/build/legacy/useSuspenseQueries.js +0 -30
  153. package/build/legacy/useSuspenseQueries.js.map +0 -1
  154. package/build/legacy/useSuspenseQuery.cjs +0 -51
  155. package/build/legacy/useSuspenseQuery.cjs.map +0 -1
  156. package/build/legacy/useSuspenseQuery.d.cts +0 -1
  157. package/build/legacy/useSuspenseQuery.d.ts +0 -1
  158. package/build/legacy/useSuspenseQuery.js +0 -26
  159. package/build/legacy/useSuspenseQuery.js.map +0 -1
  160. package/build/legacy/utils.cjs +0 -79
  161. package/build/legacy/utils.cjs.map +0 -1
  162. package/build/legacy/utils.d.cts +0 -2
  163. package/build/legacy/utils.d.ts +0 -2
  164. package/build/legacy/utils.js +0 -53
  165. package/build/legacy/utils.js.map +0 -1
  166. package/build/modern/HydrationBoundary.cjs +0 -82
  167. package/build/modern/HydrationBoundary.cjs.map +0 -1
  168. package/build/modern/HydrationBoundary.d.cts +0 -2
  169. package/build/modern/HydrationBoundary.d.ts +0 -2
  170. package/build/modern/HydrationBoundary.js +0 -57
  171. package/build/modern/HydrationBoundary.js.map +0 -1
  172. package/build/modern/IsRestoringProvider.cjs +0 -37
  173. package/build/modern/IsRestoringProvider.cjs.map +0 -1
  174. package/build/modern/IsRestoringProvider.d.cts +0 -2
  175. package/build/modern/IsRestoringProvider.d.ts +0 -2
  176. package/build/modern/IsRestoringProvider.js +0 -11
  177. package/build/modern/IsRestoringProvider.js.map +0 -1
  178. package/build/modern/QueryClientProvider.cjs +0 -62
  179. package/build/modern/QueryClientProvider.cjs.map +0 -1
  180. package/build/modern/QueryClientProvider.d.cts +0 -4
  181. package/build/modern/QueryClientProvider.d.ts +0 -4
  182. package/build/modern/QueryClientProvider.js +0 -35
  183. package/build/modern/QueryClientProvider.js.map +0 -1
  184. package/build/modern/QueryErrorResetBoundary.cjs +0 -57
  185. package/build/modern/QueryErrorResetBoundary.cjs.map +0 -1
  186. package/build/modern/QueryErrorResetBoundary.d.cts +0 -8
  187. package/build/modern/QueryErrorResetBoundary.d.ts +0 -8
  188. package/build/modern/QueryErrorResetBoundary.js +0 -31
  189. package/build/modern/QueryErrorResetBoundary.js.map +0 -1
  190. package/build/modern/_tsup-dts-rollup.d.cts +0 -985
  191. package/build/modern/_tsup-dts-rollup.d.ts +0 -985
  192. package/build/modern/errorBoundaryUtils.cjs +0 -57
  193. package/build/modern/errorBoundaryUtils.cjs.map +0 -1
  194. package/build/modern/errorBoundaryUtils.d.cts +0 -3
  195. package/build/modern/errorBoundaryUtils.d.ts +0 -3
  196. package/build/modern/errorBoundaryUtils.js +0 -30
  197. package/build/modern/errorBoundaryUtils.js.map +0 -1
  198. package/build/modern/index.cjs +0 -97
  199. package/build/modern/index.cjs.map +0 -1
  200. package/build/modern/index.d.cts +0 -206
  201. package/build/modern/index.d.ts +0 -206
  202. package/build/modern/index.js +0 -54
  203. package/build/modern/index.js.map +0 -1
  204. package/build/modern/infiniteQueryOptions.cjs +0 -33
  205. package/build/modern/infiniteQueryOptions.cjs.map +0 -1
  206. package/build/modern/infiniteQueryOptions.d.cts +0 -4
  207. package/build/modern/infiniteQueryOptions.d.ts +0 -4
  208. package/build/modern/infiniteQueryOptions.js +0 -8
  209. package/build/modern/infiniteQueryOptions.js.map +0 -1
  210. package/build/modern/mutationOptions.cjs +0 -33
  211. package/build/modern/mutationOptions.cjs.map +0 -1
  212. package/build/modern/mutationOptions.d.cts +0 -1
  213. package/build/modern/mutationOptions.d.ts +0 -1
  214. package/build/modern/mutationOptions.js +0 -8
  215. package/build/modern/mutationOptions.js.map +0 -1
  216. package/build/modern/queryOptions.cjs +0 -33
  217. package/build/modern/queryOptions.cjs.map +0 -1
  218. package/build/modern/queryOptions.d.cts +0 -4
  219. package/build/modern/queryOptions.d.ts +0 -4
  220. package/build/modern/queryOptions.js +0 -8
  221. package/build/modern/queryOptions.js.map +0 -1
  222. package/build/modern/suspense.cjs +0 -58
  223. package/build/modern/suspense.cjs.map +0 -1
  224. package/build/modern/suspense.d.cts +0 -5
  225. package/build/modern/suspense.d.ts +0 -5
  226. package/build/modern/suspense.js +0 -29
  227. package/build/modern/suspense.js.map +0 -1
  228. package/build/modern/types.cjs +0 -19
  229. package/build/modern/types.cjs.map +0 -1
  230. package/build/modern/types.d.cts +0 -24
  231. package/build/modern/types.d.ts +0 -24
  232. package/build/modern/types.js +0 -1
  233. package/build/modern/types.js.map +0 -1
  234. package/build/modern/useBaseQuery.cjs +0 -118
  235. package/build/modern/useBaseQuery.cjs.map +0 -1
  236. package/build/modern/useBaseQuery.d.cts +0 -1
  237. package/build/modern/useBaseQuery.d.ts +0 -1
  238. package/build/modern/useBaseQuery.js +0 -102
  239. package/build/modern/useBaseQuery.js.map +0 -1
  240. package/build/modern/useInfiniteQuery.cjs +0 -39
  241. package/build/modern/useInfiniteQuery.cjs.map +0 -1
  242. package/build/modern/useInfiniteQuery.d.cts +0 -1
  243. package/build/modern/useInfiniteQuery.d.ts +0 -1
  244. package/build/modern/useInfiniteQuery.js +0 -14
  245. package/build/modern/useInfiniteQuery.js.map +0 -1
  246. package/build/modern/useIsFetching.cjs +0 -45
  247. package/build/modern/useIsFetching.cjs.map +0 -1
  248. package/build/modern/useIsFetching.d.cts +0 -1
  249. package/build/modern/useIsFetching.d.ts +0 -1
  250. package/build/modern/useIsFetching.js +0 -20
  251. package/build/modern/useIsFetching.js.map +0 -1
  252. package/build/modern/useMutation.cjs +0 -63
  253. package/build/modern/useMutation.cjs.map +0 -1
  254. package/build/modern/useMutation.d.cts +0 -1
  255. package/build/modern/useMutation.d.ts +0 -1
  256. package/build/modern/useMutation.js +0 -43
  257. package/build/modern/useMutation.js.map +0 -1
  258. package/build/modern/useMutationState.cjs +0 -75
  259. package/build/modern/useMutationState.cjs.map +0 -1
  260. package/build/modern/useMutationState.d.cts +0 -2
  261. package/build/modern/useMutationState.d.ts +0 -2
  262. package/build/modern/useMutationState.js +0 -49
  263. package/build/modern/useMutationState.js.map +0 -1
  264. package/build/modern/usePrefetchInfiniteQuery.cjs +0 -37
  265. package/build/modern/usePrefetchInfiniteQuery.cjs.map +0 -1
  266. package/build/modern/usePrefetchInfiniteQuery.d.cts +0 -1
  267. package/build/modern/usePrefetchInfiniteQuery.d.ts +0 -1
  268. package/build/modern/usePrefetchInfiniteQuery.js +0 -12
  269. package/build/modern/usePrefetchInfiniteQuery.js.map +0 -1
  270. package/build/modern/usePrefetchQuery.cjs +0 -37
  271. package/build/modern/usePrefetchQuery.cjs.map +0 -1
  272. package/build/modern/usePrefetchQuery.d.cts +0 -1
  273. package/build/modern/usePrefetchQuery.d.ts +0 -1
  274. package/build/modern/usePrefetchQuery.js +0 -12
  275. package/build/modern/usePrefetchQuery.js.map +0 -1
  276. package/build/modern/useQueries.cjs +0 -116
  277. package/build/modern/useQueries.cjs.map +0 -1
  278. package/build/modern/useQueries.d.cts +0 -3
  279. package/build/modern/useQueries.d.ts +0 -3
  280. package/build/modern/useQueries.js +0 -104
  281. package/build/modern/useQueries.js.map +0 -1
  282. package/build/modern/useQuery.cjs +0 -35
  283. package/build/modern/useQuery.cjs.map +0 -1
  284. package/build/modern/useQuery.d.cts +0 -1
  285. package/build/modern/useQuery.d.ts +0 -1
  286. package/build/modern/useQuery.js +0 -10
  287. package/build/modern/useQuery.js.map +0 -1
  288. package/build/modern/useSuspenseInfiniteQuery.cjs +0 -50
  289. package/build/modern/useSuspenseInfiniteQuery.cjs.map +0 -1
  290. package/build/modern/useSuspenseInfiniteQuery.d.cts +0 -1
  291. package/build/modern/useSuspenseInfiniteQuery.d.ts +0 -1
  292. package/build/modern/useSuspenseInfiniteQuery.js +0 -25
  293. package/build/modern/useSuspenseInfiniteQuery.js.map +0 -1
  294. package/build/modern/useSuspenseQueries.cjs +0 -55
  295. package/build/modern/useSuspenseQueries.cjs.map +0 -1
  296. package/build/modern/useSuspenseQueries.d.cts +0 -3
  297. package/build/modern/useSuspenseQueries.d.ts +0 -3
  298. package/build/modern/useSuspenseQueries.js +0 -30
  299. package/build/modern/useSuspenseQueries.js.map +0 -1
  300. package/build/modern/useSuspenseQuery.cjs +0 -51
  301. package/build/modern/useSuspenseQuery.cjs.map +0 -1
  302. package/build/modern/useSuspenseQuery.d.cts +0 -1
  303. package/build/modern/useSuspenseQuery.d.ts +0 -1
  304. package/build/modern/useSuspenseQuery.js +0 -26
  305. package/build/modern/useSuspenseQuery.js.map +0 -1
  306. package/build/modern/utils.cjs +0 -79
  307. package/build/modern/utils.cjs.map +0 -1
  308. package/build/modern/utils.d.cts +0 -2
  309. package/build/modern/utils.d.ts +0 -2
  310. package/build/modern/utils.js +0 -53
  311. package/build/modern/utils.js.map +0 -1
  312. package/build/query-codemods/eslint.config.js +0 -18
  313. package/build/query-codemods/package.json +0 -38
  314. package/build/query-codemods/root.eslint.config.js +0 -64
  315. package/build/query-codemods/tsconfig.json +0 -8
  316. package/build/query-codemods/vite.config.ts +0 -30
@@ -1,55 +0,0 @@
1
- module.exports = (file, api) => {
2
- const jscodeshift = api.jscodeshift
3
- const root = jscodeshift(file.source)
4
-
5
- const importSpecifiers = root
6
- .find(jscodeshift.ImportDeclaration, {
7
- source: {
8
- value: '@tanstack/react-query',
9
- },
10
- })
11
- .find(jscodeshift.ImportSpecifier, {
12
- imported: {
13
- name: 'Hydrate',
14
- },
15
- })
16
-
17
- if (importSpecifiers.length > 0) {
18
- const names = {
19
- searched: 'Hydrate', // By default, we want to replace the `Hydrate` usages.
20
- target: 'HydrationBoundary', // We want to replace them with `HydrationBoundary`.
21
- }
22
-
23
- importSpecifiers.replaceWith(({ node: mutableNode }) => {
24
- /**
25
- * When the local and imported names match which means the code doesn't contain import aliases, we need
26
- * to replace only the import specifier.
27
- * @type {boolean}
28
- */
29
- const usesDefaultImport =
30
- mutableNode.local.name === mutableNode.imported.name
31
-
32
- if (!usesDefaultImport) {
33
- // If the code uses import aliases, we must re-use the alias.
34
- names.searched = mutableNode.local.name
35
- names.target = mutableNode.local.name
36
- }
37
-
38
- // Override the import specifier.
39
- mutableNode.imported.name = 'HydrationBoundary'
40
-
41
- return mutableNode
42
- })
43
-
44
- root
45
- .findJSXElements(names.searched)
46
- .replaceWith(({ node: mutableNode }) => {
47
- mutableNode.openingElement.name.name = names.target
48
- mutableNode.closingElement.name.name = names.target
49
-
50
- return mutableNode
51
- })
52
- }
53
-
54
- return root.toSource({ quote: 'single', lineTerminator: '\n' })
55
- }
@@ -1,41 +0,0 @@
1
- module.exports = (file, api) => {
2
- const jscodeshift = api.jscodeshift
3
- const root = jscodeshift(file.source)
4
-
5
- const baseRenameLogic = (kind, from, to) => {
6
- root
7
- .find(kind, (node) => {
8
- return (
9
- node.computed === false &&
10
- (node.key?.name === from || node.key?.value === from)
11
- )
12
- })
13
- .replaceWith(({ node: mutableNode }) => {
14
- if (mutableNode.key.name !== undefined) {
15
- mutableNode.key.name = to
16
- }
17
-
18
- if (mutableNode.key.value !== undefined) {
19
- mutableNode.key.value = to
20
- }
21
-
22
- return mutableNode
23
- })
24
- }
25
-
26
- const renameObjectProperty = (from, to) => {
27
- baseRenameLogic(jscodeshift.ObjectProperty, from, to)
28
- }
29
-
30
- const renameTypeScriptPropertySignature = (from, to) => {
31
- baseRenameLogic(jscodeshift.TSPropertySignature, from, to)
32
- }
33
-
34
- renameObjectProperty('cacheTime', 'gcTime')
35
- renameObjectProperty('useErrorBoundary', 'throwOnError')
36
-
37
- renameTypeScriptPropertySignature('cacheTime', 'gcTime')
38
- renameTypeScriptPropertySignature('useErrorBoundary', 'throwOnError')
39
-
40
- return root.toSource({ quote: 'single', lineTerminator: '\n' })
41
- }
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/HydrationBoundary.tsx
21
- var HydrationBoundary_exports = {};
22
- __export(HydrationBoundary_exports, {
23
- HydrationBoundary: () => HydrationBoundary
24
- });
25
- module.exports = __toCommonJS(HydrationBoundary_exports);
26
- var import_query_core = require("@tanstack/query-core");
27
- var import_preact = require("preact");
28
- var import_hooks = require("preact/hooks");
29
- var import_QueryClientProvider = require("./QueryClientProvider.cjs");
30
- var import_jsx_runtime = require("preact/jsx-runtime");
31
- var HydrationBoundary = ({
32
- children,
33
- options = {},
34
- state,
35
- queryClient
36
- }) => {
37
- const client = (0, import_QueryClientProvider.useQueryClient)(queryClient);
38
- const optionsRef = (0, import_hooks.useRef)(options);
39
- (0, import_hooks.useEffect)(() => {
40
- optionsRef.current = options;
41
- });
42
- const hydrationQueue = (0, import_hooks.useMemo)(() => {
43
- if (state) {
44
- if (typeof state !== "object") {
45
- return;
46
- }
47
- const queryCache = client.getQueryCache();
48
- const queries = state.queries || [];
49
- const newQueries = [];
50
- const existingQueries = [];
51
- for (const dehydratedQuery of queries) {
52
- const existingQuery = queryCache.get(dehydratedQuery.queryHash);
53
- if (!existingQuery) {
54
- newQueries.push(dehydratedQuery);
55
- } else {
56
- const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt;
57
- if (hydrationIsNewer) {
58
- existingQueries.push(dehydratedQuery);
59
- }
60
- }
61
- }
62
- if (newQueries.length > 0) {
63
- (0, import_query_core.hydrate)(client, { queries: newQueries }, optionsRef.current);
64
- }
65
- if (existingQueries.length > 0) {
66
- return existingQueries;
67
- }
68
- }
69
- return void 0;
70
- }, [client, state]);
71
- (0, import_hooks.useEffect)(() => {
72
- if (hydrationQueue) {
73
- (0, import_query_core.hydrate)(client, { queries: hydrationQueue }, optionsRef.current);
74
- }
75
- }, [client, hydrationQueue]);
76
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_preact.Fragment, { children });
77
- };
78
- // Annotate the CommonJS export names for ESM import in node:
79
- 0 && (module.exports = {
80
- HydrationBoundary
81
- });
82
- //# sourceMappingURL=HydrationBoundary.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAwB;AAOxB,oBAAyB;AAEzB,mBAA2C;AAE3C,iCAA+B;AAgGtB;AAlFF,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AACF,MAA8B;AAC5B,QAAM,aAAS,2CAAe,WAAW;AAEzC,QAAM,iBAAa,qBAAO,OAAO;AACjC,8BAAU,MAAM;AACd,eAAW,UAAU;AAAA,EACvB,CAAC;AAiBD,QAAM,qBAAyD,sBAAQ,MAAM;AAC3E,QAAI,OAAO;AACT,UAAI,OAAO,UAAU,UAAU;AAC7B;AAAA,MACF;AAEA,YAAM,aAAa,OAAO,cAAc;AAKxC,YAAM,UAAU,MAAM,WAAW,CAAC;AAElC,YAAM,aAAyC,CAAC;AAChD,YAAM,kBAA8C,CAAC;AACrD,iBAAW,mBAAmB,SAAS;AACrC,cAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;AAE9D,YAAI,CAAC,eAAe;AAClB,qBAAW,KAAK,eAAe;AAAA,QACjC,OAAO;AACL,gBAAM,mBACJ,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,UACjC,gBAAgB,eAAe,cAAc,MAAM;AAEvD,cAAI,kBAAkB;AACpB,4BAAgB,KAAK,eAAe;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAEA,UAAI,WAAW,SAAS,GAAG;AAGzB,uCAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;AAAA,MAC7D;AACA,UAAI,gBAAgB,SAAS,GAAG;AAC9B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,KAAK,CAAC;AAElB,8BAAU,MAAM;AACd,QAAI,gBAAgB;AAClB,qCAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;AAAA,IACjE;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO,4CAAC,0BAAU,UAAS;AAC7B;","names":[]}
@@ -1,2 +0,0 @@
1
- export { HydrationBoundaryProps } from './_tsup-dts-rollup.cjs';
2
- export { HydrationBoundary } from './_tsup-dts-rollup.cjs';
@@ -1,2 +0,0 @@
1
- export { HydrationBoundaryProps } from './_tsup-dts-rollup.js';
2
- export { HydrationBoundary } from './_tsup-dts-rollup.js';
@@ -1,57 +0,0 @@
1
- // src/HydrationBoundary.tsx
2
- import { hydrate } from "@tanstack/query-core";
3
- import { Fragment } from "preact";
4
- import { useEffect, useMemo, useRef } from "preact/hooks";
5
- import { useQueryClient } from "./QueryClientProvider.js";
6
- import { jsx } from "preact/jsx-runtime";
7
- var HydrationBoundary = ({
8
- children,
9
- options = {},
10
- state,
11
- queryClient
12
- }) => {
13
- const client = useQueryClient(queryClient);
14
- const optionsRef = useRef(options);
15
- useEffect(() => {
16
- optionsRef.current = options;
17
- });
18
- const hydrationQueue = useMemo(() => {
19
- if (state) {
20
- if (typeof state !== "object") {
21
- return;
22
- }
23
- const queryCache = client.getQueryCache();
24
- const queries = state.queries || [];
25
- const newQueries = [];
26
- const existingQueries = [];
27
- for (const dehydratedQuery of queries) {
28
- const existingQuery = queryCache.get(dehydratedQuery.queryHash);
29
- if (!existingQuery) {
30
- newQueries.push(dehydratedQuery);
31
- } else {
32
- const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt;
33
- if (hydrationIsNewer) {
34
- existingQueries.push(dehydratedQuery);
35
- }
36
- }
37
- }
38
- if (newQueries.length > 0) {
39
- hydrate(client, { queries: newQueries }, optionsRef.current);
40
- }
41
- if (existingQueries.length > 0) {
42
- return existingQueries;
43
- }
44
- }
45
- return void 0;
46
- }, [client, state]);
47
- useEffect(() => {
48
- if (hydrationQueue) {
49
- hydrate(client, { queries: hydrationQueue }, optionsRef.current);
50
- }
51
- }, [client, hydrationQueue]);
52
- return /* @__PURE__ */ jsx(Fragment, { children });
53
- };
54
- export {
55
- HydrationBoundary
56
- };
57
- //# sourceMappingURL=HydrationBoundary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/query-core'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\nimport { Fragment } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useEffect, useMemo, useRef } from 'preact/hooks'\n\nimport { useQueryClient } from './QueryClientProvider'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: ComponentChildren\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = useRef(options)\n useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined = useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return <Fragment>{children}</Fragment>\n}\n"],"mappings":";AAAA,SAAS,eAAe;AAOxB,SAAS,gBAAgB;AAEzB,SAAS,WAAW,SAAS,cAAc;AAE3C,SAAS,sBAAsB;AAgGtB;AAlFF,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AACF,MAA8B;AAC5B,QAAM,SAAS,eAAe,WAAW;AAEzC,QAAM,aAAa,OAAO,OAAO;AACjC,YAAU,MAAM;AACd,eAAW,UAAU;AAAA,EACvB,CAAC;AAiBD,QAAM,iBAAyD,QAAQ,MAAM;AAC3E,QAAI,OAAO;AACT,UAAI,OAAO,UAAU,UAAU;AAC7B;AAAA,MACF;AAEA,YAAM,aAAa,OAAO,cAAc;AAKxC,YAAM,UAAU,MAAM,WAAW,CAAC;AAElC,YAAM,aAAyC,CAAC;AAChD,YAAM,kBAA8C,CAAC;AACrD,iBAAW,mBAAmB,SAAS;AACrC,cAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;AAE9D,YAAI,CAAC,eAAe;AAClB,qBAAW,KAAK,eAAe;AAAA,QACjC,OAAO;AACL,gBAAM,mBACJ,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,UACjC,gBAAgB,eAAe,cAAc,MAAM;AAEvD,cAAI,kBAAkB;AACpB,4BAAgB,KAAK,eAAe;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAEA,UAAI,WAAW,SAAS,GAAG;AAGzB,gBAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;AAAA,MAC7D;AACA,UAAI,gBAAgB,SAAS,GAAG;AAC9B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,KAAK,CAAC;AAElB,YAAU,MAAM;AACd,QAAI,gBAAgB;AAClB,cAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;AAAA,IACjE;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO,oBAAC,YAAU,UAAS;AAC7B;","names":[]}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/IsRestoringProvider.ts
21
- var IsRestoringProvider_exports = {};
22
- __export(IsRestoringProvider_exports, {
23
- IsRestoringProvider: () => IsRestoringProvider,
24
- useIsRestoring: () => useIsRestoring
25
- });
26
- module.exports = __toCommonJS(IsRestoringProvider_exports);
27
- var import_preact = require("preact");
28
- var import_hooks = require("preact/hooks");
29
- var IsRestoringContext = (0, import_preact.createContext)(false);
30
- var useIsRestoring = () => (0, import_hooks.useContext)(IsRestoringContext);
31
- var IsRestoringProvider = IsRestoringContext.Provider;
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- IsRestoringProvider,
35
- useIsRestoring
36
- });
37
- //# sourceMappingURL=IsRestoringProvider.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["import { createContext } from 'preact'\nimport { useContext } from 'preact/hooks'\n\nconst IsRestoringContext = createContext(false)\n\nexport const useIsRestoring = () => useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA8B;AAC9B,mBAA2B;AAE3B,IAAM,yBAAqB,6BAAc,KAAK;AAEvC,IAAM,iBAAiB,UAAM,yBAAW,kBAAkB;AAC1D,IAAM,sBAAsB,mBAAmB;","names":[]}
@@ -1,2 +0,0 @@
1
- export { useIsRestoring } from './_tsup-dts-rollup.cjs';
2
- export { IsRestoringProvider } from './_tsup-dts-rollup.cjs';
@@ -1,2 +0,0 @@
1
- export { useIsRestoring } from './_tsup-dts-rollup.js';
2
- export { IsRestoringProvider } from './_tsup-dts-rollup.js';
@@ -1,11 +0,0 @@
1
- // src/IsRestoringProvider.ts
2
- import { createContext } from "preact";
3
- import { useContext } from "preact/hooks";
4
- var IsRestoringContext = createContext(false);
5
- var useIsRestoring = () => useContext(IsRestoringContext);
6
- var IsRestoringProvider = IsRestoringContext.Provider;
7
- export {
8
- IsRestoringProvider,
9
- useIsRestoring
10
- };
11
- //# sourceMappingURL=IsRestoringProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["import { createContext } from 'preact'\nimport { useContext } from 'preact/hooks'\n\nconst IsRestoringContext = createContext(false)\n\nexport const useIsRestoring = () => useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAE3B,IAAM,qBAAqB,cAAc,KAAK;AAEvC,IAAM,iBAAiB,MAAM,WAAW,kBAAkB;AAC1D,IAAM,sBAAsB,mBAAmB;","names":[]}
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/QueryClientProvider.tsx
21
- var QueryClientProvider_exports = {};
22
- __export(QueryClientProvider_exports, {
23
- QueryClientContext: () => QueryClientContext,
24
- QueryClientProvider: () => QueryClientProvider,
25
- useQueryClient: () => useQueryClient
26
- });
27
- module.exports = __toCommonJS(QueryClientProvider_exports);
28
- var import_preact = require("preact");
29
- var import_hooks = require("preact/hooks");
30
- var import_jsx_runtime = require("preact/jsx-runtime");
31
- var QueryClientContext = (0, import_preact.createContext)(
32
- void 0
33
- );
34
- var useQueryClient = (queryClient) => {
35
- const client = (0, import_hooks.useContext)(QueryClientContext);
36
- if (queryClient) {
37
- return queryClient;
38
- }
39
- if (!client) {
40
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
41
- }
42
- return client;
43
- };
44
- var QueryClientProvider = ({
45
- client,
46
- children
47
- }) => {
48
- (0, import_hooks.useEffect)(() => {
49
- client.mount();
50
- return () => {
51
- client.unmount();
52
- };
53
- }, [client]);
54
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, { value: client, children });
55
- };
56
- // Annotate the CommonJS export names for ESM import in node:
57
- 0 && (module.exports = {
58
- QueryClientContext,
59
- QueryClientProvider,
60
- useQueryClient
61
- });
62
- //# sourceMappingURL=QueryClientProvider.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import type { QueryClient } from '@tanstack/query-core'\nimport { createContext } from 'preact'\nimport type { ComponentChildren, VNode } from 'preact'\nimport { useContext, useEffect } from 'preact/hooks'\n\nexport const QueryClientContext = createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: ComponentChildren\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): VNode => {\n useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA8B;AAE9B,mBAAsC;AAqClC;AAnCG,IAAM,yBAAqB;AAAA,EAChC;AACF;AAEO,IAAM,iBAAiB,CAAC,gBAA8B;AAC3D,QAAM,aAAS,yBAAW,kBAAkB;AAE5C,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,SAAO;AACT;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAuC;AACrC,8BAAU,MAAM;AACd,WAAO,MAAM;AACb,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SACE,4CAAC,mBAAmB,UAAnB,EAA4B,OAAO,QACjC,UACH;AAEJ;","names":[]}
@@ -1,4 +0,0 @@
1
- export { QueryClientContext } from './_tsup-dts-rollup.cjs';
2
- export { useQueryClient } from './_tsup-dts-rollup.cjs';
3
- export { QueryClientProviderProps } from './_tsup-dts-rollup.cjs';
4
- export { QueryClientProvider } from './_tsup-dts-rollup.cjs';
@@ -1,4 +0,0 @@
1
- export { QueryClientContext } from './_tsup-dts-rollup.js';
2
- export { useQueryClient } from './_tsup-dts-rollup.js';
3
- export { QueryClientProviderProps } from './_tsup-dts-rollup.js';
4
- export { QueryClientProvider } from './_tsup-dts-rollup.js';
@@ -1,35 +0,0 @@
1
- // src/QueryClientProvider.tsx
2
- import { createContext } from "preact";
3
- import { useContext, useEffect } from "preact/hooks";
4
- import { jsx } from "preact/jsx-runtime";
5
- var QueryClientContext = createContext(
6
- void 0
7
- );
8
- var useQueryClient = (queryClient) => {
9
- const client = useContext(QueryClientContext);
10
- if (queryClient) {
11
- return queryClient;
12
- }
13
- if (!client) {
14
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
15
- }
16
- return client;
17
- };
18
- var QueryClientProvider = ({
19
- client,
20
- children
21
- }) => {
22
- useEffect(() => {
23
- client.mount();
24
- return () => {
25
- client.unmount();
26
- };
27
- }, [client]);
28
- return /* @__PURE__ */ jsx(QueryClientContext.Provider, { value: client, children });
29
- };
30
- export {
31
- QueryClientContext,
32
- QueryClientProvider,
33
- useQueryClient
34
- };
35
- //# sourceMappingURL=QueryClientProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["import type { QueryClient } from '@tanstack/query-core'\nimport { createContext } from 'preact'\nimport type { ComponentChildren, VNode } from 'preact'\nimport { useContext, useEffect } from 'preact/hooks'\n\nexport const QueryClientContext = createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: ComponentChildren\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): VNode => {\n useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"mappings":";AACA,SAAS,qBAAqB;AAE9B,SAAS,YAAY,iBAAiB;AAqClC;AAnCG,IAAM,qBAAqB;AAAA,EAChC;AACF;AAEO,IAAM,iBAAiB,CAAC,gBAA8B;AAC3D,QAAM,SAAS,WAAW,kBAAkB;AAE5C,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,SAAO;AACT;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAuC;AACrC,YAAU,MAAM;AACd,WAAO,MAAM;AACb,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,QACjC,UACH;AAEJ;","names":[]}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/QueryErrorResetBoundary.tsx
21
- var QueryErrorResetBoundary_exports = {};
22
- __export(QueryErrorResetBoundary_exports, {
23
- QueryErrorResetBoundary: () => QueryErrorResetBoundary,
24
- useQueryErrorResetBoundary: () => useQueryErrorResetBoundary
25
- });
26
- module.exports = __toCommonJS(QueryErrorResetBoundary_exports);
27
- var import_preact = require("preact");
28
- var import_hooks = require("preact/hooks");
29
- var import_jsx_runtime = require("preact/jsx-runtime");
30
- function createValue() {
31
- let isReset = false;
32
- return {
33
- clearReset: () => {
34
- isReset = false;
35
- },
36
- reset: () => {
37
- isReset = true;
38
- },
39
- isReset: () => {
40
- return isReset;
41
- }
42
- };
43
- }
44
- var QueryErrorResetBoundaryContext = (0, import_preact.createContext)(createValue());
45
- var useQueryErrorResetBoundary = () => (0, import_hooks.useContext)(QueryErrorResetBoundaryContext);
46
- var QueryErrorResetBoundary = ({
47
- children
48
- }) => {
49
- const [value] = (0, import_hooks.useState)(() => createValue());
50
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children });
51
- };
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
54
- QueryErrorResetBoundary,
55
- useQueryErrorResetBoundary
56
- });
57
- //# sourceMappingURL=QueryErrorResetBoundary.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["import { createContext } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useContext, useState } from 'preact/hooks'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => ComponentChildren\n\nexport interface QueryErrorResetBoundaryProps {\n children: QueryErrorResetBoundaryFunction | ComponentChildren\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA8B;AAE9B,mBAAqC;AAkDjC;AArCJ,SAAS,cAA4C;AACnD,MAAI,UAAU;AACd,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,gBAAU;AAAA,IACZ;AAAA,IACA,OAAO,MAAM;AACX,gBAAU;AAAA,IACZ;AAAA,IACA,SAAS,MAAM;AACb,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,qCAAiC,6BAAc,YAAY,CAAC;AAI3D,IAAM,6BAA6B,UACxC,yBAAW,8BAA8B;AAYpC,IAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,CAAC,KAAK,QAAI,uBAAS,MAAM,YAAY,CAAC;AAC5C,SACE,4CAAC,+BAA+B,UAA/B,EAAwC,OACtC,iBAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACtD;AAEJ;","names":[]}
@@ -1,8 +0,0 @@
1
- export { QueryErrorResetFunction } from './_tsup-dts-rollup.cjs';
2
- export { QueryErrorIsResetFunction } from './_tsup-dts-rollup.cjs';
3
- export { QueryErrorClearResetFunction } from './_tsup-dts-rollup.cjs';
4
- export { QueryErrorResetBoundaryValue } from './_tsup-dts-rollup.cjs';
5
- export { useQueryErrorResetBoundary } from './_tsup-dts-rollup.cjs';
6
- export { QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.cjs';
7
- export { QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.cjs';
8
- export { QueryErrorResetBoundary } from './_tsup-dts-rollup.cjs';
@@ -1,8 +0,0 @@
1
- export { QueryErrorResetFunction } from './_tsup-dts-rollup.js';
2
- export { QueryErrorIsResetFunction } from './_tsup-dts-rollup.js';
3
- export { QueryErrorClearResetFunction } from './_tsup-dts-rollup.js';
4
- export { QueryErrorResetBoundaryValue } from './_tsup-dts-rollup.js';
5
- export { useQueryErrorResetBoundary } from './_tsup-dts-rollup.js';
6
- export { QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.js';
7
- export { QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.js';
8
- export { QueryErrorResetBoundary } from './_tsup-dts-rollup.js';
@@ -1,31 +0,0 @@
1
- // src/QueryErrorResetBoundary.tsx
2
- import { createContext } from "preact";
3
- import { useContext, useState } from "preact/hooks";
4
- import { jsx } from "preact/jsx-runtime";
5
- function createValue() {
6
- let isReset = false;
7
- return {
8
- clearReset: () => {
9
- isReset = false;
10
- },
11
- reset: () => {
12
- isReset = true;
13
- },
14
- isReset: () => {
15
- return isReset;
16
- }
17
- };
18
- }
19
- var QueryErrorResetBoundaryContext = createContext(createValue());
20
- var useQueryErrorResetBoundary = () => useContext(QueryErrorResetBoundaryContext);
21
- var QueryErrorResetBoundary = ({
22
- children
23
- }) => {
24
- const [value] = useState(() => createValue());
25
- return /* @__PURE__ */ jsx(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children });
26
- };
27
- export {
28
- QueryErrorResetBoundary,
29
- useQueryErrorResetBoundary
30
- };
31
- //# sourceMappingURL=QueryErrorResetBoundary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["import { createContext } from 'preact'\nimport type { ComponentChildren } from 'preact'\nimport { useContext, useState } from 'preact/hooks'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => ComponentChildren\n\nexport interface QueryErrorResetBoundaryProps {\n children: QueryErrorResetBoundaryFunction | ComponentChildren\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAE9B,SAAS,YAAY,gBAAgB;AAkDjC;AArCJ,SAAS,cAA4C;AACnD,MAAI,UAAU;AACd,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,gBAAU;AAAA,IACZ;AAAA,IACA,OAAO,MAAM;AACX,gBAAU;AAAA,IACZ;AAAA,IACA,SAAS,MAAM;AACb,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,iCAAiC,cAAc,YAAY,CAAC;AAI3D,IAAM,6BAA6B,MACxC,WAAW,8BAA8B;AAYpC,IAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,CAAC,KAAK,IAAI,SAAS,MAAM,YAAY,CAAC;AAC5C,SACE,oBAAC,+BAA+B,UAA/B,EAAwC,OACtC,iBAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACtD;AAEJ;","names":[]}