@tanstack/react-query-next-experimental 5.94.4 → 5.95.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 (53) hide show
  1. package/build/legacy/HydrationStreamProvider.cjs +118 -0
  2. package/build/legacy/HydrationStreamProvider.cjs.map +1 -0
  3. package/build/legacy/HydrationStreamProvider.d.cts +2 -0
  4. package/build/legacy/HydrationStreamProvider.d.ts +2 -0
  5. package/build/legacy/HydrationStreamProvider.js +84 -0
  6. package/build/legacy/HydrationStreamProvider.js.map +1 -0
  7. package/build/legacy/ReactQueryStreamedHydration.cjs +88 -0
  8. package/build/legacy/ReactQueryStreamedHydration.cjs.map +1 -0
  9. package/build/legacy/ReactQueryStreamedHydration.d.cts +1 -0
  10. package/build/legacy/ReactQueryStreamedHydration.d.ts +1 -0
  11. package/build/legacy/ReactQueryStreamedHydration.js +60 -0
  12. package/build/legacy/ReactQueryStreamedHydration.js.map +1 -0
  13. package/build/legacy/_tsup-dts-rollup.d.cts +124 -0
  14. package/build/legacy/_tsup-dts-rollup.d.ts +124 -0
  15. package/build/legacy/htmlescape.cjs +43 -0
  16. package/build/legacy/htmlescape.cjs.map +1 -0
  17. package/build/legacy/htmlescape.d.cts +2 -0
  18. package/build/legacy/htmlescape.d.ts +2 -0
  19. package/build/legacy/htmlescape.js +17 -0
  20. package/build/legacy/htmlescape.js.map +1 -0
  21. package/build/legacy/index.cjs +31 -0
  22. package/build/legacy/index.cjs.map +1 -0
  23. package/build/legacy/index.d.cts +1 -0
  24. package/build/legacy/index.d.ts +1 -0
  25. package/build/legacy/index.js +6 -0
  26. package/build/legacy/index.js.map +1 -0
  27. package/build/modern/HydrationStreamProvider.cjs +116 -0
  28. package/build/modern/HydrationStreamProvider.cjs.map +1 -0
  29. package/build/modern/HydrationStreamProvider.d.cts +2 -0
  30. package/build/modern/HydrationStreamProvider.d.ts +2 -0
  31. package/build/modern/HydrationStreamProvider.js +82 -0
  32. package/build/modern/HydrationStreamProvider.js.map +1 -0
  33. package/build/modern/ReactQueryStreamedHydration.cjs +86 -0
  34. package/build/modern/ReactQueryStreamedHydration.cjs.map +1 -0
  35. package/build/modern/ReactQueryStreamedHydration.d.cts +1 -0
  36. package/build/modern/ReactQueryStreamedHydration.d.ts +1 -0
  37. package/build/modern/ReactQueryStreamedHydration.js +58 -0
  38. package/build/modern/ReactQueryStreamedHydration.js.map +1 -0
  39. package/build/modern/_tsup-dts-rollup.d.cts +124 -0
  40. package/build/modern/_tsup-dts-rollup.d.ts +124 -0
  41. package/build/modern/htmlescape.cjs +43 -0
  42. package/build/modern/htmlescape.cjs.map +1 -0
  43. package/build/modern/htmlescape.d.cts +2 -0
  44. package/build/modern/htmlescape.d.ts +2 -0
  45. package/build/modern/htmlescape.js +17 -0
  46. package/build/modern/htmlescape.js.map +1 -0
  47. package/build/modern/index.cjs +31 -0
  48. package/build/modern/index.cjs.map +1 -0
  49. package/build/modern/index.d.cts +1 -0
  50. package/build/modern/index.d.ts +1 -0
  51. package/build/modern/index.js +6 -0
  52. package/build/modern/index.js.map +1 -0
  53. package/package.json +3 -3
