@tanstack/react-query-devtools 4.0.6 → 4.0.11-beta.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 (97) hide show
  1. package/build/{types/react-query-devtools/src → lib}/Explorer.d.ts +0 -0
  2. package/build/{types/react-query-devtools/src → lib}/Logo.d.ts +0 -0
  3. package/build/{types/react-query-devtools/src → lib}/devtools.d.ts +0 -0
  4. package/build/{types/react-query-devtools/src → lib}/index.d.ts +0 -0
  5. package/build/lib/index.js +2286 -0
  6. package/build/lib/index.js.map +1 -0
  7. package/build/{esm/index.js → lib/index.mjs} +282 -3
  8. package/build/lib/index.mjs.map +1 -0
  9. package/build/{types/react-query-devtools/src → lib}/noop.d.ts +0 -0
  10. package/build/{cjs/packages/react-query-devtools/src/index.js → lib/noop.js} +6 -8
  11. package/build/lib/noop.js.map +1 -0
  12. package/build/lib/noop.mjs +19 -0
  13. package/build/lib/noop.mjs.map +1 -0
  14. package/build/{types/react-query-devtools/src → lib}/styledComponents.d.ts +0 -0
  15. package/build/{types/react-query-devtools/src → lib}/theme.d.ts +0 -0
  16. package/build/{types/react-query-devtools/src → lib}/useLocalStorage.d.ts +0 -0
  17. package/build/{types/react-query-devtools/src → lib}/useMediaQuery.d.ts +0 -0
  18. package/build/lib/useSyncExternalStore.d.ts +1 -0
  19. package/build/lib/useSyncExternalStore.native.d.ts +1 -0
  20. package/build/{types/react-query-devtools/src → lib}/utils.d.ts +0 -0
  21. package/build/umd/index.development.js +263 -5
  22. package/build/umd/index.development.js.map +1 -1
  23. package/build/umd/index.production.js +1 -1
  24. package/build/umd/index.production.js.map +1 -1
  25. package/build/umd/noop.development.js +30 -0
  26. package/build/umd/noop.development.js.map +1 -0
  27. package/build/umd/noop.production.js +12 -0
  28. package/build/umd/noop.production.js.map +1 -0
  29. package/package.json +28 -12
  30. package/src/devtools.tsx +1 -1
  31. package/src/useSyncExternalStore.native.ts +3 -0
  32. package/src/useSyncExternalStore.ts +2 -0
  33. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -33
  34. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  35. package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js +0 -757
  36. package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js.map +0 -1
  37. package/build/cjs/packages/react-query-devtools/src/Explorer.js +0 -215
  38. package/build/cjs/packages/react-query-devtools/src/Explorer.js.map +0 -1
  39. package/build/cjs/packages/react-query-devtools/src/Logo.js +0 -66
  40. package/build/cjs/packages/react-query-devtools/src/Logo.js.map +0 -1
  41. package/build/cjs/packages/react-query-devtools/src/devtools.js +0 -805
  42. package/build/cjs/packages/react-query-devtools/src/devtools.js.map +0 -1
  43. package/build/cjs/packages/react-query-devtools/src/index.js.map +0 -1
  44. package/build/cjs/packages/react-query-devtools/src/styledComponents.js +0 -113
  45. package/build/cjs/packages/react-query-devtools/src/styledComponents.js.map +0 -1
  46. package/build/cjs/packages/react-query-devtools/src/theme.js +0 -68
  47. package/build/cjs/packages/react-query-devtools/src/theme.js.map +0 -1
  48. package/build/cjs/packages/react-query-devtools/src/useLocalStorage.js +0 -81
  49. package/build/cjs/packages/react-query-devtools/src/useLocalStorage.js.map +0 -1
  50. package/build/cjs/packages/react-query-devtools/src/useMediaQuery.js +0 -66
  51. package/build/cjs/packages/react-query-devtools/src/useMediaQuery.js.map +0 -1
  52. package/build/cjs/packages/react-query-devtools/src/utils.js +0 -113
  53. package/build/cjs/packages/react-query-devtools/src/utils.js.map +0 -1
  54. package/build/esm/index.js.map +0 -1
  55. package/build/esm/noop.js +0 -7
  56. package/build/stats-html.html +0 -2689
  57. package/build/stats.json +0 -298
  58. package/build/types/query-core/src/focusManager.d.ts +0 -16
  59. package/build/types/query-core/src/hydration.d.ts +0 -34
  60. package/build/types/query-core/src/index.d.ts +0 -20
  61. package/build/types/query-core/src/infiniteQueryBehavior.d.ts +0 -15
  62. package/build/types/query-core/src/infiniteQueryObserver.d.ts +0 -18
  63. package/build/types/query-core/src/logger.d.ts +0 -8
  64. package/build/types/query-core/src/mutation.d.ts +0 -70
  65. package/build/types/query-core/src/mutationCache.d.ts +0 -52
  66. package/build/types/query-core/src/mutationObserver.d.ts +0 -23
  67. package/build/types/query-core/src/notifyManager.d.ts +0 -18
  68. package/build/types/query-core/src/onlineManager.d.ts +0 -16
  69. package/build/types/query-core/src/queriesObserver.d.ts +0 -23
  70. package/build/types/query-core/src/query.d.ts +0 -119
  71. package/build/types/query-core/src/queryCache.d.ts +0 -59
  72. package/build/types/query-core/src/queryClient.d.ts +0 -65
  73. package/build/types/query-core/src/queryObserver.d.ts +0 -61
  74. package/build/types/query-core/src/removable.d.ts +0 -9
  75. package/build/types/query-core/src/retryer.d.ts +0 -33
  76. package/build/types/query-core/src/subscribable.d.ts +0 -10
  77. package/build/types/query-core/src/types.d.ts +0 -417
  78. package/build/types/query-core/src/utils.d.ts +0 -99
  79. package/build/types/react-query/src/Hydrate.d.ts +0 -10
  80. package/build/types/react-query/src/QueryClientProvider.d.ts +0 -24
  81. package/build/types/react-query/src/QueryErrorResetBoundary.d.ts +0 -12
  82. package/build/types/react-query/src/index.d.ts +0 -17
  83. package/build/types/react-query/src/isRestoring.d.ts +0 -3
  84. package/build/types/react-query/src/reactBatchedUpdates.d.ts +0 -2
  85. package/build/types/react-query/src/setBatchUpdatesFn.d.ts +0 -1
  86. package/build/types/react-query/src/types.d.ts +0 -35
  87. package/build/types/react-query/src/useBaseQuery.d.ts +0 -3
  88. package/build/types/react-query/src/useInfiniteQuery.d.ts +0 -5
  89. package/build/types/react-query/src/useIsFetching.d.ts +0 -7
  90. package/build/types/react-query/src/useIsMutating.d.ts +0 -7
  91. package/build/types/react-query/src/useMutation.d.ts +0 -6
  92. package/build/types/react-query/src/useQueries.d.ts +0 -49
  93. package/build/types/react-query/src/useQuery.d.ts +0 -20
  94. package/build/types/react-query/src/utils.d.ts +0 -1
  95. package/build/types/react-query-devtools/src/__tests__/Explorer.test.d.ts +0 -1
  96. package/build/types/react-query-devtools/src/__tests__/devtools.test.d.ts +0 -6
  97. package/build/types/react-query-devtools/src/__tests__/utils.d.ts +0 -22
