@payloadcms/tanstack-start 4.0.0-beta.1 → 4.0.0-beta.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/adapters/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,aAAa,EAAE,MAAM,SAAS,CAAA;AAsDxE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aA8CnC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,QAAS,aAAa,KAAG,aAgBjE,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/adapters/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,SAAS,CAAA;AAoBzD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aA4CnC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,QAAS,aAAa,KAAG,aAgBjE,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { notFound, redirect } from '@tanstack/react-router';
2
- import { getRequest, getResponseHeaders } from '@tanstack/react-start/server';
2
+ import { getRequest, setCookie as setResponseCookie } from '@tanstack/react-start/server';
3
3
  import { parseCookies } from 'payload';
4
4
  function buildCookieStore(headers) {
5
5
  const cookies = parseCookies(headers);
@@ -19,31 +19,6 @@ function buildCookieStore(headers) {
19
19
  }
20
20
  };
21
21
  }
22
- function serializeCookie(name, value, options) {
23
- let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
24
- if (options?.path) {
25
- cookie += `; Path=${options.path}`;
26
- }
27
- if (options?.domain) {
28
- cookie += `; Domain=${options.domain}`;
29
- }
30
- if (options?.maxAge !== undefined) {
31
- cookie += `; Max-Age=${options.maxAge}`;
32
- }
33
- if (options?.expires) {
34
- cookie += `; Expires=${options.expires.toUTCString()}`;
35
- }
36
- if (options?.httpOnly) {
37
- cookie += '; HttpOnly';
38
- }
39
- if (options?.secure) {
40
- cookie += '; Secure';
41
- }
42
- if (options?.sameSite) {
43
- cookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`;
44
- }
45
- return cookie;
46
- }
47
22
  /**
48
23
  * Server-side adapter for TanStack Start.
49
24
  * Uses `@tanstack/react-start/server` utilities for request/response handling.
@@ -87,9 +62,7 @@ function serializeCookie(name, value, options) {
87
62
  // a generic error so the request boundary still terminates the request.
88
63
  throw new Error('Unauthorized');
89
64
  },
90
- setCookie: (name, value, options)=>{
91
- getResponseHeaders().append('Set-Cookie', serializeCookie(name, value, options));
92
- }
65
+ setCookie: setResponseCookie
93
66
  };
94
67
  /**
95
68
  * Builds the `ServerAdapter` for the admin page render (`renderRoot`). Like
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/adapters/server.ts"],"sourcesContent":["import type { CookieOptions, CookieStore, ServerAdapter } from 'payload'\n\nimport { notFound, redirect } from '@tanstack/react-router'\nimport { getRequest, getResponseHeaders } from '@tanstack/react-start/server'\nimport { parseCookies } from 'payload'\n\nfunction buildCookieStore(headers: Headers): CookieStore {\n const cookies = parseCookies(headers)\n\n return {\n get: (name: string) => {\n const value = cookies.get(name)\n return value !== undefined ? { name, value } : undefined\n },\n getAll: () => {\n return Array.from(cookies.entries()).map(([name, value]) => ({ name, value }))\n },\n }\n}\n\nfunction serializeCookie(name: string, value: string, options?: CookieOptions): string {\n let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`\n\n if (options?.path) {\n cookie += `; Path=${options.path}`\n }\n\n if (options?.domain) {\n cookie += `; Domain=${options.domain}`\n }\n\n if (options?.maxAge !== undefined) {\n cookie += `; Max-Age=${options.maxAge}`\n }\n\n if (options?.expires) {\n cookie += `; Expires=${options.expires.toUTCString()}`\n }\n\n if (options?.httpOnly) {\n cookie += '; HttpOnly'\n }\n\n if (options?.secure) {\n cookie += '; Secure'\n }\n\n if (options?.sameSite) {\n cookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`\n }\n\n return cookie\n}\n\n/**\n * Server-side adapter for TanStack Start.\n * Uses `@tanstack/react-start/server` utilities for request/response handling.\n */\nexport const tanstackServerAdapter: ServerAdapter = {\n getCookies: () => {\n const request = getRequest()\n const headers = new Headers(request.headers)\n return buildCookieStore(headers)\n },\n\n getHeaders: () => {\n const request = getRequest()\n return new Headers(request.headers)\n },\n\n notFound: () => {\n // TanStack Router requires throwing the notFound() result directly\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw notFound()\n },\n\n redirect: (path: string) => {\n // TanStack Router requires throwing the redirect() result directly\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw redirect({ to: path })\n },\n\n permanentRedirect: (path: string) => {\n // TanStack Router does not have a separate permanent redirect primitive;\n // fall back to a regular redirect so existing behavior is preserved.\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw redirect({ to: path })\n },\n\n forbidden: () => {\n // TanStack Router does not have a dedicated forbidden() helper; surface\n // a generic error so the request boundary still terminates the request.\n throw new Error('Forbidden')\n },\n\n unauthorized: () => {\n // TanStack Router does not have a dedicated unauthorized() helper; surface\n // a generic error so the request boundary still terminates the request.\n throw new Error('Unauthorized')\n },\n\n setCookie: (name: string, value: string, options?: CookieOptions) => {\n getResponseHeaders().append('Set-Cookie', serializeCookie(name, value, options))\n },\n}\n\n/**\n * Navigation requested during an admin page render, recorded by\n * `createPageRenderServerAdapter`. The admin-page server function reads this\n * after `renderServerComponent` resolves.\n */\nexport type PageNavIntent = {\n type?: 'notFound' | 'redirect'\n url?: string\n}\n\n/**\n * Builds the `ServerAdapter` for the admin page render (`renderRoot`). Like\n * `tanstackServerAdapter` for cookies/headers, but navigation **records the\n * intent on `nav` and throws** the framework-agnostic string error-contract\n * (`Error('not-found')` / `Error('redirect:<url>')`) instead of TanStack's\n * native `notFound`/`redirect`.\n *\n * `renderRoot` navigates via `req.server.*` in two places:\n * - during orchestration (e.g. the unauthenticated login redirect) — the throw\n * propagates out of `renderRoot` and is caught by the loader's try/catch;\n * - deep inside streamed view components (e.g. `DocumentView` access checks,\n * `LoginView` already-authenticated) — here the throw happens during\n * `renderServerComponent` and is swallowed into the RSC stream, so it never\n * rejects the render promise.\n *\n * Recording the intent on `nav` lets the loader honor the second case by\n * inspecting `nav` after the render resolves, then re-throwing native TanStack\n * nav at the loader boundary.\n */\nexport const createPageRenderServerAdapter = (nav: PageNavIntent): ServerAdapter => ({\n ...tanstackServerAdapter,\n notFound: () => {\n nav.type = 'notFound'\n throw new Error('not-found')\n },\n permanentRedirect: (path: string) => {\n nav.type = 'redirect'\n nav.url = path\n throw new Error(`redirect:${path}`)\n },\n redirect: (path: string) => {\n nav.type = 'redirect'\n nav.url = path\n throw new Error(`redirect:${path}`)\n },\n})\n"],"names":["notFound","redirect","getRequest","getResponseHeaders","parseCookies","buildCookieStore","headers","cookies","get","name","value","undefined","getAll","Array","from","entries","map","serializeCookie","options","cookie","encodeURIComponent","path","domain","maxAge","expires","toUTCString","httpOnly","secure","sameSite","charAt","toUpperCase","slice","tanstackServerAdapter","getCookies","request","Headers","getHeaders","to","permanentRedirect","forbidden","Error","unauthorized","setCookie","append","createPageRenderServerAdapter","nav","type","url"],"mappings":"AAEA,SAASA,QAAQ,EAAEC,QAAQ,QAAQ,yBAAwB;AAC3D,SAASC,UAAU,EAAEC,kBAAkB,QAAQ,+BAA8B;AAC7E,SAASC,YAAY,Q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OAAO;QAC3C,OAAOD,iBAAiBC;IAC1B;IAEA8B,YAAY;QACV,MAAMF,UAAUhC;QAChB,OAAO,IAAIiC,QAAQD,QAAQ5B,OAAO;IACpC;IAEAN,UAAU;QACR,mEAAmE;QACnE,+DAA+D;QAC/D,MAAMA;IACR;IAEAC,UAAU,CAACoB;QACT,mEAAmE;QACnE,+DAA+D;QAC/D,MAAMpB,SAAS;YAAEoC,IAAIhB;QAAK;IAC5B;IAEAiB,mBAAmB,CAACjB;QAClB,yEAAyE;QACzE,qEAAqE;QACrE,+DAA+D;QAC/D,MAAMpB,SAAS;YAAEoC,IAAIhB;QAAK;IAC5B;IAEAkB,WAAW;QACT,wEAAwE;QACxE,wEAAwE;QACxE,MAAM,IAAIC,MAAM;IAClB;IAEAC,cAAc;QACZ,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,IAAID,MAAM;IAClB;IAEAE,WAAW,CAACjC,MAAcC,OAAeQ;QACvCf,qBAAqBwC,MAAM,CAAC,cAAc1B,gBAAgBR,MAAMC,OAAOQ;IACzE;AACF,EAAC;AAYD;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,MAAM0B,gCAAgC,CAACC,MAAuC,CAAA;QACnF,GAAGb,qBAAqB;QACxBhC,UAAU;YACR6C,IAAIC,IAAI,GAAG;YACX,MAAM,IAAIN,MAAM;QAClB;QACAF,mBAAmB,CAACjB;YAClBwB,IAAIC,IAAI,GAAG;YACXD,IAAIE,GAAG,GAAG1B;YACV,MAAM,IAAImB,MAAM,CAAC,SAAS,EAAEnB,MAAM;QACpC;QACApB,UAAU,CAACoB;YACTwB,IAAIC,IAAI,GAAG;YACXD,IAAIE,GAAG,GAAG1B;YACV,MAAM,IAAImB,MAAM,CAAC,SAAS,EAAEnB,MAAM;QACpC;IACF,CAAA,EAAE"}
1
+ {"version":3,"sources":["../../src/adapters/server.ts"],"sourcesContent":["import type { CookieStore, ServerAdapter } from 'payload'\n\nimport { notFound, redirect } from '@tanstack/react-router'\nimport { getRequest, setCookie as setResponseCookie } from '@tanstack/react-start/server'\nimport { parseCookies } from 'payload'\n\nfunction buildCookieStore(headers: Headers): CookieStore {\n const cookies = parseCookies(headers)\n\n return {\n get: (name: string) => {\n const value = cookies.get(name)\n return value !== undefined ? { name, value } : undefined\n },\n getAll: () => {\n return Array.from(cookies.entries()).map(([name, value]) => ({ name, value }))\n },\n }\n}\n\n/**\n * Server-side adapter for TanStack Start.\n * Uses `@tanstack/react-start/server` utilities for request/response handling.\n */\nexport const tanstackServerAdapter: ServerAdapter = {\n getCookies: () => {\n const request = getRequest()\n const headers = new Headers(request.headers)\n return buildCookieStore(headers)\n },\n\n getHeaders: () => {\n const request = getRequest()\n return new Headers(request.headers)\n },\n\n notFound: () => {\n // TanStack Router requires throwing the notFound() result directly\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw notFound()\n },\n\n redirect: (path: string) => {\n // TanStack Router requires throwing the redirect() result directly\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw redirect({ to: path })\n },\n\n permanentRedirect: (path: string) => {\n // TanStack Router does not have a separate permanent redirect primitive;\n // fall back to a regular redirect so existing behavior is preserved.\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw redirect({ to: path })\n },\n\n forbidden: () => {\n // TanStack Router does not have a dedicated forbidden() helper; surface\n // a generic error so the request boundary still terminates the request.\n throw new Error('Forbidden')\n },\n\n unauthorized: () => {\n // TanStack Router does not have a dedicated unauthorized() helper; surface\n // a generic error so the request boundary still terminates the request.\n throw new Error('Unauthorized')\n },\n\n setCookie: setResponseCookie,\n}\n\n/**\n * Navigation requested during an admin page render, recorded by\n * `createPageRenderServerAdapter`. The admin-page server function reads this\n * after `renderServerComponent` resolves.\n */\nexport type PageNavIntent = {\n type?: 'notFound' | 'redirect'\n url?: string\n}\n\n/**\n * Builds the `ServerAdapter` for the admin page render (`renderRoot`). Like\n * `tanstackServerAdapter` for cookies/headers, but navigation **records the\n * intent on `nav` and throws** the framework-agnostic string error-contract\n * (`Error('not-found')` / `Error('redirect:<url>')`) instead of TanStack's\n * native `notFound`/`redirect`.\n *\n * `renderRoot` navigates via `req.server.*` in two places:\n * - during orchestration (e.g. the unauthenticated login redirect) — the throw\n * propagates out of `renderRoot` and is caught by the loader's try/catch;\n * - deep inside streamed view components (e.g. `DocumentView` access checks,\n * `LoginView` already-authenticated) — here the throw happens during\n * `renderServerComponent` and is swallowed into the RSC stream, so it never\n * rejects the render promise.\n *\n * Recording the intent on `nav` lets the loader honor the second case by\n * inspecting `nav` after the render resolves, then re-throwing native TanStack\n * nav at the loader boundary.\n */\nexport const createPageRenderServerAdapter = (nav: PageNavIntent): ServerAdapter => ({\n ...tanstackServerAdapter,\n notFound: () => {\n nav.type = 'notFound'\n throw new Error('not-found')\n },\n permanentRedirect: (path: string) => {\n nav.type = 'redirect'\n nav.url = path\n throw new Error(`redirect:${path}`)\n },\n redirect: (path: string) => {\n nav.type = 'redirect'\n nav.url = path\n throw new Error(`redirect:${path}`)\n },\n})\n"],"names":["notFound","redirect","getRequest","setCookie","setResponseCookie","parseCookies","buildCookieStore","headers","cookies","get","name","value","undefined","getAll","Array","from","entries","map","tanstackServerAdapter","getCookies","request","Headers","getHeaders","path","to","permanentRedirect","forbidden","Error","unauthorized","createPageRenderServerAdapter","nav","type","url"],"mappings":"AAEA,SAASA,QAAQ,EAAEC,QAAQ,QAAQ,yBAAwB;AAC3D,SAASC,UAAU,EAAEC,aAAaC,iBAAiB,QAAQ,+BAA8B;AACzF,SAASC,YAAY,QAAQ,UAAS;AAEtC,SAASC,iBAAiBC,OAAgB;IACxC,MAAMC,UAAUH,aAAaE;IAE7B,OAAO;QACLE,KAAK,CAACC;YACJ,MAAMC,QAAQH,QAAQC,GAAG,CAACC;YAC1B,OAAOC,UAAUC,YAAY;gBAAEF;gBAAMC;YAAM,IAAIC;QACjD;QACAC,QAAQ;YACN,OAAOC,MAAMC,IAAI,CAACP,QAAQQ,OAAO,IAAIC,GAAG,CAAC,CAAC,CAACP,MAA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ig } from 'payload';
2
2
  /**
3
- * Routes a TanStack Start API request (`/api/*`) to Payload's REST/GraphQL
4
- * endpoint handler. The framework adapter wires this into the `/api/$` route's
5
- * server handlers, supplying the app's resolved `config`.
3
+ * Routes a TanStack Start API request to Payload's endpoint handler. The framework adapter
4
+ * wires this into the app's API route and supplies the resolved `config`.
6
5
  */
7
6
  export declare function handleAPIRoute({ config, request, }: {
8
7
  config: SanitizedConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"handler.server.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/handler.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,EACnC,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAapB"}
1
+ {"version":3,"file":"handler.server.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/handler.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C;;;GAGG;AACH,wBAAsB,cAAc,CAAC,EACnC,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAMpB"}
@@ -1,15 +1,11 @@
1
1
  import { handleEndpoints } from 'payload';
2
2
  /**
3
- * Routes a TanStack Start API request (`/api/*`) to Payload's REST/GraphQL
4
- * endpoint handler. The framework adapter wires this into the `/api/$` route's
5
- * server handlers, supplying the app's resolved `config`.
3
+ * Routes a TanStack Start API request to Payload's endpoint handler. The framework adapter
4
+ * wires this into the app's API route and supplies the resolved `config`.
6
5
  */ export async function handleAPIRoute({ config, request }) {
7
- const url = new URL(request.url);
8
- const slugParts = url.pathname.replace(/^\/api\/?/, '').split('/').filter(Boolean);
9
- const path = slugParts.length ? `/api/${slugParts.join('/')}` : '/api';
10
6
  return handleEndpoints({
11
7
  config,
12
- path,
8
+ path: new URL(request.url).pathname,
13
9
  request
14
10
  });
15
11
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/routes/rest/handler.server.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { handleEndpoints } from 'payload'\n\n/**\n * Routes a TanStack Start API request (`/api/*`) to Payload's REST/GraphQL\n * endpoint handler. The framework adapter wires this into the `/api/$` route's\n * server handlers, supplying the app's resolved `config`.\n */\nexport async function handleAPIRoute({\n config,\n request,\n}: {\n config: SanitizedConfig\n request: Request\n}): Promise<Response> {\n const url = new URL(request.url)\n const slugParts = url.pathname\n .replace(/^\\/api\\/?/, '')\n .split('/')\n .filter(Boolean)\n const path = slugParts.length ? `/api/${slugParts.join('/')}` : '/api'\n\n return handleEndpoints({\n config,\n path,\n request,\n })\n}\n"],"names":["handleEndpoints","handleAPIRoute","config","request","url","URL","slugParts","pathname","replace","split","filter","Boolean","path","length","join"],"mappings":"AAEA,SAASA,eAAe,QAAQ,UAAS;AAEzC;;;;CAIC,GACD,OAAO,eAAeC,eAAe,EACnCC,MAAM,EACNC,OAAO,EAIR;IACC,MAAMC,MAAM,IAAIC,IAAIF,QAAQC,GAAG;IAC/B,MAAME,YAAYF,IAAIG,QAAQ,CAC3BC,OAAO,CAAC,aAAa,IACrBC,KAAK,CAAC,KACNC,MAAM,CAACC;IACV,MAAMC,OAAON,UAAUO,MAAM,GAAG,CAAC,KAAK,EAAEP,UAAUQ,IAAI,CAAC,MAAM,GAAG;IAEhE,OAAOd,gBAAgB;QACrBE;QACAU;QACAT;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/routes/rest/handler.server.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { handleEndpoints } from 'payload'\n\n/**\n * Routes a TanStack Start API request to Payload's endpoint handler. The framework adapter\n * wires this into the app's API route and supplies the resolved `config`.\n */\nexport async function handleAPIRoute({\n config,\n request,\n}: {\n config: SanitizedConfig\n request: Request\n}): Promise<Response> {\n return handleEndpoints({\n config,\n path: new URL(request.url).pathname,\n request,\n })\n}\n"],"names":["handleEndpoints","handleAPIRoute","config","request","path","URL","url","pathname"],"mappings":"AAEA,SAASA,eAAe,QAAQ,UAAS;AAEzC;;;CAGC,GACD,OAAO,eAAeC,eAAe,EACnCC,MAAM,EACNC,OAAO,EAIR;IACC,OAAOH,gBAAgB;QACrBE;QACAE,MAAM,IAAIC,IAAIF,QAAQG,GAAG,EAAEC,QAAQ;QACnCJ;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/tanstack-start",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.2",
4
4
  "description": "TanStack Start framework adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -59,32 +59,32 @@
59
59
  "dependencies": {
60
60
  "graphql-http": "1.22.4",
61
61
  "qs-esm": "^7.0.2",
62
- "@payloadcms/graphql": "4.0.0-beta.1",
63
- "@payloadcms/ui": "4.0.0-beta.1",
64
- "@payloadcms/translations": "4.0.0-beta.1"
62
+ "@payloadcms/graphql": "4.0.0-beta.2",
63
+ "@payloadcms/translations": "4.0.0-beta.2",
64
+ "@payloadcms/ui": "4.0.0-beta.2"
65
65
  },
66
66
  "devDependencies": {
67
- "@tanstack/react-router": "^1.120.0",
68
- "@tanstack/react-start": "^1.168.60",
67
+ "@tanstack/react-router": "^1.170.44",
68
+ "@tanstack/react-start": "^1.169.1",
69
69
  "@types/react": "^19.0.0",
70
70
  "@types/react-dom": "^19.0.0",
71
71
  "@vitejs/plugin-react": "^6.0.0",
72
72
  "@vitejs/plugin-rsc": "^0.5.21",
73
- "react": "19.3.0",
74
- "react-dom": "19.3.0",
73
+ "react": "19.3.1",
74
+ "react-dom": "19.3.1",
75
75
  "vite": ">=8.0.0",
76
- "payload": "4.0.0-beta.1"
76
+ "payload": "4.0.0-beta.2"
77
77
  },
78
78
  "peerDependencies": {
79
- "@tanstack/react-router": "^1.120.0",
80
- "@tanstack/react-start": "^1.168.60",
79
+ "@tanstack/react-router": "^1.170.44",
80
+ "@tanstack/react-start": "^1.169.1",
81
81
  "@vitejs/plugin-react": "^6.0.0",
82
82
  "@vitejs/plugin-rsc": "^0.5.21",
83
83
  "graphql": "^16.8.1",
84
84
  "react": "^19.0.0",
85
85
  "react-dom": "^19.0.0",
86
86
  "vite": ">=8.0.0",
87
- "payload": "4.0.0-beta.1"
87
+ "payload": "4.0.0-beta.2"
88
88
  },
89
89
  "peerDependenciesMeta": {
90
90
  "@vitejs/plugin-react": {