@@ -0,0 +1,124 @@
1
+ import type { DehydratedState } from '@tanstack/react-query';
2
+ import type { DehydrateOptions } from '@tanstack/react-query';
3
+ import type { HydrateOptions } from '@tanstack/react-query';
4
+ import { JSX } from 'react/jsx-runtime';
5
+ import { Options } from 'tsup';
6
+ import type { QueryClient } from '@tanstack/react-query';
7
+ import * as React_2 from 'react';
8
+ import { UserConfig } from 'vite';
9
+
10
+ export declare function createHydrationStreamProvider<TShape>(): {
11
+ Provider: (props: {
12
+ children: React_2.ReactNode;
13
+ /**
14
+ * Optional transformer to serialize/deserialize the data
15
+ * Example devalue, superjson et al
16
+ */
17
+ transformer?: DataTransformer;
18
+ /**
19
+ * **Client method**
20
+ * Called in the browser when new entries are received
21
+ */
22
+ onEntries: (entries: Array<TShape>) => void;
23
+ /**
24
+ * **Server method**
25
+ * onFlush is called on the server when the cache is flushed
26
+ */
27
+ onFlush?: () => Array<TShape>;
28
+ /**
29
+ * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced
30
+ */
31
+ nonce?: string;
32
+ }) => JSX.Element;
33
+ context: React_2.Context<HydrationStreamContext<TShape>>;
34
+ };
35
+
36
+ declare interface DataTransformer {
37
+ serialize: (object: any) => any;
38
+ deserialize: (object: any) => any;
39
+ }
40
+
41
+ export declare const default_alias: any[];
42
+
43
+ export declare const default_alias_1: any[];
44
+
45
+ export declare const default_alias_2: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
46
+
47
+ export declare const default_alias_3: UserConfig;
48
+
49
+ export declare const ESCAPE_REGEX: RegExp;
50
+
51
+ export declare function htmlEscapeJsonString(str: string): string;
52
+
53
+ declare interface HydrationStreamContext<TShape> {
54
+ id: string;
55
+ stream: {
56
+ /**
57
+ * **Server method**
58
+ * Push a new entry to the stream
59
+ * Will be ignored on the client
60
+ */
61
+ push: (...shape: Array<TShape>) => void;
62
+ };
63
+ }
64
+
65
+ export declare interface HydrationStreamProviderProps<TShape> {
66
+ children: React_2.ReactNode;
67
+ /**
68
+ * Optional transformer to serialize/deserialize the data
69
+ * Example devalue, superjson et al
70
+ */
71
+ transformer?: DataTransformer;
72
+ /**
73
+ * **Client method**
74
+ * Called in the browser when new entries are received
75
+ */
76
+ onEntries: (entries: Array<TShape>) => void;
77
+ /**
78
+ * **Server method**
79
+ * onFlush is called on the server when the cache is flushed
80
+ */
81
+ onFlush?: () => Array<TShape>;
82
+ /**
83
+ * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced
84
+ */
85
+ nonce?: string;
86
+ }
87
+
88
+ /**
89
+ * @param {Object} opts - Options for building configurations.
90
+ * @param {string[]} opts.entry - The entry array.
91
+ * @returns {import('tsup').Options}
92
+ */
93
+ export declare function legacyConfig(opts: {
94
+ entry: string[];
95
+ }): Options;
96
+
97
+ /**
98
+ * @param {Object} opts - Options for building configurations.
99
+ * @param {string[]} opts.entry - The entry array.
100
+ * @returns {import('tsup').Options}
101
+ */
102
+ export declare function modernConfig(opts: {
103
+ entry: string[];
104
+ }): Options;
105
+
106
+ /**
107
+ * This component is responsible for:
108
+ * - hydrating the query client on the server
109
+ * - dehydrating the query client on the server
110
+ */
111
+ declare function ReactQueryStreamedHydration(props: {
112
+ children: React_2.ReactNode;
113
+ queryClient?: QueryClient;
114
+ nonce?: string;
115
+ options?: {
116
+ hydrate?: HydrateOptions;
117
+ dehydrate?: DehydrateOptions;
118
+ };
119
+ transformer?: HydrationStreamProviderProps<DehydratedState>['transformer'];
120
+ }): JSX.Element;
121
+ export { ReactQueryStreamedHydration }
122
+ export { ReactQueryStreamedHydration as ReactQueryStreamedHydration_alias_1 }
123
+
124
+ export { }
@@ -0,0 +1,124 @@
1
+ import type { DehydratedState } from '@tanstack/react-query';
2
+ import type { DehydrateOptions } from '@tanstack/react-query';
3
+ import type { HydrateOptions } from '@tanstack/react-query';
4
+ import { JSX } from 'react/jsx-runtime';
5
+ import { Options } from 'tsup';
6
+ import type { QueryClient } from '@tanstack/react-query';
7
+ import * as React_2 from 'react';
8
+ import { UserConfig } from 'vite';
9
+
10
+ export declare function createHydrationStreamProvider<TShape>(): {
11
+ Provider: (props: {
12
+ children: React_2.ReactNode;
13
+ /**
14
+ * Optional transformer to serialize/deserialize the data
15
+ * Example devalue, superjson et al
16
+ */
17
+ transformer?: DataTransformer;
18
+ /**
19
+ * **Client method**
20
+ * Called in the browser when new entries are received
21
+ */
22
+ onEntries: (entries: Array<TShape>) => void;
23
+ /**
24
+ * **Server method**
25
+ * onFlush is called on the server when the cache is flushed
26
+ */
27
+ onFlush?: () => Array<TShape>;
28
+ /**
29
+ * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced
30
+ */
31
+ nonce?: string;
32
+ }) => JSX.Element;
33
+ context: React_2.Context<HydrationStreamContext<TShape>>;
34
+ };
35
+
36
+ declare interface DataTransformer {
37
+ serialize: (object: any) => any;
38
+ deserialize: (object: any) => any;
39
+ }
40
+
41
+ export declare const default_alias: any[];
42
+
43
+ export declare const default_alias_1: any[];
44
+
45
+ export declare const default_alias_2: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
46
+
47
+ export declare const default_alias_3: UserConfig;
48
+
49
+ export declare const ESCAPE_REGEX: RegExp;
50
+
51
+ export declare function htmlEscapeJsonString(str: string): string;
52
+
53
+ declare interface HydrationStreamContext<TShape> {
54
+ id: string;
55
+ stream: {
56
+ /**
57
+ * **Server method**
58
+ * Push a new entry to the stream
59
+ * Will be ignored on the client
60
+ */
61
+ push: (...shape: Array<TShape>) => void;
62
+ };
63
+ }
64
+
65
+ export declare interface HydrationStreamProviderProps<TShape> {
66
+ children: React_2.ReactNode;
67
+ /**
68
+ * Optional transformer to serialize/deserialize the data
69
+ * Example devalue, superjson et al
70
+ */
71
+ transformer?: DataTransformer;
72
+ /**
73
+ * **Client method**
74
+ * Called in the browser when new entries are received
75
+ */
76
+ onEntries: (entries: Array<TShape>) => void;
77
+ /**
78
+ * **Server method**
79
+ * onFlush is called on the server when the cache is flushed
80
+ */
81
+ onFlush?: () => Array<TShape>;
82
+ /**
83
+ * A nonce that'll allow the inline script to be executed when Content Security Policy is enforced
84
+ */
85
+ nonce?: string;
86
+ }
87
+
88
+ /**
89
+ * @param {Object} opts - Options for building configurations.
90
+ * @param {string[]} opts.entry - The entry array.
91
+ * @returns {import('tsup').Options}
92
+ */
93
+ export declare function legacyConfig(opts: {
94
+ entry: string[];
95
+ }): Options;
96
+
97
+ /**
98
+ * @param {Object} opts - Options for building configurations.
99
+ * @param {string[]} opts.entry - The entry array.
100
+ * @returns {import('tsup').Options}
101
+ */
102
+ export declare function modernConfig(opts: {
103
+ entry: string[];
104
+ }): Options;
105
+
106
+ /**
107
+ * This component is responsible for:
108
+ * - hydrating the query client on the server
109
+ * - dehydrating the query client on the server
110
+ */
111
+ declare function ReactQueryStreamedHydration(props: {
112
+ children: React_2.ReactNode;
113
+ queryClient?: QueryClient;
114
+ nonce?: string;
115
+ options?: {
116
+ hydrate?: HydrateOptions;
117
+ dehydrate?: DehydrateOptions;
118
+ };
119
+ transformer?: HydrationStreamProviderProps<DehydratedState>['transformer'];
120
+ }): JSX.Element;
121
+ export { ReactQueryStreamedHydration }
122
+ export { ReactQueryStreamedHydration as ReactQueryStreamedHydration_alias_1 }
123
+
124
+ export { }
@@ -0,0 +1,43 @@
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/htmlescape.ts
21
+ var htmlescape_exports = {};
22
+ __export(htmlescape_exports, {
23
+ ESCAPE_REGEX: () => ESCAPE_REGEX,
24
+ htmlEscapeJsonString: () => htmlEscapeJsonString
25
+ });
26
+ module.exports = __toCommonJS(htmlescape_exports);
27
+ var ESCAPE_LOOKUP = {
28
+ "&": "\\u0026",
29
+ ">": "\\u003e",
30
+ "<": "\\u003c",
31
+ "\u2028": "\\u2028",
32
+ "\u2029": "\\u2029"
33
+ };
34
+ var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
35
+ function htmlEscapeJsonString(str) {
36
+ return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ ESCAPE_REGEX,
41
+ htmlEscapeJsonString
42
+ });
43
+ //# sourceMappingURL=htmlescape.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/htmlescape.ts"],"sourcesContent":["// --------------------------------------------------------------------------------\n//\n// copied from\n// https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/src/server/htmlescape.ts\n// License: https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/license.md\n//\n// --------------------------------------------------------------------------------\n\n// This utility is based on https://github.com/zertosh/htmlescape\n// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE\n\nconst ESCAPE_LOOKUP: Record<string, string> = {\n '&': '\\\\u0026',\n '>': '\\\\u003e',\n '<': '\\\\u003c',\n '\\u2028': '\\\\u2028',\n '\\u2029': '\\\\u2029',\n}\n\nexport const ESCAPE_REGEX = /[&><\\u2028\\u2029]/g\n\nexport function htmlEscapeJsonString(str: string): string {\n return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]!)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,IAAM,gBAAwC;AAAA,EAC5C,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,UAAU;AAAA,EACV,UAAU;AACZ;AAEO,IAAM,eAAe;AAErB,SAAS,qBAAqB,KAAqB;AACxD,SAAO,IAAI,QAAQ,cAAc,CAAC,UAAU,cAAc,KAAK,CAAE;AACnE;","names":[]}
@@ -0,0 +1,2 @@
1
+ export { htmlEscapeJsonString } from './_tsup-dts-rollup.cjs';
2
+ export { ESCAPE_REGEX } from './_tsup-dts-rollup.cjs';
@@ -0,0 +1,2 @@
1
+ export { htmlEscapeJsonString } from './_tsup-dts-rollup.js';
2
+ export { ESCAPE_REGEX } from './_tsup-dts-rollup.js';
@@ -0,0 +1,17 @@
1
+ // src/htmlescape.ts
2
+ var ESCAPE_LOOKUP = {
3
+ "&": "\\u0026",
4
+ ">": "\\u003e",
5
+ "<": "\\u003c",
6
+ "\u2028": "\\u2028",
7
+ "\u2029": "\\u2029"
8
+ };
9
+ var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
10
+ function htmlEscapeJsonString(str) {
11
+ return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
12
+ }
13
+ export {
14
+ ESCAPE_REGEX,
15
+ htmlEscapeJsonString
16
+ };
17
+ //# sourceMappingURL=htmlescape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/htmlescape.ts"],"sourcesContent":["// --------------------------------------------------------------------------------\n//\n// copied from\n// https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/src/server/htmlescape.ts\n// License: https://github.com/vercel/next.js/blob/6bc07792a4462a4bf921a72ab30dc4ab2c4e1bda/packages/next/license.md\n//\n// --------------------------------------------------------------------------------\n\n// This utility is based on https://github.com/zertosh/htmlescape\n// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE\n\nconst ESCAPE_LOOKUP: Record<string, string> = {\n '&': '\\\\u0026',\n '>': '\\\\u003e',\n '<': '\\\\u003c',\n '\\u2028': '\\\\u2028',\n '\\u2029': '\\\\u2029',\n}\n\nexport const ESCAPE_REGEX = /[&><\\u2028\\u2029]/g\n\nexport function htmlEscapeJsonString(str: string): string {\n return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]!)\n}\n"],"mappings":";AAWA,IAAM,gBAAwC;AAAA,EAC5C,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,UAAU;AAAA,EACV,UAAU;AACZ;AAEO,IAAM,eAAe;AAErB,SAAS,qBAAqB,KAAqB;AACxD,SAAO,IAAI,QAAQ,cAAc,CAAC,UAAU,cAAc,KAAK,CAAE;AACnE;","names":[]}
@@ -0,0 +1,31 @@
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/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ReactQueryStreamedHydration: () => import_ReactQueryStreamedHydration.ReactQueryStreamedHydration
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var import_ReactQueryStreamedHydration = require("./ReactQueryStreamedHydration.cjs");
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ ReactQueryStreamedHydration
30
+ });
31
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { ReactQueryStreamedHydration } from './ReactQueryStreamedHydration'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yCAA4C;","names":[]}
@@ -0,0 +1 @@
1
+ export { ReactQueryStreamedHydration_alias_1 as ReactQueryStreamedHydration } from './_tsup-dts-rollup.cjs';
@@ -0,0 +1 @@
1
+ export { ReactQueryStreamedHydration_alias_1 as ReactQueryStreamedHydration } from './_tsup-dts-rollup.js';
@@ -0,0 +1,6 @@
1
+ // src/index.ts
2
+ import { ReactQueryStreamedHydration } from "./ReactQueryStreamedHydration.js";
3
+ export {
4
+ ReactQueryStreamedHydration
5
+ };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { ReactQueryStreamedHydration } from './ReactQueryStreamedHydration'\n"],"mappings":";AAAA,SAAS,mCAAmC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-query-next-experimental",
3
- "version": "5.94.4",
3
+ "version": "5.95.0",
4
4
  "description": "Hydration utils for React Query in the NextJs app directory",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -44,12 +44,12 @@
44
44
  "next": "^16.0.1",
45
45
  "npm-run-all2": "^5.0.0",
46
46
  "react": "^19.2.1",
47
- "@tanstack/react-query": "5.94.4"
47
+ "@tanstack/react-query": "5.95.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "next": "^13 || ^14 || ^15 || ^16",
51
51
  "react": "^18 || ^19",
52
- "@tanstack/react-query": "^5.94.4"
52
+ "@tanstack/react-query": "^5.95.0"
53
53
  },
54
54
  "scripts": {
55
55
  "clean": "premove ./build ./coverage ./dist-ts",