eddev 2.0.0-beta.4 → 2.0.0-beta.6

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.
@@ -33,7 +33,10 @@ export type UseInfiniteQueryFunction<TData, TVars> = (args: OptionalMaybes<Omit<
33
33
  headers?: Record<string, string>;
34
34
  /** Initial data can be passed in, but should match the original GraphQL query in structure (including nodes/hasNextPage/endCursor) */
35
35
  initialData?: any;
36
- }) => UseInfiniteQueryResult<TData, QueryError>;
36
+ }) => UseInfiniteQueryResult<{
37
+ nodes: TData;
38
+ total?: number | null;
39
+ }, QueryError>;
37
40
  export declare function createUseInfiniteQuery<TData extends any, TVars extends MaybeVars>(init: CreateUseInfiniteQueryOptions): UseInfiniteQueryFunction<TData, TVars>;
38
41
  export type UseMutationFunction<TData, TArgs> = ((options?: Omit<UseMutationOptions<TData, QueryError, TArgs>, "mutationFn"> & {
39
42
  headers?: Record<string, string>;
@@ -60,14 +60,6 @@ export function createUseQuery(init) {
60
60
  };
61
61
  return hook;
62
62
  }
63
- // & {
64
- // fetch: (
65
- // args: OptionalMaybes<TVars>,
66
- // options?: Omit<FetchInfiniteQueryOptions<TData, QueryError, InfiniteData<TData, string>>, "queryKey" | "queryFn"> & {
67
- // headers?: Record<string, string>
68
- // },
69
- // ) => Promise<TData>
70
- // }
71
63
  function selectByPath(data, path) {
72
64
  return path.reduce((acc, key) => (acc ? acc[key] : null), data);
73
65
  }
@@ -109,10 +101,12 @@ export function createUseInfiniteQuery(init) {
109
101
  const endCursor = selectByPath(data, init.paths.endCursorPath);
110
102
  const hasNextPage = selectByPath(data, init.paths.hasNextPagePath);
111
103
  const nodes = selectByPath(data, init.paths.nodesPath);
104
+ const total = selectByPath(data, [...init.paths.pageInfoPath, "total"]);
112
105
  return {
113
106
  nodes,
114
107
  hasNextPage,
115
108
  endCursor,
109
+ total,
116
110
  };
117
111
  },
118
112
  initialPageParam: "",
@@ -121,7 +115,10 @@ export function createUseInfiniteQuery(init) {
121
115
  return lastPage.hasNextPage ? lastPage.endCursor : undefined;
122
116
  },
123
117
  select(data) {
124
- return data.pages.flatMap((page) => page.nodes);
118
+ return {
119
+ nodes: data.pages.flatMap((page) => page.nodes),
120
+ total: data.pages[data.pages.length - 1]?.total,
121
+ };
125
122
  },
126
123
  ...options,
127
124
  ...initial,
@@ -1 +1 @@
1
- export declare const VERSION = "2.0.0-beta.4";
1
+ export declare const VERSION = "2.0.0-beta.6";
@@ -1 +1 @@
1
- export const VERSION = "2.0.0-beta.4";
1
+ export const VERSION = "2.0.0-beta.6";
@@ -75,6 +75,13 @@ export class ServerlessDevServer {
75
75
  path: "/_hmr",
76
76
  },
77
77
  },
78
+ optimizeDeps: {
79
+ include: ["valtio", "zustand", "qs", "react", "react-dom/client"],
80
+ exclude: ["eddev"],
81
+ },
82
+ ssr: {
83
+ noExternal: ["eddev"],
84
+ },
78
85
  build: {
79
86
  ssr: true,
80
87
  sourcemap: true,
@@ -63,14 +63,14 @@ export function getViteConfig(args) {
63
63
  "process.env.NODE_ENV": JSON.stringify(args.mode),
64
64
  // ssrLoadModule: "() => Promise.resolve({})",
65
65
  },
66
- optimizeDeps: {
67
- // force: true,
68
- // holdUntilCrawlEnd: true,
69
- // include: ["zustand"],
70
- // noDiscovery: true,
71
- // exclude: ["react-external.js", "react-dom-external.js", "react", "react-dom"],
72
- // esbuildOptions: {},
73
- },
66
+ // optimizeDeps: {
67
+ // force: true,
68
+ // holdUntilCrawlEnd: true,
69
+ // include: ["zustand"],
70
+ // noDiscovery: true,
71
+ // exclude: ["react-external.js", "react-dom-external.js", "react", "react-dom"],
72
+ // esbuildOptions: {},
73
+ // },
74
74
  resolve: {
75
75
  alias: [
76
76
  { find: "@manifest/blocks", replacement: join(args.project.rootDir, "__block-manifest.js") },
@@ -271,14 +271,6 @@ export function getViteConfig(args) {
271
271
  }
272
272
  : undefined,
273
273
  },
274
- sourcemap: true,
275
- minify: args.mode === "production",
276
- modulePreload: false,
277
- outDir: args.outDir,
278
- watch: {},
279
- commonjsOptions: {
280
- exclude: ["eddev"],
281
- },
282
274
  }
283
275
  : {
284
276
  manifest: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",