@suspensive/react-query-4 3.19.3 → 3.19.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.
- package/dist/IsFetching.cjs +1 -1
- package/dist/IsFetching.mjs +1 -1
- package/dist/Mutation.cjs +1 -1
- package/dist/Mutation.mjs +1 -1
- package/dist/QueriesHydration.cjs +116 -2
- package/dist/QueriesHydration.cjs.map +1 -0
- package/dist/QueriesHydration.mjs +116 -2
- package/dist/QueriesHydration.mjs.map +1 -0
- package/dist/SuspenseInfiniteQuery.cjs +1 -1
- package/dist/SuspenseInfiniteQuery.mjs +1 -1
- package/dist/SuspenseQuery.cjs +1 -1
- package/dist/SuspenseQuery.mjs +1 -1
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.cjs +29 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/asyncToGenerator.mjs +28 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.mjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.cjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.mjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.cjs +15 -0
- package/dist/{objectWithoutProperties-CZk5Qmfh.mjs → _virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.mjs} +2 -12
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.mjs +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.cjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.mjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.cjs +18 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.mjs +12 -0
- package/dist/components/ClientOnly.cjs +0 -1
- package/dist/components/ClientOnly.cjs.map +1 -1
- package/dist/createGetQueryClient.cjs +1 -1
- package/dist/createGetQueryClient.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/QueriesHydration-B9tinfWA.cjs +0 -148
- package/dist/QueriesHydration-B9tinfWA.cjs.map +0 -1
- package/dist/QueriesHydration-MZQ7Oj60.mjs +0 -143
- package/dist/QueriesHydration-MZQ7Oj60.mjs.map +0 -1
- package/dist/components/ClientOnly.d.cts +0 -13
- package/dist/components/ClientOnly.d.cts.map +0 -1
- package/dist/components/ClientOnly.d.mts +0 -13
- package/dist/components/ClientOnly.d.mts.map +0 -1
- package/dist/objectSpread2-9HkiXZY2.cjs +0 -73
- package/dist/objectSpread2-BX3M3dlG.mjs +0 -67
- package/dist/objectWithoutProperties-CfjOeCpP.cjs +0 -31
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/typeof.js
|
|
2
|
+
function _typeof(o) {
|
|
3
|
+
"@babel/helpers - typeof";
|
|
4
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
5
|
+
return typeof o;
|
|
6
|
+
} : function(o) {
|
|
7
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8
|
+
}, _typeof(o);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { _typeof };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientOnly.cjs","names":[],"sources":["../../src/components/ClientOnly.tsx"],"sourcesContent":["'use client'\n\nimport { useSyncExternalStore } from 'react'\n\nconst useIsClient = () => useSyncExternalStore(emptySubscribe, getSnapshot, getServerSnapshot)\n\nconst emptySubscribe = () => () => {}\nconst getSnapshot = () => true\nconst getServerSnapshot = () => false\n\nexport const ClientOnly = ({ children, fallback }: { children: React.ReactNode; fallback: React.ReactNode }) => (\n <>{useIsClient() ? children : fallback}</>\n)\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClientOnly.cjs","names":[],"sources":["../../src/components/ClientOnly.tsx"],"sourcesContent":["'use client'\n\nimport { useSyncExternalStore } from 'react'\n\nconst useIsClient = () => useSyncExternalStore(emptySubscribe, getSnapshot, getServerSnapshot)\n\nconst emptySubscribe = () => () => {}\nconst getSnapshot = () => true\nconst getServerSnapshot = () => false\n\nexport const ClientOnly = ({ children, fallback }: { children: React.ReactNode; fallback: React.ReactNode }) => (\n <>{useIsClient() ? children : fallback}</>\n)\n"],"mappings":";;;;;;AAIA,MAAM,oDAAyC,gBAAgB,aAAa,kBAAkB;AAE9F,MAAM,6BAA6B;AACnC,MAAM,oBAAoB;AAC1B,MAAM,0BAA0B;AAEhC,MAAa,cAAc,EAAE,UAAU,eACrC,mFAAG,aAAa,GAAG,WAAW,UAAY"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_objectSpread2 = require('./
|
|
2
|
+
const require_objectSpread2 = require('./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.cjs');
|
|
3
3
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
4
4
|
|
|
5
5
|
//#region src/createGetQueryClient.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _objectSpread2 } from "./_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.mjs";
|
|
2
2
|
import { QueryClient, isServer } from "@tanstack/react-query";
|
|
3
3
|
|
|
4
4
|
//#region src/createGetQueryClient.ts
|
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const require_usePrefetchInfiniteQuery = require('./usePrefetchInfiniteQuery.cjs
|
|
|
5
5
|
const require_PrefetchInfiniteQuery = require('./PrefetchInfiniteQuery.cjs');
|
|
6
6
|
const require_usePrefetchQuery = require('./usePrefetchQuery.cjs');
|
|
7
7
|
const require_PrefetchQuery = require('./PrefetchQuery.cjs');
|
|
8
|
-
const require_QueriesHydration = require('./QueriesHydration
|
|
8
|
+
const require_QueriesHydration = require('./QueriesHydration.cjs');
|
|
9
9
|
const require_QueryClientConsumer = require('./QueryClientConsumer.cjs');
|
|
10
10
|
const require_SuspenseInfiniteQuery = require('./SuspenseInfiniteQuery.cjs');
|
|
11
11
|
const require_SuspenseQueries = require('./SuspenseQueries.cjs');
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { usePrefetchInfiniteQuery } from "./usePrefetchInfiniteQuery.mjs";
|
|
|
4
4
|
import { PrefetchInfiniteQuery } from "./PrefetchInfiniteQuery.mjs";
|
|
5
5
|
import { usePrefetchQuery } from "./usePrefetchQuery.mjs";
|
|
6
6
|
import { PrefetchQuery } from "./PrefetchQuery.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { QueriesHydration } from "./QueriesHydration.mjs";
|
|
8
8
|
import { QueryClientConsumer } from "./QueryClientConsumer.mjs";
|
|
9
9
|
import { SuspenseInfiniteQuery } from "./SuspenseInfiniteQuery.mjs";
|
|
10
10
|
import { SuspenseQueries } from "./SuspenseQueries.mjs";
|
package/package.json
CHANGED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
const require_objectWithoutProperties = require('./objectWithoutProperties-CfjOeCpP.cjs');
|
|
2
|
-
const require_components_ClientOnly = require('./components/ClientOnly.cjs');
|
|
3
|
-
const require_objectSpread2 = require('./objectSpread2-9HkiXZY2.cjs');
|
|
4
|
-
let _tanstack_react_query = require("@tanstack/react-query");
|
|
5
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
-
|
|
7
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/asyncToGenerator.js
|
|
8
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
9
|
-
try {
|
|
10
|
-
var i = n[a](c), u = i.value;
|
|
11
|
-
} catch (n) {
|
|
12
|
-
e(n);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
16
|
-
}
|
|
17
|
-
function _asyncToGenerator(n) {
|
|
18
|
-
return function() {
|
|
19
|
-
var t = this, e = arguments;
|
|
20
|
-
return new Promise(function(r, o) {
|
|
21
|
-
var a = n.apply(t, e);
|
|
22
|
-
function _next(n) {
|
|
23
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
24
|
-
}
|
|
25
|
-
function _throw(n) {
|
|
26
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
27
|
-
}
|
|
28
|
-
_next(void 0);
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/QueriesHydration.tsx
|
|
35
|
-
const _excluded = [
|
|
36
|
-
"queries",
|
|
37
|
-
"children",
|
|
38
|
-
"queryClient",
|
|
39
|
-
"skipSsrOnError",
|
|
40
|
-
"timeout"
|
|
41
|
-
];
|
|
42
|
-
/**
|
|
43
|
-
* A server component that fetches multiple queries on the server and hydrates them to the client.
|
|
44
|
-
*
|
|
45
|
-
* @experimental This component is experimental and may be changed or removed in the future.
|
|
46
|
-
*
|
|
47
|
-
* @description
|
|
48
|
-
* QueriesHydration is designed for React Server Components (RSC).
|
|
49
|
-
* It pre-fetches multiple queries on the server side and automatically hydrates
|
|
50
|
-
* the data to the client, enabling seamless data synchronization between server and client.
|
|
51
|
-
*
|
|
52
|
-
* When errors occur during server-side fetching, the component gracefully falls back
|
|
53
|
-
* to client-side rendering, ensuring your application remains resilient.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```tsx
|
|
57
|
-
* // app/page.tsx (Server Component)
|
|
58
|
-
* import { Suspense } from 'react'
|
|
59
|
-
* import { QueriesHydration } from '@suspensive/react-query'
|
|
60
|
-
* import { queryOptions } from '@tanstack/react-query'
|
|
61
|
-
*
|
|
62
|
-
* const userQueryOptions = (userId: string) => queryOptions({
|
|
63
|
-
* queryKey: ['user', userId],
|
|
64
|
-
* queryFn: () => fetchUser(userId)
|
|
65
|
-
* })
|
|
66
|
-
*
|
|
67
|
-
* const postsQueryOptions = () => queryOptions({
|
|
68
|
-
* queryKey: ['posts'],
|
|
69
|
-
* queryFn: () => fetchPosts()
|
|
70
|
-
* })
|
|
71
|
-
*
|
|
72
|
-
* export default function Page({ userId }: { userId: string }) {
|
|
73
|
-
* return (
|
|
74
|
-
* <>
|
|
75
|
-
* <Suspense fallback={<div>Loading user...</div>}>
|
|
76
|
-
* <QueriesHydration queries={[userQueryOptions(userId)]}>
|
|
77
|
-
* <UserProfile />
|
|
78
|
-
* </QueriesHydration>
|
|
79
|
-
* </Suspense>
|
|
80
|
-
*
|
|
81
|
-
* <Suspense fallback={<div>Loading posts...</div>}>
|
|
82
|
-
* <QueriesHydration queries={[postsQueryOptions()]}>
|
|
83
|
-
* <PostsList />
|
|
84
|
-
* </QueriesHydration>
|
|
85
|
-
* </Suspense>
|
|
86
|
-
* </>
|
|
87
|
-
* )
|
|
88
|
-
* }
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```tsx
|
|
93
|
-
* // With custom error fallback
|
|
94
|
-
* <Suspense fallback={<div>Loading user...</div>}>
|
|
95
|
-
* <QueriesHydration
|
|
96
|
-
* queries={[userQueryOptions(userId)]}
|
|
97
|
-
* skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}
|
|
98
|
-
* >
|
|
99
|
-
* <UserProfile />
|
|
100
|
-
* </QueriesHydration>
|
|
101
|
-
* </Suspense>
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}
|
|
105
|
-
*/
|
|
106
|
-
function QueriesHydration(_x) {
|
|
107
|
-
return _QueriesHydration.apply(this, arguments);
|
|
108
|
-
}
|
|
109
|
-
function _QueriesHydration() {
|
|
110
|
-
_QueriesHydration = _asyncToGenerator(function* (_ref) {
|
|
111
|
-
let { queries, children, queryClient = new _tanstack_react_query.QueryClient(), skipSsrOnError = true, timeout } = _ref, props = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
|
|
112
|
-
const timeoutController = timeout != null && timeout >= 0 ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`) : void 0;
|
|
113
|
-
try {
|
|
114
|
-
const queriesPromise = Promise.all(queries.map((query) => "getNextPageParam" in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)));
|
|
115
|
-
yield timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise;
|
|
116
|
-
timeoutController === null || timeoutController === void 0 || timeoutController.clear();
|
|
117
|
-
} catch (_unused) {
|
|
118
|
-
timeoutController === null || timeoutController === void 0 || timeoutController.clear();
|
|
119
|
-
if (skipSsrOnError) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_ClientOnly.ClientOnly, {
|
|
120
|
-
fallback: skipSsrOnError === true ? void 0 : skipSsrOnError.fallback,
|
|
121
|
-
children
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tanstack_react_query.Hydrate, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, props), {}, {
|
|
125
|
-
state: (0, _tanstack_react_query.dehydrate)(queryClient),
|
|
126
|
-
children
|
|
127
|
-
}));
|
|
128
|
-
});
|
|
129
|
-
return _QueriesHydration.apply(this, arguments);
|
|
130
|
-
}
|
|
131
|
-
const createTimeoutController = (ms, errorMessage) => {
|
|
132
|
-
let timerId;
|
|
133
|
-
return {
|
|
134
|
-
promise: new Promise((_, reject) => {
|
|
135
|
-
timerId = setTimeout(() => reject(new Error(errorMessage)), ms);
|
|
136
|
-
}),
|
|
137
|
-
clear: () => timerId != null && clearTimeout(timerId)
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
//#endregion
|
|
142
|
-
Object.defineProperty(exports, 'QueriesHydration', {
|
|
143
|
-
enumerable: true,
|
|
144
|
-
get: function () {
|
|
145
|
-
return QueriesHydration;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
//# sourceMappingURL=QueriesHydration-B9tinfWA.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueriesHydration-B9tinfWA.cjs","names":["QueryClient","ClientOnly","Hydrate"],"sources":["../src/QueriesHydration.tsx"],"sourcesContent":["import {\n Hydrate,\n type HydrateProps,\n type OmitKeyof,\n QueryClient,\n type QueryOptions,\n type UseInfiniteQueryOptions,\n type WithRequired,\n dehydrate,\n} from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { ClientOnly } from './components/ClientOnly'\n\n/**\n * A server component that fetches multiple queries on the server and hydrates them to the client.\n *\n * @experimental This component is experimental and may be changed or removed in the future.\n *\n * @description\n * QueriesHydration is designed for React Server Components (RSC).\n * It pre-fetches multiple queries on the server side and automatically hydrates\n * the data to the client, enabling seamless data synchronization between server and client.\n *\n * When errors occur during server-side fetching, the component gracefully falls back\n * to client-side rendering, ensuring your application remains resilient.\n *\n * @example\n * ```tsx\n * // app/page.tsx (Server Component)\n * import { Suspense } from 'react'\n * import { QueriesHydration } from '@suspensive/react-query'\n * import { queryOptions } from '@tanstack/react-query'\n *\n * const userQueryOptions = (userId: string) => queryOptions({\n * queryKey: ['user', userId],\n * queryFn: () => fetchUser(userId)\n * })\n *\n * const postsQueryOptions = () => queryOptions({\n * queryKey: ['posts'],\n * queryFn: () => fetchPosts()\n * })\n *\n * export default function Page({ userId }: { userId: string }) {\n * return (\n * <>\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration queries={[userQueryOptions(userId)]}>\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n *\n * <Suspense fallback={<div>Loading posts...</div>}>\n * <QueriesHydration queries={[postsQueryOptions()]}>\n * <PostsList />\n * </QueriesHydration>\n * </Suspense>\n * </>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With custom error fallback\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration\n * queries={[userQueryOptions(userId)]}\n * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}\n * >\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n * ```\n *\n * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}\n */\nexport async function QueriesHydration({\n queries,\n children,\n queryClient = new QueryClient(),\n skipSsrOnError = true,\n timeout,\n ...props\n}: {\n /**\n * The QueryClient instance to use for fetching queries.\n */\n queryClient?: QueryClient\n /**\n * An array of query options or infinite query options to be fetched on the server. Each query must include a `queryKey`.\n * You can mix regular queries and infinite queries in the same array.\n */\n queries: (\n | WithRequired<QueryOptions<any, any, any, any>, 'queryKey'>\n | WithRequired<UseInfiniteQueryOptions<any, any, any, any, any>, 'queryKey'>\n )[]\n /**\n * Controls error handling behavior:\n * - `true` (default): Skips SSR and falls back to client-side rendering when server fetch fails\n * - `false`: Proceeds with SSR without hydration (retry fetching on client component server rendering)\n * - `{ fallback: ReactNode }`: Skips SSR with custom fallback UI during client-side rendering\n */\n skipSsrOnError?:\n | boolean\n | {\n fallback: ReactNode\n }\n /**\n * The timeout in milliseconds for the query.\n * If the query takes longer than the timeout, it will be considered as an error.\n * When not set, no timeout is applied.\n */\n timeout?: number\n} & OmitKeyof<HydrateProps, 'state'>) {\n const timeoutController =\n timeout != null && timeout >= 0\n ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`)\n : undefined\n try {\n const queriesPromise = Promise.all(\n queries.map((query) =>\n 'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)\n )\n )\n await (timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise)\n timeoutController?.clear()\n } catch {\n timeoutController?.clear()\n if (skipSsrOnError) {\n return (\n <ClientOnly fallback={skipSsrOnError === true ? undefined : skipSsrOnError.fallback}>{children}</ClientOnly>\n )\n }\n }\n return (\n <Hydrate {...props} state={dehydrate(queryClient)}>\n {children}\n </Hydrate>\n )\n}\n\nconst createTimeoutController = (ms: number, errorMessage: string) => {\n let timerId: ReturnType<typeof setTimeout> | undefined\n return {\n promise: new Promise<never>((_, reject) => {\n timerId = setTimeout(() => reject(new Error(errorMessage)), ms)\n }),\n clear: () => timerId != null && clearTimeout(timerId),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EE;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALF,SAAsB,iBAAiB;;;;wDAqCD;MArCC,EACrC,SACA,UACA,cAAc,IAAIA,mCAAa,EAC/B,iBAAiB,MACjB,kBACG;EAgCH,MAAM,oBACJ,WAAW,QAAQ,WAAW,IAC1B,wBAAwB,SAAS,mCAAmC,QAAQ,MAAM,GAClF;AACN,MAAI;GACF,MAAM,iBAAiB,QAAQ,IAC7B,QAAQ,KAAK,UACX,sBAAsB,QAAQ,YAAY,mBAAmB,MAAM,GAAG,YAAY,WAAW,MAAM,CACpG,CACF;AACD,SAAO,qBAAqB,OAAO,QAAQ,KAAK,CAAC,gBAAgB,kBAAkB,QAAQ,CAAC,GAAG;AAC/F,mFAAmB,OAAO;oBACpB;AACN,mFAAmB,OAAO;AAC1B,OAAI,eACF,QACE,2CAACC,0CAAD;IAAY,UAAU,mBAAmB,OAAO,SAAY,eAAe;IAAW;IAAsB;;AAIlH,SACE,2CAACC,6GAAY;GAAO,4CAAiB,YAAY;GAC9C;IACO;;;;AAId,MAAM,2BAA2B,IAAY,iBAAyB;CACpE,IAAI;AACJ,QAAO;EACL,SAAS,IAAI,SAAgB,GAAG,WAAW;AACzC,aAAU,iBAAiB,OAAO,IAAI,MAAM,aAAa,CAAC,EAAE,GAAG;IAC/D;EACF,aAAa,WAAW,QAAQ,aAAa,QAAQ;EACtD"}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { t as _objectWithoutProperties } from "./objectWithoutProperties-CZk5Qmfh.mjs";
|
|
2
|
-
import { ClientOnly } from "./components/ClientOnly.mjs";
|
|
3
|
-
import { t as _objectSpread2 } from "./objectSpread2-BX3M3dlG.mjs";
|
|
4
|
-
import { Hydrate, QueryClient, dehydrate } from "@tanstack/react-query";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/asyncToGenerator.js
|
|
8
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
9
|
-
try {
|
|
10
|
-
var i = n[a](c), u = i.value;
|
|
11
|
-
} catch (n) {
|
|
12
|
-
e(n);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
16
|
-
}
|
|
17
|
-
function _asyncToGenerator(n) {
|
|
18
|
-
return function() {
|
|
19
|
-
var t = this, e = arguments;
|
|
20
|
-
return new Promise(function(r, o) {
|
|
21
|
-
var a = n.apply(t, e);
|
|
22
|
-
function _next(n) {
|
|
23
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
24
|
-
}
|
|
25
|
-
function _throw(n) {
|
|
26
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
27
|
-
}
|
|
28
|
-
_next(void 0);
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/QueriesHydration.tsx
|
|
35
|
-
const _excluded = [
|
|
36
|
-
"queries",
|
|
37
|
-
"children",
|
|
38
|
-
"queryClient",
|
|
39
|
-
"skipSsrOnError",
|
|
40
|
-
"timeout"
|
|
41
|
-
];
|
|
42
|
-
/**
|
|
43
|
-
* A server component that fetches multiple queries on the server and hydrates them to the client.
|
|
44
|
-
*
|
|
45
|
-
* @experimental This component is experimental and may be changed or removed in the future.
|
|
46
|
-
*
|
|
47
|
-
* @description
|
|
48
|
-
* QueriesHydration is designed for React Server Components (RSC).
|
|
49
|
-
* It pre-fetches multiple queries on the server side and automatically hydrates
|
|
50
|
-
* the data to the client, enabling seamless data synchronization between server and client.
|
|
51
|
-
*
|
|
52
|
-
* When errors occur during server-side fetching, the component gracefully falls back
|
|
53
|
-
* to client-side rendering, ensuring your application remains resilient.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```tsx
|
|
57
|
-
* // app/page.tsx (Server Component)
|
|
58
|
-
* import { Suspense } from 'react'
|
|
59
|
-
* import { QueriesHydration } from '@suspensive/react-query'
|
|
60
|
-
* import { queryOptions } from '@tanstack/react-query'
|
|
61
|
-
*
|
|
62
|
-
* const userQueryOptions = (userId: string) => queryOptions({
|
|
63
|
-
* queryKey: ['user', userId],
|
|
64
|
-
* queryFn: () => fetchUser(userId)
|
|
65
|
-
* })
|
|
66
|
-
*
|
|
67
|
-
* const postsQueryOptions = () => queryOptions({
|
|
68
|
-
* queryKey: ['posts'],
|
|
69
|
-
* queryFn: () => fetchPosts()
|
|
70
|
-
* })
|
|
71
|
-
*
|
|
72
|
-
* export default function Page({ userId }: { userId: string }) {
|
|
73
|
-
* return (
|
|
74
|
-
* <>
|
|
75
|
-
* <Suspense fallback={<div>Loading user...</div>}>
|
|
76
|
-
* <QueriesHydration queries={[userQueryOptions(userId)]}>
|
|
77
|
-
* <UserProfile />
|
|
78
|
-
* </QueriesHydration>
|
|
79
|
-
* </Suspense>
|
|
80
|
-
*
|
|
81
|
-
* <Suspense fallback={<div>Loading posts...</div>}>
|
|
82
|
-
* <QueriesHydration queries={[postsQueryOptions()]}>
|
|
83
|
-
* <PostsList />
|
|
84
|
-
* </QueriesHydration>
|
|
85
|
-
* </Suspense>
|
|
86
|
-
* </>
|
|
87
|
-
* )
|
|
88
|
-
* }
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```tsx
|
|
93
|
-
* // With custom error fallback
|
|
94
|
-
* <Suspense fallback={<div>Loading user...</div>}>
|
|
95
|
-
* <QueriesHydration
|
|
96
|
-
* queries={[userQueryOptions(userId)]}
|
|
97
|
-
* skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}
|
|
98
|
-
* >
|
|
99
|
-
* <UserProfile />
|
|
100
|
-
* </QueriesHydration>
|
|
101
|
-
* </Suspense>
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}
|
|
105
|
-
*/
|
|
106
|
-
function QueriesHydration(_x) {
|
|
107
|
-
return _QueriesHydration.apply(this, arguments);
|
|
108
|
-
}
|
|
109
|
-
function _QueriesHydration() {
|
|
110
|
-
_QueriesHydration = _asyncToGenerator(function* (_ref) {
|
|
111
|
-
let { queries, children, queryClient = new QueryClient(), skipSsrOnError = true, timeout } = _ref, props = _objectWithoutProperties(_ref, _excluded);
|
|
112
|
-
const timeoutController = timeout != null && timeout >= 0 ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`) : void 0;
|
|
113
|
-
try {
|
|
114
|
-
const queriesPromise = Promise.all(queries.map((query) => "getNextPageParam" in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)));
|
|
115
|
-
yield timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise;
|
|
116
|
-
timeoutController === null || timeoutController === void 0 || timeoutController.clear();
|
|
117
|
-
} catch (_unused) {
|
|
118
|
-
timeoutController === null || timeoutController === void 0 || timeoutController.clear();
|
|
119
|
-
if (skipSsrOnError) return /* @__PURE__ */ jsx(ClientOnly, {
|
|
120
|
-
fallback: skipSsrOnError === true ? void 0 : skipSsrOnError.fallback,
|
|
121
|
-
children
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
return /* @__PURE__ */ jsx(Hydrate, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
125
|
-
state: dehydrate(queryClient),
|
|
126
|
-
children
|
|
127
|
-
}));
|
|
128
|
-
});
|
|
129
|
-
return _QueriesHydration.apply(this, arguments);
|
|
130
|
-
}
|
|
131
|
-
const createTimeoutController = (ms, errorMessage) => {
|
|
132
|
-
let timerId;
|
|
133
|
-
return {
|
|
134
|
-
promise: new Promise((_, reject) => {
|
|
135
|
-
timerId = setTimeout(() => reject(new Error(errorMessage)), ms);
|
|
136
|
-
}),
|
|
137
|
-
clear: () => timerId != null && clearTimeout(timerId)
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
//#endregion
|
|
142
|
-
export { QueriesHydration as t };
|
|
143
|
-
//# sourceMappingURL=QueriesHydration-MZQ7Oj60.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueriesHydration-MZQ7Oj60.mjs","names":[],"sources":["../src/QueriesHydration.tsx"],"sourcesContent":["import {\n Hydrate,\n type HydrateProps,\n type OmitKeyof,\n QueryClient,\n type QueryOptions,\n type UseInfiniteQueryOptions,\n type WithRequired,\n dehydrate,\n} from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { ClientOnly } from './components/ClientOnly'\n\n/**\n * A server component that fetches multiple queries on the server and hydrates them to the client.\n *\n * @experimental This component is experimental and may be changed or removed in the future.\n *\n * @description\n * QueriesHydration is designed for React Server Components (RSC).\n * It pre-fetches multiple queries on the server side and automatically hydrates\n * the data to the client, enabling seamless data synchronization between server and client.\n *\n * When errors occur during server-side fetching, the component gracefully falls back\n * to client-side rendering, ensuring your application remains resilient.\n *\n * @example\n * ```tsx\n * // app/page.tsx (Server Component)\n * import { Suspense } from 'react'\n * import { QueriesHydration } from '@suspensive/react-query'\n * import { queryOptions } from '@tanstack/react-query'\n *\n * const userQueryOptions = (userId: string) => queryOptions({\n * queryKey: ['user', userId],\n * queryFn: () => fetchUser(userId)\n * })\n *\n * const postsQueryOptions = () => queryOptions({\n * queryKey: ['posts'],\n * queryFn: () => fetchPosts()\n * })\n *\n * export default function Page({ userId }: { userId: string }) {\n * return (\n * <>\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration queries={[userQueryOptions(userId)]}>\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n *\n * <Suspense fallback={<div>Loading posts...</div>}>\n * <QueriesHydration queries={[postsQueryOptions()]}>\n * <PostsList />\n * </QueriesHydration>\n * </Suspense>\n * </>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * // With custom error fallback\n * <Suspense fallback={<div>Loading user...</div>}>\n * <QueriesHydration\n * queries={[userQueryOptions(userId)]}\n * skipSsrOnError={{ fallback: <div>Fetching on client...</div> }}\n * >\n * <UserProfile />\n * </QueriesHydration>\n * </Suspense>\n * ```\n *\n * @see {@link https://suspensive.org/docs/react-query/QueriesHydration Documentation}\n */\nexport async function QueriesHydration({\n queries,\n children,\n queryClient = new QueryClient(),\n skipSsrOnError = true,\n timeout,\n ...props\n}: {\n /**\n * The QueryClient instance to use for fetching queries.\n */\n queryClient?: QueryClient\n /**\n * An array of query options or infinite query options to be fetched on the server. Each query must include a `queryKey`.\n * You can mix regular queries and infinite queries in the same array.\n */\n queries: (\n | WithRequired<QueryOptions<any, any, any, any>, 'queryKey'>\n | WithRequired<UseInfiniteQueryOptions<any, any, any, any, any>, 'queryKey'>\n )[]\n /**\n * Controls error handling behavior:\n * - `true` (default): Skips SSR and falls back to client-side rendering when server fetch fails\n * - `false`: Proceeds with SSR without hydration (retry fetching on client component server rendering)\n * - `{ fallback: ReactNode }`: Skips SSR with custom fallback UI during client-side rendering\n */\n skipSsrOnError?:\n | boolean\n | {\n fallback: ReactNode\n }\n /**\n * The timeout in milliseconds for the query.\n * If the query takes longer than the timeout, it will be considered as an error.\n * When not set, no timeout is applied.\n */\n timeout?: number\n} & OmitKeyof<HydrateProps, 'state'>) {\n const timeoutController =\n timeout != null && timeout >= 0\n ? createTimeoutController(timeout, `QueriesHydration: timeout after ${timeout} ms)`)\n : undefined\n try {\n const queriesPromise = Promise.all(\n queries.map((query) =>\n 'getNextPageParam' in query ? queryClient.fetchInfiniteQuery(query) : queryClient.fetchQuery(query)\n )\n )\n await (timeoutController != null ? Promise.race([queriesPromise, timeoutController.promise]) : queriesPromise)\n timeoutController?.clear()\n } catch {\n timeoutController?.clear()\n if (skipSsrOnError) {\n return (\n <ClientOnly fallback={skipSsrOnError === true ? undefined : skipSsrOnError.fallback}>{children}</ClientOnly>\n )\n }\n }\n return (\n <Hydrate {...props} state={dehydrate(queryClient)}>\n {children}\n </Hydrate>\n )\n}\n\nconst createTimeoutController = (ms: number, errorMessage: string) => {\n let timerId: ReturnType<typeof setTimeout> | undefined\n return {\n promise: new Promise<never>((_, reject) => {\n timerId = setTimeout(() => reject(new Error(errorMessage)), ms)\n }),\n clear: () => timerId != null && clearTimeout(timerId),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EE;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALF,SAAsB,iBAAiB;;;;wDAqCD;MArCC,EACrC,SACA,UACA,cAAc,IAAI,aAAa,EAC/B,iBAAiB,MACjB,kBACG;EAgCH,MAAM,oBACJ,WAAW,QAAQ,WAAW,IAC1B,wBAAwB,SAAS,mCAAmC,QAAQ,MAAM,GAClF;AACN,MAAI;GACF,MAAM,iBAAiB,QAAQ,IAC7B,QAAQ,KAAK,UACX,sBAAsB,QAAQ,YAAY,mBAAmB,MAAM,GAAG,YAAY,WAAW,MAAM,CACpG,CACF;AACD,SAAO,qBAAqB,OAAO,QAAQ,KAAK,CAAC,gBAAgB,kBAAkB,QAAQ,CAAC,GAAG;AAC/F,mFAAmB,OAAO;oBACpB;AACN,mFAAmB,OAAO;AAC1B,OAAI,eACF,QACE,oBAAC,YAAD;IAAY,UAAU,mBAAmB,OAAO,SAAY,eAAe;IAAW;IAAsB;;AAIlH,SACE,oBAAC,2CAAY;GAAO,OAAO,UAAU,YAAY;GAC9C;IACO;;;;AAId,MAAM,2BAA2B,IAAY,iBAAyB;CACpE,IAAI;AACJ,QAAO;EACL,SAAS,IAAI,SAAgB,GAAG,WAAW;AACzC,aAAU,iBAAiB,OAAO,IAAI,MAAM,aAAa,CAAC,EAAE,GAAG;IAC/D;EACF,aAAa,WAAW,QAAQ,aAAa,QAAQ;EACtD"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
//#region src/components/ClientOnly.d.ts
|
|
4
|
-
declare const ClientOnly: ({
|
|
5
|
-
children,
|
|
6
|
-
fallback
|
|
7
|
-
}: {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
fallback: React.ReactNode;
|
|
10
|
-
}) => react_jsx_runtime0.JSX.Element;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { ClientOnly };
|
|
13
|
-
//# sourceMappingURL=ClientOnly.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientOnly.d.cts","names":[],"sources":["../../src/components/ClientOnly.tsx"],"mappings":";;;cAUa,UAAA;EAAc,QAAA;EAAA;AAAA;EAA0B,QAAA,EAAU,KAAA,CAAM,SAAA;EAAW,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA,MAAW,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
//#region src/components/ClientOnly.d.ts
|
|
4
|
-
declare const ClientOnly: ({
|
|
5
|
-
children,
|
|
6
|
-
fallback
|
|
7
|
-
}: {
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
fallback: React.ReactNode;
|
|
10
|
-
}) => react_jsx_runtime0.JSX.Element;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { ClientOnly };
|
|
13
|
-
//# sourceMappingURL=ClientOnly.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientOnly.d.mts","names":[],"sources":["../../src/components/ClientOnly.tsx"],"mappings":";;;cAUa,UAAA;EAAc,QAAA;EAAA;AAAA;EAA0B,QAAA,EAAU,KAAA,CAAM,SAAA;EAAW,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA,MAAW,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/typeof.js
|
|
3
|
-
function _typeof(o) {
|
|
4
|
-
"@babel/helpers - typeof";
|
|
5
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
6
|
-
return typeof o;
|
|
7
|
-
} : function(o) {
|
|
8
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
9
|
-
}, _typeof(o);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/toPrimitive.js
|
|
14
|
-
function toPrimitive(t, r) {
|
|
15
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
16
|
-
var e = t[Symbol.toPrimitive];
|
|
17
|
-
if (void 0 !== e) {
|
|
18
|
-
var i = e.call(t, r || "default");
|
|
19
|
-
if ("object" != _typeof(i)) return i;
|
|
20
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
21
|
-
}
|
|
22
|
-
return ("string" === r ? String : Number)(t);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/toPropertyKey.js
|
|
27
|
-
function toPropertyKey(t) {
|
|
28
|
-
var i = toPrimitive(t, "string");
|
|
29
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/defineProperty.js
|
|
34
|
-
function _defineProperty(e, r, t) {
|
|
35
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
36
|
-
value: t,
|
|
37
|
-
enumerable: !0,
|
|
38
|
-
configurable: !0,
|
|
39
|
-
writable: !0
|
|
40
|
-
}) : e[r] = t, e;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/objectSpread2.js
|
|
45
|
-
function ownKeys(e, r) {
|
|
46
|
-
var t = Object.keys(e);
|
|
47
|
-
if (Object.getOwnPropertySymbols) {
|
|
48
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
49
|
-
r && (o = o.filter(function(r) {
|
|
50
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
51
|
-
})), t.push.apply(t, o);
|
|
52
|
-
}
|
|
53
|
-
return t;
|
|
54
|
-
}
|
|
55
|
-
function _objectSpread2(e) {
|
|
56
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
57
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
58
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
59
|
-
_defineProperty(e, r, t[r]);
|
|
60
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
61
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return e;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
Object.defineProperty(exports, '_objectSpread2', {
|
|
69
|
-
enumerable: true,
|
|
70
|
-
get: function () {
|
|
71
|
-
return _objectSpread2;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/typeof.js
|
|
2
|
-
function _typeof(o) {
|
|
3
|
-
"@babel/helpers - typeof";
|
|
4
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
5
|
-
return typeof o;
|
|
6
|
-
} : function(o) {
|
|
7
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8
|
-
}, _typeof(o);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/toPrimitive.js
|
|
13
|
-
function toPrimitive(t, r) {
|
|
14
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
15
|
-
var e = t[Symbol.toPrimitive];
|
|
16
|
-
if (void 0 !== e) {
|
|
17
|
-
var i = e.call(t, r || "default");
|
|
18
|
-
if ("object" != _typeof(i)) return i;
|
|
19
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
20
|
-
}
|
|
21
|
-
return ("string" === r ? String : Number)(t);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/toPropertyKey.js
|
|
26
|
-
function toPropertyKey(t) {
|
|
27
|
-
var i = toPrimitive(t, "string");
|
|
28
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/defineProperty.js
|
|
33
|
-
function _defineProperty(e, r, t) {
|
|
34
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
35
|
-
value: t,
|
|
36
|
-
enumerable: !0,
|
|
37
|
-
configurable: !0,
|
|
38
|
-
writable: !0
|
|
39
|
-
}) : e[r] = t, e;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/objectSpread2.js
|
|
44
|
-
function ownKeys(e, r) {
|
|
45
|
-
var t = Object.keys(e);
|
|
46
|
-
if (Object.getOwnPropertySymbols) {
|
|
47
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
48
|
-
r && (o = o.filter(function(r) {
|
|
49
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
50
|
-
})), t.push.apply(t, o);
|
|
51
|
-
}
|
|
52
|
-
return t;
|
|
53
|
-
}
|
|
54
|
-
function _objectSpread2(e) {
|
|
55
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
56
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
57
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
58
|
-
_defineProperty(e, r, t[r]);
|
|
59
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
60
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return e;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
//#endregion
|
|
67
|
-
export { _objectSpread2 as t };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/objectWithoutPropertiesLoose.js
|
|
3
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
4
|
-
if (null == r) return {};
|
|
5
|
-
var t = {};
|
|
6
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
7
|
-
if (e.includes(n)) continue;
|
|
8
|
-
t[n] = r[n];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/objectWithoutProperties.js
|
|
15
|
-
function _objectWithoutProperties(e, t) {
|
|
16
|
-
if (null == e) return {};
|
|
17
|
-
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
18
|
-
if (Object.getOwnPropertySymbols) {
|
|
19
|
-
var s = Object.getOwnPropertySymbols(e);
|
|
20
|
-
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
21
|
-
}
|
|
22
|
-
return i;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
Object.defineProperty(exports, '_objectWithoutProperties', {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return _objectWithoutProperties;
|
|
30
|
-
}
|
|
31
|
-
});
|