@@ -9,10 +9,12 @@
9
9
  * @license MIT
10
10
  */
11
11
  (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('use-sync-external-store/shim'), require('@tanstack/react-query')) :
13
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'use-sync-external-store/shim', '@tanstack/react-query'], factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactQueryDevtools = {}, global.React, global.shim, global.ReactQuery));
15
- })(this, (function (exports, React, shim, reactQuery) { 'use strict';
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@tanstack/react-query')) :
13
+ typeof define === 'function' && define.amd ? define(['exports', 'react', '@tanstack/react-query'], factory) :
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactQueryDevtools = {}, global.React, global.ReactQuery));
15
+ })(this, (function (exports, React, reactQuery) { 'use strict';
16
+
17
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
18
 
17
19
  function _interopNamespace(e) {
18
20
  if (e && e.__esModule) return e;
@@ -32,6 +34,7 @@
32
34
  return Object.freeze(n);
33
35
  }
34
36
 
37
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
35
38
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
36
39
 
37
40
  function _extends() {
@@ -51,6 +54,261 @@
51
54
  return _extends.apply(this, arguments);
52
55
  }
53
56
 
57
+ var shim = {exports: {}};
58
+
59
+ var useSyncExternalStoreShim_development = {};
60
+
61
+ /**
62
+ * @license React
63
+ * use-sync-external-store-shim.development.js
64
+ *
65
+ * Copyright (c) Facebook, Inc. and its affiliates.
66
+ *
67
+ * This source code is licensed under the MIT license found in the
68
+ * LICENSE file in the root directory of this source tree.
69
+ */
70
+
71
+ var hasRequiredUseSyncExternalStoreShim_development;
72
+
73
+ function requireUseSyncExternalStoreShim_development () {
74
+ if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
75
+ hasRequiredUseSyncExternalStoreShim_development = 1;
76
+
77
+ {
78
+ (function() {
79
+
80
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
81
+ if (
82
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
83
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
84
+ 'function'
85
+ ) {
86
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
87
+ }
88
+ var React = React__default["default"];
89
+
90
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
91
+
92
+ function error(format) {
93
+ {
94
+ {
95
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
96
+ args[_key2 - 1] = arguments[_key2];
97
+ }
98
+
99
+ printWarning('error', format, args);
100
+ }
101
+ }
102
+ }
103
+
104
+ function printWarning(level, format, args) {
105
+ // When changing this logic, you might want to also
106
+ // update consoleWithStackDev.www.js as well.
107
+ {
108
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
109
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
110
+
111
+ if (stack !== '') {
112
+ format += '%s';
113
+ args = args.concat([stack]);
114
+ } // eslint-disable-next-line react-internal/safe-string-coercion
115
+
116
+
117
+ var argsWithFormat = args.map(function (item) {
118
+ return String(item);
119
+ }); // Careful: RN currently depends on this prefix
120
+
121
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
122
+ // breaks IE9: https://github.com/facebook/react/issues/13610
123
+ // eslint-disable-next-line react-internal/no-production-logging
124
+
125
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
126
+ }
127
+ }
128
+
129
+ /**
130
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
131
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
132
+ */
133
+ function is(x, y) {
134
+ return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
135
+ ;
136
+ }
137
+
138
+ var objectIs = typeof Object.is === 'function' ? Object.is : is;
139
+
140
+ // dispatch for CommonJS interop named imports.
141
+
142
+ var useState = React.useState,
143
+ useEffect = React.useEffect,
144
+ useLayoutEffect = React.useLayoutEffect,
145
+ useDebugValue = React.useDebugValue;
146
+ var didWarnOld18Alpha = false;
147
+ var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
148
+ // because of a very particular set of implementation details and assumptions
149
+ // -- change any one of them and it will break. The most important assumption
150
+ // is that updates are always synchronous, because concurrent rendering is
151
+ // only available in versions of React that also have a built-in
152
+ // useSyncExternalStore API. And we only use this shim when the built-in API
153
+ // does not exist.
154
+ //
155
+ // Do not assume that the clever hacks used by this hook also work in general.
156
+ // The point of this shim is to replace the need for hacks by other libraries.
157
+
158
+ function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
159
+ // React do not expose a way to check if we're hydrating. So users of the shim
160
+ // will need to track that themselves and return the correct value
161
+ // from `getSnapshot`.
162
+ getServerSnapshot) {
163
+ {
164
+ if (!didWarnOld18Alpha) {
165
+ if (React.startTransition !== undefined) {
166
+ didWarnOld18Alpha = true;
167
+
168
+ error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
169
+ }
170
+ }
171
+ } // Read the current snapshot from the store on every render. Again, this
172
+ // breaks the rules of React, and only works here because of specific
173
+ // implementation details, most importantly that updates are
174
+ // always synchronous.
175
+
176
+
177
+ var value = getSnapshot();
178
+
179
+ {
180
+ if (!didWarnUncachedGetSnapshot) {
181
+ var cachedValue = getSnapshot();
182
+
183
+ if (!objectIs(value, cachedValue)) {
184
+ error('The result of getSnapshot should be cached to avoid an infinite loop');
185
+
186
+ didWarnUncachedGetSnapshot = true;
187
+ }
188
+ }
189
+ } // Because updates are synchronous, we don't queue them. Instead we force a
190
+ // re-render whenever the subscribed state changes by updating an some
191
+ // arbitrary useState hook. Then, during render, we call getSnapshot to read
192
+ // the current value.
193
+ //
194
+ // Because we don't actually use the state returned by the useState hook, we
195
+ // can save a bit of memory by storing other stuff in that slot.
196
+ //
197
+ // To implement the early bailout, we need to track some things on a mutable
198
+ // object. Usually, we would put that in a useRef hook, but we can stash it in
199
+ // our useState hook instead.
200
+ //
201
+ // To force a re-render, we call forceUpdate({inst}). That works because the
202
+ // new object always fails an equality check.
203
+
204
+
205
+ var _useState = useState({
206
+ inst: {
207
+ value: value,
208
+ getSnapshot: getSnapshot
209
+ }
210
+ }),
211
+ inst = _useState[0].inst,
212
+ forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
213
+ // in the layout phase so we can access it during the tearing check that
214
+ // happens on subscribe.
215
+
216
+
217
+ useLayoutEffect(function () {
218
+ inst.value = value;
219
+ inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
220
+ // commit phase if there was an interleaved mutation. In concurrent mode
221
+ // this can happen all the time, but even in synchronous mode, an earlier
222
+ // effect may have mutated the store.
223
+
224
+ if (checkIfSnapshotChanged(inst)) {
225
+ // Force a re-render.
226
+ forceUpdate({
227
+ inst: inst
228
+ });
229
+ }
230
+ }, [subscribe, value, getSnapshot]);
231
+ useEffect(function () {
232
+ // Check for changes right before subscribing. Subsequent changes will be
233
+ // detected in the subscription handler.
234
+ if (checkIfSnapshotChanged(inst)) {
235
+ // Force a re-render.
236
+ forceUpdate({
237
+ inst: inst
238
+ });
239
+ }
240
+
241
+ var handleStoreChange = function () {
242
+ // TODO: Because there is no cross-renderer API for batching updates, it's
243
+ // up to the consumer of this library to wrap their subscription event
244
+ // with unstable_batchedUpdates. Should we try to detect when this isn't
245
+ // the case and print a warning in development?
246
+ // The store changed. Check if the snapshot changed since the last time we
247
+ // read from the store.
248
+ if (checkIfSnapshotChanged(inst)) {
249
+ // Force a re-render.
250
+ forceUpdate({
251
+ inst: inst
252
+ });
253
+ }
254
+ }; // Subscribe to the store and return a clean-up function.
255
+
256
+
257
+ return subscribe(handleStoreChange);
258
+ }, [subscribe]);
259
+ useDebugValue(value);
260
+ return value;
261
+ }
262
+
263
+ function checkIfSnapshotChanged(inst) {
264
+ var latestGetSnapshot = inst.getSnapshot;
265
+ var prevValue = inst.value;
266
+
267
+ try {
268
+ var nextValue = latestGetSnapshot();
269
+ return !objectIs(prevValue, nextValue);
270
+ } catch (error) {
271
+ return true;
272
+ }
273
+ }
274
+
275
+ function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
276
+ // Note: The shim does not use getServerSnapshot, because pre-18 versions of
277
+ // React do not expose a way to check if we're hydrating. So users of the shim
278
+ // will need to track that themselves and return the correct value
279
+ // from `getSnapshot`.
280
+ return getSnapshot();
281
+ }
282
+
283
+ var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
284
+
285
+ var isServerEnvironment = !canUseDOM;
286
+
287
+ var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
288
+ var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
289
+
290
+ useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
291
+ /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
292
+ if (
293
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
294
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
295
+ 'function'
296
+ ) {
297
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
298
+ }
299
+
300
+ })();
301
+ }
302
+ return useSyncExternalStoreShim_development;
303
+ }
304
+
305
+ (function (module) {
306
+
307
+ {
308
+ module.exports = requireUseSyncExternalStoreShim_development();
309
+ }
310
+ } (shim));
311
+
54
312
  /**
55
313
  * match-sorter-utils
56
314
  *
@@ -1476,7 +1734,7 @@
1476
1734
  }
1477
1735
 
1478
1736
  const useSubscribeToQueryCache = (queryCache, getSnapshot) => {
1479
- return shim.useSyncExternalStore(React__namespace.useCallback(onStoreChange => queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange)), [queryCache]), getSnapshot, getSnapshot);
1737
+ return shim.exports.useSyncExternalStore(React__namespace.useCallback(onStoreChange => queryCache.subscribe(reactQuery.notifyManager.batchCalls(onStoreChange)), [queryCache]), getSnapshot, getSnapshot);
1480
1738
  };
1481
1739
 
1482
1740
  const ReactQueryDevtoolsPanel$1 = /*#__PURE__*/React__namespace.forwardRef(function ReactQueryDevtoolsPanel(props, ref) {