@payloadcms/tanstack-start 4.0.0-internal.fa345ef → 4.0.0-internal.fec2230

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 (231) hide show
  1. package/dist/auth/login.d.ts +3 -16
  2. package/dist/auth/login.d.ts.map +1 -1
  3. package/dist/auth/login.js +6 -46
  4. package/dist/auth/login.js.map +1 -1
  5. package/dist/auth/logout.d.ts +2 -5
  6. package/dist/auth/logout.d.ts.map +1 -1
  7. package/dist/auth/logout.js +6 -47
  8. package/dist/auth/logout.js.map +1 -1
  9. package/dist/auth/refresh.d.ts +2 -4
  10. package/dist/auth/refresh.d.ts.map +1 -1
  11. package/dist/auth/refresh.js +6 -49
  12. package/dist/auth/refresh.js.map +1 -1
  13. package/dist/elements/RouterAdapter/index.d.ts.map +1 -1
  14. package/dist/elements/RouterAdapter/index.js +35 -5
  15. package/dist/elements/RouterAdapter/index.js.map +1 -1
  16. package/dist/exports/client.d.ts +1 -3
  17. package/dist/exports/client.d.ts.map +1 -1
  18. package/dist/exports/client.js +1 -3
  19. package/dist/exports/client.js.map +1 -1
  20. package/dist/exports/layouts.d.ts +2 -4
  21. package/dist/exports/layouts.d.ts.map +1 -1
  22. package/dist/exports/layouts.js +0 -1
  23. package/dist/exports/layouts.js.map +1 -1
  24. package/dist/exports/rsc.browser.d.ts +4 -1
  25. package/dist/exports/rsc.browser.d.ts.map +1 -1
  26. package/dist/exports/rsc.browser.js +4 -1
  27. package/dist/exports/rsc.browser.js.map +1 -1
  28. package/dist/exports/rsc.d.ts +0 -1
  29. package/dist/exports/rsc.d.ts.map +1 -1
  30. package/dist/exports/rsc.js +0 -1
  31. package/dist/exports/rsc.js.map +1 -1
  32. package/dist/exports/server.d.ts +4 -4
  33. package/dist/exports/server.d.ts.map +1 -1
  34. package/dist/exports/server.js +3 -3
  35. package/dist/exports/server.js.map +1 -1
  36. package/dist/exports/shared.d.ts +2 -0
  37. package/dist/exports/shared.d.ts.map +1 -0
  38. package/dist/exports/shared.js +3 -0
  39. package/dist/exports/shared.js.map +1 -0
  40. package/dist/index.d.ts +1 -5
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +1 -5
  43. package/dist/index.js.map +1 -1
  44. package/dist/layouts/Root/getLayoutData.d.ts +24 -2
  45. package/dist/layouts/Root/getLayoutData.d.ts.map +1 -1
  46. package/dist/layouts/Root/getLayoutData.js +7 -1
  47. package/dist/layouts/Root/getLayoutData.js.map +1 -1
  48. package/dist/layouts/Root/withPayloadRoot.d.ts +7 -31
  49. package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -1
  50. package/dist/layouts/Root/withPayloadRoot.js +33 -34
  51. package/dist/layouts/Root/withPayloadRoot.js.map +1 -1
  52. package/dist/node/cssLoader.d.mts +24 -2
  53. package/dist/node/cssLoader.d.mts.map +1 -1
  54. package/dist/routes/adminRoutes.d.ts +10 -13
  55. package/dist/routes/adminRoutes.d.ts.map +1 -1
  56. package/dist/routes/adminRoutes.js +52 -45
  57. package/dist/routes/adminRoutes.js.map +1 -1
  58. package/dist/routes/apiRoute.d.ts +5 -0
  59. package/dist/routes/apiRoute.d.ts.map +1 -1
  60. package/dist/routes/apiRoute.js +6 -1
  61. package/dist/routes/apiRoute.js.map +1 -1
  62. package/dist/routes/layoutRoute.d.ts +4 -3
  63. package/dist/routes/layoutRoute.d.ts.map +1 -1
  64. package/dist/routes/layoutRoute.js +1 -0
  65. package/dist/routes/layoutRoute.js.map +1 -1
  66. package/dist/utilities/devConfigReload.server.d.ts +2 -0
  67. package/dist/utilities/devConfigReload.server.d.ts.map +1 -0
  68. package/dist/utilities/devConfigReload.server.js +38 -0
  69. package/dist/utilities/devConfigReload.server.js.map +1 -0
  70. package/dist/utilities/devConfigReloadEvent.d.ts +9 -0
  71. package/dist/utilities/devConfigReloadEvent.d.ts.map +1 -0
  72. package/dist/utilities/devConfigReloadEvent.js +9 -0
  73. package/dist/utilities/devConfigReloadEvent.js.map +1 -0
  74. package/dist/utilities/getRequestLocale.d.ts.map +1 -1
  75. package/dist/utilities/getRequestLocale.js +1 -2
  76. package/dist/utilities/getRequestLocale.js.map +1 -1
  77. package/dist/utilities/graphqlHandler.server.d.ts.map +1 -1
  78. package/dist/utilities/{handleAPIRoute.d.ts → handleAPIRoute.server.d.ts} +1 -1
  79. package/dist/utilities/handleAPIRoute.server.d.ts.map +1 -0
  80. package/dist/utilities/{handleAPIRoute.js → handleAPIRoute.server.js} +1 -1
  81. package/dist/utilities/handleAPIRoute.server.js.map +1 -0
  82. package/dist/utilities/handleServerFunctions.d.ts +1 -19
  83. package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
  84. package/dist/utilities/handleServerFunctions.js +8 -56
  85. package/dist/utilities/handleServerFunctions.js.map +1 -1
  86. package/dist/utilities/initReq.server.d.ts +1 -0
  87. package/dist/utilities/initReq.server.d.ts.map +1 -1
  88. package/dist/utilities/initReq.server.js +3 -0
  89. package/dist/utilities/initReq.server.js.map +1 -1
  90. package/dist/utilities/loadAdminPage.d.ts +5 -2
  91. package/dist/utilities/loadAdminPage.d.ts.map +1 -1
  92. package/dist/utilities/loadAdminPage.js +13 -12
  93. package/dist/utilities/loadAdminPage.js.map +1 -1
  94. package/dist/utilities/loadLayoutData.d.ts +3 -1
  95. package/dist/utilities/loadLayoutData.d.ts.map +1 -1
  96. package/dist/utilities/loadLayoutData.js +2 -3
  97. package/dist/utilities/loadLayoutData.js.map +1 -1
  98. package/dist/utilities/meta.d.ts +1 -0
  99. package/dist/utilities/meta.d.ts.map +1 -1
  100. package/dist/utilities/meta.js +2 -1
  101. package/dist/utilities/meta.js.map +1 -1
  102. package/dist/utilities/routerSearch.d.ts +40 -0
  103. package/dist/utilities/routerSearch.d.ts.map +1 -0
  104. package/dist/utilities/routerSearch.js +45 -0
  105. package/dist/utilities/routerSearch.js.map +1 -0
  106. package/dist/utilities/serverAdapter.server.d.ts.map +1 -1
  107. package/dist/utilities/toSerializable.d.ts +9 -0
  108. package/dist/utilities/toSerializable.d.ts.map +1 -1
  109. package/dist/utilities/toSerializable.js +13 -2
  110. package/dist/utilities/toSerializable.js.map +1 -1
  111. package/dist/withPayload/config/external.d.ts +44 -0
  112. package/dist/withPayload/config/external.d.ts.map +1 -0
  113. package/dist/withPayload/config/external.js +96 -0
  114. package/dist/withPayload/config/external.js.map +1 -0
  115. package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -0
  116. package/dist/{vite → withPayload}/config/optimizeDeps.js +7 -3
  117. package/dist/withPayload/config/optimizeDeps.js.map +1 -0
  118. package/dist/withPayload/config/scss.d.ts +14 -0
  119. package/dist/withPayload/config/scss.d.ts.map +1 -0
  120. package/dist/withPayload/config/scss.js +28 -0
  121. package/dist/withPayload/config/scss.js.map +1 -0
  122. package/dist/withPayload/devConfigReload.d.ts +14 -0
  123. package/dist/withPayload/devConfigReload.d.ts.map +1 -0
  124. package/dist/withPayload/devConfigReload.js +84 -0
  125. package/dist/withPayload/devConfigReload.js.map +1 -0
  126. package/dist/withPayload/importProtection.d.ts.map +1 -0
  127. package/dist/{vite → withPayload}/importProtection.js +2 -2
  128. package/dist/withPayload/importProtection.js.map +1 -0
  129. package/dist/withPayload/index.d.ts +112 -0
  130. package/dist/withPayload/index.d.ts.map +1 -0
  131. package/dist/withPayload/index.js +302 -0
  132. package/dist/withPayload/index.js.map +1 -0
  133. package/dist/withPayload/workarounds/clientModuleResolution.d.ts.map +1 -0
  134. package/dist/withPayload/workarounds/clientModuleResolution.js.map +1 -0
  135. package/dist/withPayload/workarounds/devTransforms.d.ts.map +1 -0
  136. package/dist/{vite → withPayload}/workarounds/devTransforms.js +5 -0
  137. package/dist/withPayload/workarounds/devTransforms.js.map +1 -0
  138. package/dist/withPayload/workarounds/reactDomServerInRsc.d.ts.map +1 -0
  139. package/dist/withPayload/workarounds/reactDomServerInRsc.js.map +1 -0
  140. package/dist/withPayload/workarounds/stripDistStyleImports.d.ts.map +1 -0
  141. package/dist/{vite → withPayload}/workarounds/stripDistStyleImports.js +1 -1
  142. package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -0
  143. package/dist/withPayload/workarounds/stubPrettierInClient.d.ts +13 -0
  144. package/dist/withPayload/workarounds/stubPrettierInClient.d.ts.map +1 -0
  145. package/dist/withPayload/workarounds/stubPrettierInClient.js +32 -0
  146. package/dist/withPayload/workarounds/stubPrettierInClient.js.map +1 -0
  147. package/dist/withPayload/workarounds/wrapCjsForClient.d.ts.map +1 -0
  148. package/dist/withPayload/workarounds/wrapCjsForClient.js.map +1 -0
  149. package/package.json +22 -14
  150. package/dist/elements/DocumentHeaderClient/index.d.ts +0 -16
  151. package/dist/elements/DocumentHeaderClient/index.d.ts.map +0 -1
  152. package/dist/elements/DocumentHeaderClient/index.js +0 -116
  153. package/dist/elements/DocumentHeaderClient/index.js.map +0 -1
  154. package/dist/elements/RenderComponent/index.d.ts +0 -10
  155. package/dist/elements/RenderComponent/index.d.ts.map +0 -1
  156. package/dist/elements/RenderComponent/index.js +0 -12
  157. package/dist/elements/RenderComponent/index.js.map +0 -1
  158. package/dist/exports/vite.d.ts +0 -13
  159. package/dist/exports/vite.d.ts.map +0 -1
  160. package/dist/exports/vite.js +0 -10
  161. package/dist/exports/vite.js.map +0 -1
  162. package/dist/layouts/Root/index.d.ts +0 -32
  163. package/dist/layouts/Root/index.d.ts.map +0 -1
  164. package/dist/layouts/Root/index.js +0 -51
  165. package/dist/layouts/Root/index.js.map +0 -1
  166. package/dist/rsc/renderPayloadRSC.d.ts +0 -6
  167. package/dist/rsc/renderPayloadRSC.d.ts.map +0 -1
  168. package/dist/rsc/renderPayloadRSC.js +0 -6
  169. package/dist/rsc/renderPayloadRSC.js.map +0 -1
  170. package/dist/utilities/devReloadStrategy.d.ts +0 -10
  171. package/dist/utilities/devReloadStrategy.d.ts.map +0 -1
  172. package/dist/utilities/devReloadStrategy.js +0 -27
  173. package/dist/utilities/devReloadStrategy.js.map +0 -1
  174. package/dist/utilities/getExistingAuthToken.d.ts +0 -7
  175. package/dist/utilities/getExistingAuthToken.d.ts.map +0 -1
  176. package/dist/utilities/getExistingAuthToken.js +0 -18
  177. package/dist/utilities/getExistingAuthToken.js.map +0 -1
  178. package/dist/utilities/getPreferences.d.ts +0 -10
  179. package/dist/utilities/getPreferences.d.ts.map +0 -1
  180. package/dist/utilities/getPreferences.js +0 -33
  181. package/dist/utilities/getPreferences.js.map +0 -1
  182. package/dist/utilities/getRequestTheme.d.ts +0 -10
  183. package/dist/utilities/getRequestTheme.d.ts.map +0 -1
  184. package/dist/utilities/getRequestTheme.js +0 -25
  185. package/dist/utilities/getRequestTheme.js.map +0 -1
  186. package/dist/utilities/handleAPIRoute.d.ts.map +0 -1
  187. package/dist/utilities/handleAPIRoute.js.map +0 -1
  188. package/dist/utilities/importMap.server.d.ts +0 -8
  189. package/dist/utilities/importMap.server.d.ts.map +0 -1
  190. package/dist/utilities/importMap.server.js +0 -11
  191. package/dist/utilities/importMap.server.js.map +0 -1
  192. package/dist/utilities/serverFunctionHandlers.d.ts +0 -18
  193. package/dist/utilities/serverFunctionHandlers.d.ts.map +0 -1
  194. package/dist/utilities/serverFunctionHandlers.js +0 -17
  195. package/dist/utilities/serverFunctionHandlers.js.map +0 -1
  196. package/dist/utilities/setPayloadAuthCookie.d.ts +0 -9
  197. package/dist/utilities/setPayloadAuthCookie.d.ts.map +0 -1
  198. package/dist/utilities/setPayloadAuthCookie.js +0 -31
  199. package/dist/utilities/setPayloadAuthCookie.js.map +0 -1
  200. package/dist/vite/config/external.d.ts +0 -26
  201. package/dist/vite/config/external.d.ts.map +0 -1
  202. package/dist/vite/config/external.js +0 -57
  203. package/dist/vite/config/external.js.map +0 -1
  204. package/dist/vite/config/optimizeDeps.d.ts.map +0 -1
  205. package/dist/vite/config/optimizeDeps.js.map +0 -1
  206. package/dist/vite/importProtection.d.ts.map +0 -1
  207. package/dist/vite/importProtection.js.map +0 -1
  208. package/dist/vite/index.d.ts +0 -49
  209. package/dist/vite/index.d.ts.map +0 -1
  210. package/dist/vite/index.js +0 -192
  211. package/dist/vite/index.js.map +0 -1
  212. package/dist/vite/workarounds/clientModuleResolution.d.ts.map +0 -1
  213. package/dist/vite/workarounds/clientModuleResolution.js.map +0 -1
  214. package/dist/vite/workarounds/devTransforms.d.ts.map +0 -1
  215. package/dist/vite/workarounds/devTransforms.js.map +0 -1
  216. package/dist/vite/workarounds/reactDomServerInRsc.d.ts.map +0 -1
  217. package/dist/vite/workarounds/reactDomServerInRsc.js.map +0 -1
  218. package/dist/vite/workarounds/stripDistStyleImports.d.ts.map +0 -1
  219. package/dist/vite/workarounds/stripDistStyleImports.js.map +0 -1
  220. package/dist/vite/workarounds/wrapCjsForClient.d.ts.map +0 -1
  221. package/dist/vite/workarounds/wrapCjsForClient.js.map +0 -1
  222. /package/dist/{vite → withPayload}/config/optimizeDeps.d.ts +0 -0
  223. /package/dist/{vite → withPayload}/importProtection.d.ts +0 -0
  224. /package/dist/{vite → withPayload}/workarounds/clientModuleResolution.d.ts +0 -0
  225. /package/dist/{vite → withPayload}/workarounds/clientModuleResolution.js +0 -0
  226. /package/dist/{vite → withPayload}/workarounds/devTransforms.d.ts +0 -0
  227. /package/dist/{vite → withPayload}/workarounds/reactDomServerInRsc.d.ts +0 -0
  228. /package/dist/{vite → withPayload}/workarounds/reactDomServerInRsc.js +0 -0
  229. /package/dist/{vite → withPayload}/workarounds/stripDistStyleImports.d.ts +0 -0
  230. /package/dist/{vite → withPayload}/workarounds/wrapCjsForClient.d.ts +0 -0
  231. /package/dist/{vite → withPayload}/workarounds/wrapCjsForClient.js +0 -0
@@ -1,25 +0,0 @@
1
- // Defined locally rather than imported from `@payloadcms/ui` (a `'use client'`
2
- // barrel) because its value exports resolve to non-serializable client
3
- // references in this adapter's RSC server context. `Theme` is a type-only
4
- // import and is safely erased at runtime.
5
- const defaultTheme = 'light';
6
- const acceptedThemes = [
7
- 'dark',
8
- 'light'
9
- ];
10
- export function getRequestTheme({ config, cookies, headers }) {
11
- if (config.admin.theme !== 'all' && acceptedThemes.includes(config.admin.theme)) {
12
- return config.admin.theme;
13
- }
14
- const themeCookie = cookies.get(`${config.cookiePrefix || 'payload'}-theme`);
15
- if (themeCookie && acceptedThemes.includes(themeCookie)) {
16
- return themeCookie;
17
- }
18
- const themeFromHeader = headers.get('Sec-CH-Prefers-Color-Scheme');
19
- if (themeFromHeader && acceptedThemes.includes(themeFromHeader)) {
20
- return themeFromHeader;
21
- }
22
- return defaultTheme;
23
- }
24
-
25
- //# sourceMappingURL=getRequestTheme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/getRequestTheme.ts"],"sourcesContent":["import type { Theme } from '@payloadcms/ui'\nimport type { SanitizedConfig } from 'payload'\n\ntype GetRequestThemeArgs = {\n config: SanitizedConfig\n cookies: Map<string, string>\n headers: Headers\n}\n\n// Defined locally rather than imported from `@payloadcms/ui` (a `'use client'`\n// barrel) because its value exports resolve to non-serializable client\n// references in this adapter's RSC server context. `Theme` is a type-only\n// import and is safely erased at runtime.\nconst defaultTheme: Theme = 'light'\n\nconst acceptedThemes: Theme[] = ['dark', 'light']\n\nexport function getRequestTheme({ config, cookies, headers }: GetRequestThemeArgs): Theme {\n if (config.admin.theme !== 'all' && acceptedThemes.includes(config.admin.theme)) {\n return config.admin.theme\n }\n\n const themeCookie = cookies.get(`${config.cookiePrefix || 'payload'}-theme`)\n\n if (themeCookie && acceptedThemes.includes(themeCookie as Theme)) {\n return themeCookie as Theme\n }\n\n const themeFromHeader = headers.get('Sec-CH-Prefers-Color-Scheme') as Theme\n\n if (themeFromHeader && acceptedThemes.includes(themeFromHeader)) {\n return themeFromHeader\n }\n\n return defaultTheme\n}\n"],"names":["defaultTheme","acceptedThemes","getRequestTheme","config","cookies","headers","admin","theme","includes","themeCookie","get","cookiePrefix","themeFromHeader"],"mappings":"AASA,+EAA+E;AAC/E,uEAAuE;AACvE,0EAA0E;AAC1E,0CAA0C;AAC1C,MAAMA,eAAsB;AAE5B,MAAMC,iBAA0B;IAAC;IAAQ;CAAQ;AAEjD,OAAO,SAASC,gBAAgB,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAuB;IAC/E,IAAIF,OAAOG,KAAK,CAACC,KAAK,KAAK,SAASN,eAAeO,QAAQ,CAACL,OAAOG,KAAK,CAACC,KAAK,GAAG;QAC/E,OAAOJ,OAAOG,KAAK,CAACC,KAAK;IAC3B;IAEA,MAAME,cAAcL,QAAQM,GAAG,CAAC,GAAGP,OAAOQ,YAAY,IAAI,UAAU,MAAM,CAAC;IAE3E,IAAIF,eAAeR,eAAeO,QAAQ,CAACC,cAAuB;QAChE,OAAOA;IACT;IAEA,MAAMG,kBAAkBP,QAAQK,GAAG,CAAC;IAEpC,IAAIE,mBAAmBX,eAAeO,QAAQ,CAACI,kBAAkB;QAC/D,OAAOA;IACT;IAEA,OAAOZ;AACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleAPIRoute.d.ts","sourceRoot":"","sources":["../../src/utilities/handleAPIRoute.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 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/handleAPIRoute.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,8 +0,0 @@
1
- /**
2
- * Returns the default output path for the generated import map file in a
3
- * TanStack Start project. Matches the `app/_payload/` convention that Payload's
4
- * import map auto-discovery probes, so the file is found without a custom
5
- * `admin.importMap.importMapFile` override.
6
- */
7
- export declare function getImportMapOutputPath(rootDir?: string): string;
8
- //# sourceMappingURL=importMap.server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"importMap.server.d.ts","sourceRoot":"","sources":["../../src/utilities/importMap.server.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D"}
@@ -1,11 +0,0 @@
1
- import path from 'node:path';
2
- /**
3
- * Returns the default output path for the generated import map file in a
4
- * TanStack Start project. Matches the `app/_payload/` convention that Payload's
5
- * import map auto-discovery probes, so the file is found without a custom
6
- * `admin.importMap.importMapFile` override.
7
- */ export function getImportMapOutputPath(rootDir) {
8
- return path.resolve(rootDir || process.cwd(), 'app', '_payload', 'importMap.js');
9
- }
10
-
11
- //# sourceMappingURL=importMap.server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/importMap.server.ts"],"sourcesContent":["import path from 'node:path'\n\n/**\n * Returns the default output path for the generated import map file in a\n * TanStack Start project. Matches the `app/_payload/` convention that Payload's\n * import map auto-discovery probes, so the file is found without a custom\n * `admin.importMap.importMapFile` override.\n */\nexport function getImportMapOutputPath(rootDir?: string): string {\n return path.resolve(rootDir || process.cwd(), 'app', '_payload', 'importMap.js')\n}\n"],"names":["path","getImportMapOutputPath","rootDir","resolve","process","cwd"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B;;;;;CAKC,GACD,OAAO,SAASC,uBAAuBC,OAAgB;IACrD,OAAOF,KAAKG,OAAO,CAACD,WAAWE,QAAQC,GAAG,IAAI,OAAO,YAAY;AACnE"}
@@ -1,18 +0,0 @@
1
- import type { ServerFunction } from 'payload';
2
- /**
3
- * Framework-agnostic server-function handlers the TanStack Start dispatcher
4
- * registers to reach parity with the Next.js adapter
5
- * (`packages/next/src/utilities/handleServerFunctions.ts`).
6
- */
7
- type SwitchLanguageArgs = {
8
- lang: string;
9
- };
10
- /**
11
- * Dispatched from `TranslationProvider` when the user switches the admin
12
- * language. Writes the `<cookiePrefix>-lng` cookie via the request's
13
- * `ServerAdapter` (wired up in `initReq`) so the next render — triggered by
14
- * the provider's `router.refresh()` — reads the new language.
15
- */
16
- export declare const switchLanguageHandler: ServerFunction<SwitchLanguageArgs, Promise<void>>;
17
- export {};
18
- //# sourceMappingURL=serverFunctionHandlers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serverFunctionHandlers.d.ts","sourceRoot":"","sources":["../../src/utilities/serverFunctionHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C;;;;GAIG;AAEH,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,CAcnF,CAAA"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Dispatched from `TranslationProvider` when the user switches the admin
3
- * language. Writes the `<cookiePrefix>-lng` cookie via the request's
4
- * `ServerAdapter` (wired up in `initReq`) so the next render — triggered by
5
- * the provider's `router.refresh()` — reads the new language.
6
- */ export const switchLanguageHandler = async ({ lang, req })=>{
7
- if (!req.server) {
8
- throw new Error('switch-language requires a ServerAdapter on the request');
9
- }
10
- const cookieName = `${req.payload.config.cookiePrefix || 'payload'}-lng`;
11
- await req.server.setCookie(cookieName, lang, {
12
- maxAge: 60 * 60 * 24 * 365,
13
- path: '/'
14
- });
15
- };
16
-
17
- //# sourceMappingURL=serverFunctionHandlers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/serverFunctionHandlers.ts"],"sourcesContent":["import type { ServerFunction } from 'payload'\n\n/**\n * Framework-agnostic server-function handlers the TanStack Start dispatcher\n * registers to reach parity with the Next.js adapter\n * (`packages/next/src/utilities/handleServerFunctions.ts`).\n */\n\ntype SwitchLanguageArgs = {\n lang: string\n}\n\n/**\n * Dispatched from `TranslationProvider` when the user switches the admin\n * language. Writes the `<cookiePrefix>-lng` cookie via the request's\n * `ServerAdapter` (wired up in `initReq`) so the next render — triggered by\n * the provider's `router.refresh()` — reads the new language.\n */\nexport const switchLanguageHandler: ServerFunction<SwitchLanguageArgs, Promise<void>> = async ({\n lang,\n req,\n}) => {\n if (!req.server) {\n throw new Error('switch-language requires a ServerAdapter on the request')\n }\n\n const cookieName = `${req.payload.config.cookiePrefix || 'payload'}-lng`\n\n await req.server.setCookie(cookieName, lang, {\n maxAge: 60 * 60 * 24 * 365,\n path: '/',\n })\n}\n"],"names":["switchLanguageHandler","lang","req","server","Error","cookieName","payload","config","cookiePrefix","setCookie","maxAge","path"],"mappings":"AAYA;;;;;CAKC,GACD,OAAO,MAAMA,wBAA2E,OAAO,EAC7FC,IAAI,EACJC,GAAG,EACJ;IACC,IAAI,CAACA,IAAIC,MAAM,EAAE;QACf,MAAM,IAAIC,MAAM;IAClB;IAEA,MAAMC,aAAa,GAAGH,IAAII,OAAO,CAACC,MAAM,CAACC,YAAY,IAAI,UAAU,IAAI,CAAC;IAExE,MAAMN,IAAIC,MAAM,CAACM,SAAS,CAACJ,YAAYJ,MAAM;QAC3CS,QAAQ,KAAK,KAAK,KAAK;QACvBC,MAAM;IACR;AACF,EAAC"}
@@ -1,9 +0,0 @@
1
- import type { Auth } from 'payload';
2
- type SetPayloadAuthCookieArgs = {
3
- authConfig: Auth;
4
- cookiePrefix: string;
5
- token: string;
6
- };
7
- export declare function setPayloadAuthCookie({ authConfig, cookiePrefix, token, }: SetPayloadAuthCookieArgs): void;
8
- export {};
9
- //# sourceMappingURL=setPayloadAuthCookie.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setPayloadAuthCookie.d.ts","sourceRoot":"","sources":["../../src/utilities/setPayloadAuthCookie.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAKnC,KAAK,wBAAwB,GAAG;IAC9B,UAAU,EAAE,IAAI,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,YAAY,EACZ,KAAK,GACN,EAAE,wBAAwB,GAAG,IAAI,CAoCjC"}
@@ -1,31 +0,0 @@
1
- import { setResponseHeader } from '@tanstack/react-start/server';
2
- import { generatePayloadCookie } from 'payload';
3
- export function setPayloadAuthCookie({ authConfig, cookiePrefix, token }) {
4
- const cookieExpiration = authConfig.tokenExpiration ? new Date(Date.now() + authConfig.tokenExpiration) : undefined;
5
- const payloadCookie = generatePayloadCookie({
6
- collectionAuthConfig: authConfig,
7
- cookiePrefix,
8
- expires: cookieExpiration,
9
- returnCookieAsObject: true,
10
- token
11
- });
12
- if (payloadCookie.value) {
13
- const sameSite = typeof authConfig.cookies.sameSite === 'string' ? authConfig.cookies.sameSite : 'Lax';
14
- let cookie = `${encodeURIComponent(payloadCookie.name)}=${encodeURIComponent(payloadCookie.value)}`;
15
- cookie += '; HttpOnly';
16
- cookie += `; SameSite=${sameSite}`;
17
- cookie += '; Path=/';
18
- if (authConfig.cookies.secure) {
19
- cookie += '; Secure';
20
- }
21
- if (authConfig.cookies.domain) {
22
- cookie += `; Domain=${authConfig.cookies.domain}`;
23
- }
24
- if (payloadCookie.expires) {
25
- cookie += `; Expires=${new Date(payloadCookie.expires).toUTCString()}`;
26
- }
27
- setResponseHeader('Set-Cookie', cookie);
28
- }
29
- }
30
-
31
- //# sourceMappingURL=setPayloadAuthCookie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utilities/setPayloadAuthCookie.ts"],"sourcesContent":["import type { Auth } from 'payload'\n\nimport { setResponseHeader } from '@tanstack/react-start/server'\nimport { generatePayloadCookie } from 'payload'\n\ntype SetPayloadAuthCookieArgs = {\n authConfig: Auth\n cookiePrefix: string\n token: string\n}\n\nexport function setPayloadAuthCookie({\n authConfig,\n cookiePrefix,\n token,\n}: SetPayloadAuthCookieArgs): void {\n const cookieExpiration = authConfig.tokenExpiration\n ? new Date(Date.now() + authConfig.tokenExpiration)\n : undefined\n\n const payloadCookie = generatePayloadCookie({\n collectionAuthConfig: authConfig,\n cookiePrefix,\n expires: cookieExpiration,\n returnCookieAsObject: true,\n token,\n })\n\n if (payloadCookie.value) {\n const sameSite =\n typeof authConfig.cookies.sameSite === 'string' ? authConfig.cookies.sameSite : 'Lax'\n\n let cookie = `${encodeURIComponent(payloadCookie.name)}=${encodeURIComponent(payloadCookie.value)}`\n cookie += '; HttpOnly'\n cookie += `; SameSite=${sameSite}`\n cookie += '; Path=/'\n\n if (authConfig.cookies.secure) {\n cookie += '; Secure'\n }\n\n if (authConfig.cookies.domain) {\n cookie += `; Domain=${authConfig.cookies.domain}`\n }\n\n if (payloadCookie.expires) {\n cookie += `; Expires=${new Date(payloadCookie.expires).toUTCString()}`\n }\n\n setResponseHeader('Set-Cookie', cookie)\n }\n}\n"],"names":["setResponseHeader","generatePayloadCookie","setPayloadAuthCookie","authConfig","cookiePrefix","token","cookieExpiration","tokenExpiration","Date","now","undefined","payloadCookie","collectionAuthConfig","expires","returnCookieAsObject","value","sameSite","cookies","cookie","encodeURIComponent","name","secure","domain","toUTCString"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,+BAA8B;AAChE,SAASC,qBAAqB,QAAQ,UAAS;AAQ/C,OAAO,SAASC,qBAAqB,EACnCC,UAAU,EACVC,YAAY,EACZC,KAAK,EACoB;IACzB,MAAMC,mBAAmBH,WAAWI,eAAe,GAC/C,IAAIC,KAAKA,KAAKC,GAAG,KAAKN,WAAWI,eAAe,IAChDG;IAEJ,MAAMC,gBAAgBV,sBAAsB;QAC1CW,sBAAsBT;QACtBC;QACAS,SAASP;QACTQ,sBAAsB;QACtBT;IACF;IAEA,IAAIM,cAAcI,KAAK,EAAE;QACvB,MAAMC,WACJ,OAAOb,WAAWc,OAAO,CAACD,QAAQ,KAAK,WAAWb,WAAWc,OAAO,CAACD,QAAQ,GAAG;QAElF,IAAIE,SAAS,GAAGC,mBAAmBR,cAAcS,IAAI,EAAE,CAAC,EAAED,mBAAmBR,cAAcI,KAAK,GAAG;QACnGG,UAAU;QACVA,UAAU,CAAC,WAAW,EAAEF,UAAU;QAClCE,UAAU;QAEV,IAAIf,WAAWc,OAAO,CAACI,MAAM,EAAE;YAC7BH,UAAU;QACZ;QAEA,IAAIf,WAAWc,OAAO,CAACK,MAAM,EAAE;YAC7BJ,UAAU,CAAC,SAAS,EAAEf,WAAWc,OAAO,CAACK,MAAM,EAAE;QACnD;QAEA,IAAIX,cAAcE,OAAO,EAAE;YACzBK,UAAU,CAAC,UAAU,EAAE,IAAIV,KAAKG,cAAcE,OAAO,EAAEU,WAAW,IAAI;QACxE;QAEAvB,kBAAkB,cAAckB;IAClC;AACF"}
@@ -1,26 +0,0 @@
1
- /**
2
- * SSR/RSC externalization config used by `withPayload`. Kept separate from the
3
- * client optimizer config (`./optimizeDeps.ts`) so each concern stays small.
4
- */
5
- /**
6
- * Server-only packages (Node-only or only ever used by the server bundle).
7
- * These are the Vite equivalent of Next.js's `serverExternalPackages`.
8
- */
9
- export declare const ssrExternalPackages: string[];
10
- /**
11
- * Payload packages whose source must be processed by Vite even on the server
12
- * (because they are workspace `.ts` files in dev). Server-only adapters
13
- * (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are
14
- * intentionally not included — those should stay external on the SSR side.
15
- *
16
- * The same set is applied to BOTH the `ssr` and `rsc` environments. Plugins and
17
- * storage adapters must be included in RSC too: they register custom
18
- * providers/components (e.g. `plugin-multi-tenant`'s `'use client'`
19
- * `TenantSelectionProvider`) that render in the RSC graph via
20
- * `RenderServerComponent`. If the package stayed external to RSC, `plugin-rsc`
21
- * would never transform its `'use client'` modules into client references, so
22
- * the component would execute server-side and crash on the first hook
23
- * (`Cannot read properties of null (reading 'useState')`).
24
- */
25
- export declare const payloadNoExternalPatterns: Array<RegExp | string>;
26
- //# sourceMappingURL=external.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/vite/config/external.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,EA0BvC,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO5D,CAAA"}
@@ -1,57 +0,0 @@
1
- /**
2
- * SSR/RSC externalization config used by `withPayload`. Kept separate from the
3
- * client optimizer config (`./optimizeDeps.ts`) so each concern stays small.
4
- */ /**
5
- * Server-only packages (Node-only or only ever used by the server bundle).
6
- * These are the Vite equivalent of Next.js's `serverExternalPackages`.
7
- */ export const ssrExternalPackages = [
8
- 'ajv',
9
- 'fast-uri',
10
- 'drizzle-kit',
11
- 'drizzle-kit/api',
12
- 'drizzle-orm',
13
- 'sharp',
14
- 'libsql',
15
- 'require-in-the-middle',
16
- 'json-schema-to-typescript',
17
- 'pino',
18
- 'pino-pretty',
19
- 'graphql',
20
- 'mongodb',
21
- 'mongoose',
22
- 'better-sqlite3',
23
- 'pg',
24
- 'pg-native',
25
- 'nodemailer',
26
- 'aws4',
27
- 'pluralize',
28
- 'console-table-printer',
29
- '@azure/storage-blob',
30
- '@aws-sdk/client-s3',
31
- '@aws-sdk/s3-request-presigner',
32
- '@google-cloud/storage'
33
- ];
34
- /**
35
- * Payload packages whose source must be processed by Vite even on the server
36
- * (because they are workspace `.ts` files in dev). Server-only adapters
37
- * (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are
38
- * intentionally not included — those should stay external on the SSR side.
39
- *
40
- * The same set is applied to BOTH the `ssr` and `rsc` environments. Plugins and
41
- * storage adapters must be included in RSC too: they register custom
42
- * providers/components (e.g. `plugin-multi-tenant`'s `'use client'`
43
- * `TenantSelectionProvider`) that render in the RSC graph via
44
- * `RenderServerComponent`. If the package stayed external to RSC, `plugin-rsc`
45
- * would never transform its `'use client'` modules into client references, so
46
- * the component would execute server-side and crash on the first hook
47
- * (`Cannot read properties of null (reading 'useState')`).
48
- */ export const payloadNoExternalPatterns = [
49
- '@payloadcms/ui',
50
- '@payloadcms/translations',
51
- '@payloadcms/tanstack-start',
52
- /^@payloadcms\/richtext-lexical/,
53
- /^@payloadcms\/plugin-/,
54
- /^@payloadcms\/storage-/
55
- ];
56
-
57
- //# sourceMappingURL=external.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/vite/config/external.ts"],"sourcesContent":["/**\n * SSR/RSC externalization config used by `withPayload`. Kept separate from the\n * client optimizer config (`./optimizeDeps.ts`) so each concern stays small.\n */\n\n/**\n * Server-only packages (Node-only or only ever used by the server bundle).\n * These are the Vite equivalent of Next.js's `serverExternalPackages`.\n */\nexport const ssrExternalPackages: string[] = [\n 'ajv',\n 'fast-uri',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'drizzle-orm',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n 'pino',\n 'pino-pretty',\n 'graphql',\n 'mongodb',\n 'mongoose',\n 'better-sqlite3',\n 'pg',\n 'pg-native',\n 'nodemailer',\n 'aws4',\n 'pluralize',\n 'console-table-printer',\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Payload packages whose source must be processed by Vite even on the server\n * (because they are workspace `.ts` files in dev). Server-only adapters\n * (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are\n * intentionally not included — those should stay external on the SSR side.\n *\n * The same set is applied to BOTH the `ssr` and `rsc` environments. Plugins and\n * storage adapters must be included in RSC too: they register custom\n * providers/components (e.g. `plugin-multi-tenant`'s `'use client'`\n * `TenantSelectionProvider`) that render in the RSC graph via\n * `RenderServerComponent`. If the package stayed external to RSC, `plugin-rsc`\n * would never transform its `'use client'` modules into client references, so\n * the component would execute server-side and crash on the first hook\n * (`Cannot read properties of null (reading 'useState')`).\n */\nexport const payloadNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\n /^@payloadcms\\/plugin-/,\n /^@payloadcms\\/storage-/,\n]\n"],"names":["ssrExternalPackages","payloadNoExternalPatterns"],"mappings":"AAAA;;;CAGC,GAED;;;CAGC,GACD,OAAO,MAAMA,sBAAgC;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;;;;;;;;;;CAcC,GACD,OAAO,MAAMC,4BAAoD;IAC/D;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"optimizeDeps.d.ts","sourceRoot":"","sources":["../../../src/vite/config/optimizeDeps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAsB/C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EA8E/C,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/vite/config/optimizeDeps.ts"],"sourcesContent":["/**\n * Client dep-optimizer config used by `withPayload`. Kept separate from the\n * SSR/RSC externalization config (`./external.ts`) so each concern stays small.\n */\n\n/**\n * Packages we know contain Node-only code or top-level side effects requiring\n * Node APIs. Excluding them from the client optimizer prevents Vite from\n * walking into their main entries and trying to bundle server-only imports\n * for the browser.\n */\nexport const optimizeDepsExcludeDefaults: string[] = [\n 'sharp',\n '@payloadcms/ui',\n '@payloadcms/tanstack-start',\n 'payload',\n 'pino',\n 'pino-pretty',\n 'busboy',\n 'get-tsconfig',\n 'ws',\n 'croner',\n 'prompts',\n 'file-type',\n // Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite\n // sometimes walks these from the main package entry while scanning\n // workspace deps, and the browser sub-bundles do not expose the\n // server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev\n // server with a `MISSING_EXPORT` error before any test runs.\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be\n * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick\n * these up because their parent packages are in `optimizeDeps.exclude`, so we\n * list them explicitly using the `parent > child` syntax.\n *\n * Each entry below fixes a specific late-discovery re-optimization: without it,\n * Vite discovers the dep *after* its initial crawl, forcing a full dep\n * re-optimization mid-session that 404s in-flight `.vite/deps/*` chunks and\n * remounts the admin (dropping client state). This is why the list can't simply\n * be deleted — it is the \"complete first pass\" for the admin's dep graph.\n */\nexport const optimizeDepsIncludeDefaults: string[] = [\n '@payloadcms/ui > sonner',\n '@payloadcms/ui > @faceless-ui/modal',\n '@payloadcms/ui > @faceless-ui/window-info',\n '@payloadcms/ui > @faceless-ui/scroll-info',\n '@payloadcms/ui > @dnd-kit/core',\n '@payloadcms/ui > @dnd-kit/sortable',\n '@payloadcms/ui > @dnd-kit/utilities',\n '@payloadcms/ui > react-datepicker',\n '@payloadcms/ui > react-select',\n '@payloadcms/ui > react-select/creatable',\n '@payloadcms/ui > react-image-crop',\n '@payloadcms/ui > @monaco-editor/react',\n '@payloadcms/ui > date-fns',\n '@payloadcms/ui > date-fns/transpose',\n '@payloadcms/ui > @date-fns/tz/date/mini',\n '@payloadcms/ui > uuid',\n '@payloadcms/ui > use-context-selector',\n '@payloadcms/ui > bson-objectid',\n '@payloadcms/ui > dequal',\n '@payloadcms/ui > object-to-formdata',\n '@payloadcms/ui > md5',\n 'payload > deepmerge',\n 'payload > pluralize',\n // `scheduler` is a transitive dep of `react-dom`, not a direct dependency of\n // the app, so a bare `'scheduler'` specifier fails to resolve from an isolated\n // install (`test/node_modules` built with `pnpm i --ignore-workspace`), where\n // it isn't hoisted to the top level. Path it through `react-dom` so the\n // optimizer resolves the exact copy the runtime loads.\n 'react-dom > scheduler',\n // `@payloadcms/ui` (in `optimizeDeps.exclude`) ships compiled output that the\n // React Compiler rewrote to `import { c } from 'react/compiler-runtime'`.\n // Because its parent is excluded, the optimizer never crawls in to discover\n // this entry, so Vite serves `react/compiler-runtime` raw. That file is\n // CommonJS (`module.exports = require(...)`), so the named `c` export can't be\n // statically extracted and every client component throws \"does not provide an\n // export named 'c'\". Pre-bundling it lets esbuild synthesize the named export.\n 'react/compiler-runtime',\n // Transitive deps that Vite otherwise discovers *after* the initial crawl\n // (react-select pulls in @floating-ui at runtime; react-is is reached via\n // react-transition-group/prop-types; the default date-fns locale is loaded\n // through a dynamic `date-fns/locale/${key}` import). A late discovery forces\n // a full dep re-optimization mid-session, which 404s every in-flight\n // `.vite/deps/*` chunk (\"Pre-transform error: file does not exist in the\n // optimize deps directory\") and breaks the admin UI in CI cold starts.\n // Pre-bundling them keeps the first optimization pass complete.\n '@payloadcms/ui > react-select > @floating-ui/dom',\n '@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',\n '@payloadcms/ui > react-select > prop-types > react-is',\n '@payloadcms/ui > date-fns/locale/en-US',\n // Further late discoveries observed re-optimizing mid-run in CI cold starts\n // (see CI logs: \"✨ new dependencies optimized: @dnd-kit/modifiers / ajv /\n // dequal/lite\"). The modular dashboard pulls in `@dnd-kit/modifiers` on first\n // render; form-state diffing reaches `dequal/lite` (a distinct entry point\n // from the already-listed `dequal`); client-side field validation reaches\n // `ajv` *through `payload`* — it is `ssrExternal` server-side but still\n // bundled into the client, and must be pathed via `payload` so the optimizer\n // pre-bundles the exact copy the runtime loads.\n '@payloadcms/ui > @dnd-kit/modifiers',\n '@payloadcms/ui > dequal/lite',\n 'payload > ajv',\n // The storage client-upload suites (esp. vercel-blob) crawl part of the\n // `payload` server runtime into the client bundle and discover these late,\n // triggering several \"optimized dependencies changed. reloading\" waves that\n // reload the page mid-test (the bulk-upload drawer's Create New button /\n // dropzone vanish and the direct-to-bucket PUT never fires). Pre-bundle the\n // whole observed set so the first pass is complete.\n 'payload > undici',\n 'payload > jose',\n 'payload > dataloader',\n 'payload > path-to-regexp',\n 'payload > console-table-printer',\n 'payload > ci-info',\n 'payload > image-size',\n 'payload > image-size/fromFile',\n 'payload > ipaddr.js',\n 'payload > range-parser',\n 'payload > sanitize-filename',\n]\n"],"names":["optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults"],"mappings":"AAAA;;;CAGC,GAED;;;;;CAKC,GACD,OAAO,MAAMA,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,kEAAkE;IAClE,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,6DAA6D;IAC7D;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,6EAA6E;IAC7E,+EAA+E;IAC/E,8EAA8E;IAC9E,wEAAwE;IACxE,uDAAuD;IACvD;IACA,8EAA8E;IAC9E,0EAA0E;IAC1E,4EAA4E;IAC5E,wEAAwE;IACxE,+EAA+E;IAC/E,8EAA8E;IAC9E,+EAA+E;IAC/E;IACA,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,8EAA8E;IAC9E,qEAAqE;IACrE,yEAAyE;IACzE,uEAAuE;IACvE,gEAAgE;IAChE;IACA;IACA;IACA;IACA,4EAA4E;IAC5E,0EAA0E;IAC1E,8EAA8E;IAC9E,2EAA2E;IAC3E,0EAA0E;IAC1E,wEAAwE;IACxE,6EAA6E;IAC7E,gDAAgD;IAChD;IACA;IACA;IACA,wEAAwE;IACxE,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,4EAA4E;IAC5E,oDAAoD;IACpD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"importProtection.d.ts","sourceRoot":"","sources":["../../src/vite/importProtection.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAoB7D,CAAA;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAoC9E;AAED,eAAO,MAAM,sCAAsC,EAAE,MAAM,EAAsC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/vite/importProtection.ts"],"sourcesContent":["import { builtinModules } from 'node:module'\n\n/**\n * Specifiers that must never appear in the client module graph. These are the\n * server-only Payload entry points plus Node.js built-ins and a handful of\n * Node-only npm packages that Payload pulls in transitively.\n */\nexport const serverOnlyClientSpecifiers: Array<RegExp | string> = [\n /^node:/,\n new RegExp(`^(${builtinModules.join('|')})(\\\\/|$)`),\n '@payload-config',\n /^@payloadcms\\/next\\/rsc/,\n /^@payloadcms\\/richtext-lexical\\/rsc/,\n /^@payloadcms\\/richtext-slate\\/rsc/,\n '@payloadcms/ui/server',\n /^@payloadcms\\/tanstack-start\\/(layouts|rsc|server|views\\/server)/,\n 'sharp',\n 'busboy',\n 'croner',\n 'pino',\n 'pino-pretty',\n 'prompts',\n 'ws',\n 'undici',\n 'get-tsconfig',\n /^file-type/,\n /^react-dom\\/server/,\n]\n\n/**\n * Allowlist callback for the `tanstackStart` plugin's import-protection. These\n * are the legitimate cross-environment imports in our monorepo that we want\n * to permit even when they appear to cross a server/client boundary.\n */\nexport function onImportProtectionViolation(violation: unknown): boolean | void {\n const info = violation as {\n envType: 'client' | 'server'\n importer: string\n resolved?: string\n }\n\n const allowedClientFileImporters =\n /\\/richtext-lexical\\/.*\\/exports\\/client\\/|\\/tanstack-start\\/.*\\/views\\/AdminView|\\/ui\\//\n\n if (\n info.envType === 'server' &&\n info.resolved?.includes('.client.') &&\n allowedClientFileImporters.test(info.importer)\n ) {\n return false\n }\n\n if (info.importer.includes('/richtext-lexical/') && info.importer.includes('/field/Diff/')) {\n return false\n }\n\n if (info.importer.includes('/packages/payload/') || info.importer.includes('/payload/dist/')) {\n return false\n }\n\n if (\n info.importer.includes('@payloadcms/ui') &&\n (info.importer.includes('/exports/rsc/') || info.importer.includes('/rsc/index'))\n ) {\n return false\n }\n\n if (info.envType === 'server' && info.importer.includes('vite-rsc/client-references')) {\n return false\n }\n}\n\nexport const defaultImportProtectionIgnoreImporters: RegExp[] = [/^src\\/importMap\\.js(?:\\?.*)?$/]\n"],"names":["builtinModules","serverOnlyClientSpecifiers","RegExp","join","onImportProtectionViolation","violation","info","allowedClientFileImporters","envType","resolved","includes","test","importer","defaultImportProtectionIgnoreImporters"],"mappings":"AAAA,SAASA,cAAc,QAAQ,cAAa;AAE5C;;;;CAIC,GACD,OAAO,MAAMC,6BAAqD;IAChE;IACA,IAAIC,OAAO,CAAC,EAAE,EAAEF,eAAeG,IAAI,CAAC,KAAK,QAAQ,CAAC;IAClD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;CAIC,GACD,OAAO,SAASC,4BAA4BC,SAAkB;IAC5D,MAAMC,OAAOD;IAMb,MAAME,6BACJ;IAEF,IACED,KAAKE,OAAO,KAAK,YACjBF,KAAKG,QAAQ,EAAEC,SAAS,eACxBH,2BAA2BI,IAAI,CAACL,KAAKM,QAAQ,GAC7C;QACA,OAAO;IACT;IAEA,IAAIN,KAAKM,QAAQ,CAACF,QAAQ,CAAC,yBAAyBJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,iBAAiB;QAC1F,OAAO;IACT;IAEA,IAAIJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,yBAAyBJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,mBAAmB;QAC5F,OAAO;IACT;IAEA,IACEJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,qBACtBJ,CAAAA,KAAKM,QAAQ,CAACF,QAAQ,CAAC,oBAAoBJ,KAAKM,QAAQ,CAACF,QAAQ,CAAC,aAAY,GAC/E;QACA,OAAO;IACT;IAEA,IAAIJ,KAAKE,OAAO,KAAK,YAAYF,KAAKM,QAAQ,CAACF,QAAQ,CAAC,+BAA+B;QACrF,OAAO;IACT;AACF;AAEA,OAAO,MAAMG,yCAAmD;IAAC;CAAgC,CAAA"}
@@ -1,49 +0,0 @@
1
- import type { UserConfig, UserConfigFnObject } from 'vite';
2
- export type WithPayloadOptions = {
3
- /**
4
- * Additional import-protection `ignoreImporters` patterns. This is a
5
- * Payload-specific knob on the TanStack Start plugin, so it cannot be
6
- * expressed through `vite` — pass it here.
7
- */
8
- additionalIgnoreImporters?: RegExp[];
9
- /** Path to the user's `payload.config.ts` (required) */
10
- payloadConfigPath: string;
11
- /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'` */
12
- routesDirectory?: string;
13
- /** TanStack source directory. Defaults to `'src'` */
14
- srcDirectory?: string;
15
- /**
16
- * Extra Vite config merged on top of the Payload defaults via Vite's own
17
- * `mergeConfig`. Objects are deep-merged and arrays are appended, so this is
18
- * the single hook for everything a consumer used to reach through separate
19
- * options: extra `plugins`, `resolve.alias` entries, `optimizeDeps.include`,
20
- * `ssr.external`, `server`, `build`, and so on.
21
- *
22
- * @example
23
- * withPayload({
24
- * payloadConfigPath: './src/payload.config.ts',
25
- * vite: { server: { port: 4000 } },
26
- * })
27
- */
28
- vite?: UserConfig;
29
- };
30
- /**
31
- * Vite config helper for Payload + TanStack Start. The Vite-side counterpart to
32
- * `withPayload` for Next.js: it owns the whole Vite setup needed to run the
33
- * Payload admin — the RSC, React, and TanStack Start plugins plus a small set of
34
- * Payload-specific workarounds — so a consumer's `vite.config.ts` collapses to:
35
- *
36
- * ```ts
37
- * import { withPayload } from '@payloadcms/tanstack-start/vite'
38
- *
39
- * export default withPayload({ payloadConfigPath: './src/payload.config.ts' })
40
- * ```
41
- *
42
- * The React (`@vitejs/plugin-react`), RSC (`@vitejs/plugin-rsc`), and TanStack
43
- * Start plugins are instantiated internally with the settings the admin
44
- * requires — consumers no longer pass them in. Each remaining Payload
45
- * workaround lives in its own file under `./workarounds/` so it can be deleted
46
- * individually once the corresponding upstream fix lands.
47
- */
48
- export declare function withPayload(options: WithPayloadOptions): UserConfigFnObject;
49
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AAqB1D,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAA;IACpC,wDAAwD;IACxD,iBAAiB,EAAE,MAAM,CAAA;IACzB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CA+H3E"}
@@ -1,192 +0,0 @@
1
- import { tanstackStart } from '@tanstack/react-start/plugin/vite';
2
- import viteReact from '@vitejs/plugin-react';
3
- import rsc from '@vitejs/plugin-rsc';
4
- import path from 'node:path';
5
- import { mergeConfig } from 'vite';
6
- import { payloadNoExternalPatterns, ssrExternalPackages } from './config/external.js';
7
- import { optimizeDepsExcludeDefaults, optimizeDepsIncludeDefaults } from './config/optimizeDeps.js';
8
- import { defaultImportProtectionIgnoreImporters, onImportProtectionViolation, serverOnlyClientSpecifiers } from './importProtection.js';
9
- import { clientModuleResolution } from './workarounds/clientModuleResolution.js';
10
- import { payloadDevTransforms } from './workarounds/devTransforms.js';
11
- import { reactDomServerInRsc } from './workarounds/reactDomServerInRsc.js';
12
- import { ssrStripDistStyleImports } from './workarounds/stripDistStyleImports.js';
13
- import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
14
- /**
15
- * Vite config helper for Payload + TanStack Start. The Vite-side counterpart to
16
- * `withPayload` for Next.js: it owns the whole Vite setup needed to run the
17
- * Payload admin — the RSC, React, and TanStack Start plugins plus a small set of
18
- * Payload-specific workarounds — so a consumer's `vite.config.ts` collapses to:
19
- *
20
- * ```ts
21
- * import { withPayload } from '@payloadcms/tanstack-start/vite'
22
- *
23
- * export default withPayload({ payloadConfigPath: './src/payload.config.ts' })
24
- * ```
25
- *
26
- * The React (`@vitejs/plugin-react`), RSC (`@vitejs/plugin-rsc`), and TanStack
27
- * Start plugins are instantiated internally with the settings the admin
28
- * requires — consumers no longer pass them in. Each remaining Payload
29
- * workaround lives in its own file under `./workarounds/` so it can be deleted
30
- * individually once the corresponding upstream fix lands.
31
- */ export function withPayload(options) {
32
- const { additionalIgnoreImporters = [], payloadConfigPath, routesDirectory = 'app', srcDirectory = 'src', vite } = options;
33
- return (_env)=>{
34
- const base = {
35
- css: {
36
- preprocessorOptions: {
37
- scss: {
38
- silenceDeprecations: [
39
- 'import',
40
- 'global-builtin'
41
- ]
42
- }
43
- }
44
- },
45
- define: {
46
- global: 'globalThis'
47
- },
48
- environments: {
49
- rsc: {
50
- resolve: {
51
- noExternal: payloadNoExternalPatterns
52
- }
53
- },
54
- ssr: {
55
- resolve: {
56
- noExternal: payloadNoExternalPatterns
57
- }
58
- }
59
- },
60
- optimizeDeps: {
61
- exclude: optimizeDepsExcludeDefaults,
62
- include: optimizeDepsIncludeDefaults
63
- },
64
- plugins: [
65
- clientModuleResolution(),
66
- wrapCjsForClient(),
67
- ssrStripDistStyleImports(),
68
- reactDomServerInRsc(),
69
- payloadDevTransforms(),
70
- rsc({
71
- serverHandler: false
72
- }),
73
- tanstackStart({
74
- importProtection: {
75
- client: {
76
- excludeFiles: [],
77
- specifiers: serverOnlyClientSpecifiers
78
- },
79
- ignoreImporters: [
80
- ...defaultImportProtectionIgnoreImporters,
81
- ...additionalIgnoreImporters
82
- ],
83
- include: [
84
- '**/*'
85
- ],
86
- mockAccess: 'warn',
87
- onViolation: onImportProtectionViolation,
88
- // Disable TanStack Start's default `**/*.client.*` file-based denial in
89
- // the SSR environment. Payload uses the `.client.tsx` filename suffix
90
- // for React Client Components (with a `'use client'` directive) that
91
- // MUST be server-rendered to HTML during SSR. The default rule would
92
- // otherwise replace those files with an `import-protection mock` Proxy
93
- // during SSR, which crashes React (TypeError: Cannot convert object to
94
- // primitive value) the moment React tries to format a warning that
95
- // mentions one of these components.
96
- server: {
97
- files: []
98
- }
99
- },
100
- // Disable TanStack Router's automatic per-route code-splitting.
101
- //
102
- // With splitting enabled each route's `component` is fetched lazily
103
- // via `?tsr-split=component` after the initial SSR HTML is streamed.
104
- // Until that lazy chunk lands the rendered admin tree has no client
105
- // React attached, so any button clicks (e.g. the
106
- // `#toggle-list-filters` chevron in `<ListControls />`) hit a static
107
- // DOM, the click is dropped, and once the chunk finally loads the
108
- // component re-mounts with its initial `useState` instead of the
109
- // toggled value. That single behaviour was the root cause of the
110
- // "page renders but nothing is interactive" tanstack-start E2E
111
- // failures (`#list-controls-where`, `[data-lexical-editor]`, etc.) -
112
- // playwright traces show "Download the React DevTools" landing
113
- // *after* the playwright click, confirming late hydration.
114
- //
115
- // We pass BOTH knobs because `tanstackStart`'s schema silently
116
- // strips the user-supplied `autoCodeSplitting` (its `tsrConfig`
117
- // does `configSchema.omit({ autoCodeSplitting: true, target: true
118
- // })`) and then leaves the value `undefined` — which is fine for
119
- // the conditional inside `unpluginRouterComposedFactory`, but the
120
- // TanStack Start vite plugin *unconditionally* installs the router
121
- // code-splitter via `tanStackRouterCodeSplitter(...)` regardless.
122
- // The only knob that survives all of that and is honoured by the
123
- // splitter is `router.codeSplittingOptions.defaultBehavior` — set
124
- // to an empty array, the splitter still walks each `createFileRoute`
125
- // file but produces no virtual `?tsr-split=...` modules, so every
126
- // route component ships in the initial bundle and hydration starts
127
- // immediately on first paint. We keep `autoCodeSplitting: false` as
128
- // a belt-and-braces signal in case the start plugin ever stops
129
- // dropping it.
130
- //
131
- // Eager-loading routes ships a slightly larger initial bundle but
132
- // makes the admin actually interactive on first paint.
133
- router: {
134
- autoCodeSplitting: false,
135
- codeSplittingOptions: {
136
- defaultBehavior: []
137
- },
138
- // Exclude generated importMap files and colocated server-function
139
- // modules (`*.functions.ts`). Admin form saves are dispatched via
140
- // `runPayloadServerFn` (a TanStack Start `createServerFn`) rather than
141
- // a hand-rolled route, so there is no longer an `api.server-function.ts`
142
- // to special-case here. The `*.functions.ts` shims live next to the
143
- // routes that use them (e.g. `app/_payload/*.functions.ts`); they
144
- // define `createServerFn`s, not routes, so they must not be scanned.
145
- routeFileIgnorePattern: 'importMap\\.(?:js|server\\.ts)$|\\.functions\\.',
146
- routesDirectory
147
- },
148
- rsc: {
149
- enabled: true
150
- },
151
- srcDirectory
152
- }),
153
- viteReact({
154
- exclude: [],
155
- include: /\.[jt]sx?$/
156
- })
157
- ],
158
- resolve: {
159
- alias: [
160
- {
161
- find: '@payload-config',
162
- replacement: path.resolve(payloadConfigPath)
163
- }
164
- ],
165
- dedupe: [
166
- 'react',
167
- 'react-dom',
168
- 'scheduler',
169
- '@payloadcms/ui',
170
- '@payloadcms/richtext-lexical'
171
- ],
172
- extensions: [
173
- '.mjs',
174
- '.js',
175
- '.mts',
176
- '.ts',
177
- '.jsx',
178
- '.tsx',
179
- '.json'
180
- ],
181
- tsconfigPaths: true
182
- },
183
- ssr: {
184
- external: ssrExternalPackages,
185
- noExternal: payloadNoExternalPatterns
186
- }
187
- };
188
- return vite ? mergeConfig(base, vite) : base;
189
- };
190
- }
191
-
192
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/vite/index.ts"],"sourcesContent":["import type { UserConfig, UserConfigFnObject } from 'vite'\n\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport rsc from '@vitejs/plugin-rsc'\nimport path from 'node:path'\nimport { mergeConfig } from 'vite'\n\nimport { payloadNoExternalPatterns, ssrExternalPackages } from './config/external.js'\nimport { optimizeDepsExcludeDefaults, optimizeDepsIncludeDefaults } from './config/optimizeDeps.js'\nimport {\n defaultImportProtectionIgnoreImporters,\n onImportProtectionViolation,\n serverOnlyClientSpecifiers,\n} from './importProtection.js'\nimport { clientModuleResolution } from './workarounds/clientModuleResolution.js'\nimport { payloadDevTransforms } from './workarounds/devTransforms.js'\nimport { reactDomServerInRsc } from './workarounds/reactDomServerInRsc.js'\nimport { ssrStripDistStyleImports } from './workarounds/stripDistStyleImports.js'\nimport { wrapCjsForClient } from './workarounds/wrapCjsForClient.js'\n\nexport type WithPayloadOptions = {\n /**\n * Additional import-protection `ignoreImporters` patterns. This is a\n * Payload-specific knob on the TanStack Start plugin, so it cannot be\n * expressed through `vite` — pass it here.\n */\n additionalIgnoreImporters?: RegExp[]\n /** Path to the user's `payload.config.ts` (required) */\n payloadConfigPath: string\n /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'` */\n routesDirectory?: string\n /** TanStack source directory. Defaults to `'src'` */\n srcDirectory?: string\n /**\n * Extra Vite config merged on top of the Payload defaults via Vite's own\n * `mergeConfig`. Objects are deep-merged and arrays are appended, so this is\n * the single hook for everything a consumer used to reach through separate\n * options: extra `plugins`, `resolve.alias` entries, `optimizeDeps.include`,\n * `ssr.external`, `server`, `build`, and so on.\n *\n * @example\n * withPayload({\n * payloadConfigPath: './src/payload.config.ts',\n * vite: { server: { port: 4000 } },\n * })\n */\n vite?: UserConfig\n}\n\n/**\n * Vite config helper for Payload + TanStack Start. The Vite-side counterpart to\n * `withPayload` for Next.js: it owns the whole Vite setup needed to run the\n * Payload admin — the RSC, React, and TanStack Start plugins plus a small set of\n * Payload-specific workarounds — so a consumer's `vite.config.ts` collapses to:\n *\n * ```ts\n * import { withPayload } from '@payloadcms/tanstack-start/vite'\n *\n * export default withPayload({ payloadConfigPath: './src/payload.config.ts' })\n * ```\n *\n * The React (`@vitejs/plugin-react`), RSC (`@vitejs/plugin-rsc`), and TanStack\n * Start plugins are instantiated internally with the settings the admin\n * requires — consumers no longer pass them in. Each remaining Payload\n * workaround lives in its own file under `./workarounds/` so it can be deleted\n * individually once the corresponding upstream fix lands.\n */\nexport function withPayload(options: WithPayloadOptions): UserConfigFnObject {\n const {\n additionalIgnoreImporters = [],\n payloadConfigPath,\n routesDirectory = 'app',\n srcDirectory = 'src',\n vite,\n } = options\n\n return (_env) => {\n const base: UserConfig = {\n css: {\n preprocessorOptions: {\n scss: {\n silenceDeprecations: ['import', 'global-builtin'],\n } as any,\n },\n },\n define: {\n global: 'globalThis',\n },\n environments: {\n rsc: { resolve: { noExternal: payloadNoExternalPatterns } },\n ssr: { resolve: { noExternal: payloadNoExternalPatterns } },\n } as any,\n optimizeDeps: {\n exclude: optimizeDepsExcludeDefaults,\n include: optimizeDepsIncludeDefaults,\n },\n plugins: [\n clientModuleResolution(),\n wrapCjsForClient(),\n ssrStripDistStyleImports(),\n reactDomServerInRsc(),\n payloadDevTransforms(),\n rsc({ serverHandler: false }),\n tanstackStart({\n importProtection: {\n client: { excludeFiles: [], specifiers: serverOnlyClientSpecifiers },\n ignoreImporters: [\n ...defaultImportProtectionIgnoreImporters,\n ...additionalIgnoreImporters,\n ],\n include: ['**/*'],\n mockAccess: 'warn',\n onViolation: onImportProtectionViolation,\n // Disable TanStack Start's default `**/*.client.*` file-based denial in\n // the SSR environment. Payload uses the `.client.tsx` filename suffix\n // for React Client Components (with a `'use client'` directive) that\n // MUST be server-rendered to HTML during SSR. The default rule would\n // otherwise replace those files with an `import-protection mock` Proxy\n // during SSR, which crashes React (TypeError: Cannot convert object to\n // primitive value) the moment React tries to format a warning that\n // mentions one of these components.\n server: { files: [] },\n },\n // Disable TanStack Router's automatic per-route code-splitting.\n //\n // With splitting enabled each route's `component` is fetched lazily\n // via `?tsr-split=component` after the initial SSR HTML is streamed.\n // Until that lazy chunk lands the rendered admin tree has no client\n // React attached, so any button clicks (e.g. the\n // `#toggle-list-filters` chevron in `<ListControls />`) hit a static\n // DOM, the click is dropped, and once the chunk finally loads the\n // component re-mounts with its initial `useState` instead of the\n // toggled value. That single behaviour was the root cause of the\n // \"page renders but nothing is interactive\" tanstack-start E2E\n // failures (`#list-controls-where`, `[data-lexical-editor]`, etc.) -\n // playwright traces show \"Download the React DevTools\" landing\n // *after* the playwright click, confirming late hydration.\n //\n // We pass BOTH knobs because `tanstackStart`'s schema silently\n // strips the user-supplied `autoCodeSplitting` (its `tsrConfig`\n // does `configSchema.omit({ autoCodeSplitting: true, target: true\n // })`) and then leaves the value `undefined` — which is fine for\n // the conditional inside `unpluginRouterComposedFactory`, but the\n // TanStack Start vite plugin *unconditionally* installs the router\n // code-splitter via `tanStackRouterCodeSplitter(...)` regardless.\n // The only knob that survives all of that and is honoured by the\n // splitter is `router.codeSplittingOptions.defaultBehavior` — set\n // to an empty array, the splitter still walks each `createFileRoute`\n // file but produces no virtual `?tsr-split=...` modules, so every\n // route component ships in the initial bundle and hydration starts\n // immediately on first paint. We keep `autoCodeSplitting: false` as\n // a belt-and-braces signal in case the start plugin ever stops\n // dropping it.\n //\n // Eager-loading routes ships a slightly larger initial bundle but\n // makes the admin actually interactive on first paint.\n router: {\n autoCodeSplitting: false,\n codeSplittingOptions: { defaultBehavior: [] },\n // Exclude generated importMap files and colocated server-function\n // modules (`*.functions.ts`). Admin form saves are dispatched via\n // `runPayloadServerFn` (a TanStack Start `createServerFn`) rather than\n // a hand-rolled route, so there is no longer an `api.server-function.ts`\n // to special-case here. The `*.functions.ts` shims live next to the\n // routes that use them (e.g. `app/_payload/*.functions.ts`); they\n // define `createServerFn`s, not routes, so they must not be scanned.\n routeFileIgnorePattern: 'importMap\\\\.(?:js|server\\\\.ts)$|\\\\.functions\\\\.',\n routesDirectory,\n } as any,\n rsc: { enabled: true },\n srcDirectory,\n }),\n viteReact({ exclude: [], include: /\\.[jt]sx?$/ }),\n ],\n resolve: {\n alias: [{ find: '@payload-config', replacement: path.resolve(payloadConfigPath) }],\n dedupe: [\n 'react',\n 'react-dom',\n 'scheduler',\n '@payloadcms/ui',\n '@payloadcms/richtext-lexical',\n ],\n extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json'],\n tsconfigPaths: true,\n } as any,\n ssr: {\n external: ssrExternalPackages,\n noExternal: payloadNoExternalPatterns,\n },\n }\n\n return vite ? mergeConfig(base, vite) : base\n }\n}\n"],"names":["tanstackStart","viteReact","rsc","path","mergeConfig","payloadNoExternalPatterns","ssrExternalPackages","optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults","defaultImportProtectionIgnoreImporters","onImportProtectionViolation","serverOnlyClientSpecifiers","clientModuleResolution","payloadDevTransforms","reactDomServerInRsc","ssrStripDistStyleImports","wrapCjsForClient","withPayload","options","additionalIgnoreImporters","payloadConfigPath","routesDirectory","srcDirectory","vite","_env","base","css","preprocessorOptions","scss","silenceDeprecations","define","global","environments","resolve","noExternal","ssr","optimizeDeps","exclude","include","plugins","serverHandler","importProtection","client","excludeFiles","specifiers","ignoreImporters","mockAccess","onViolation","server","files","router","autoCodeSplitting","codeSplittingOptions","defaultBehavior","routeFileIgnorePattern","enabled","alias","find","replacement","dedupe","extensions","tsconfigPaths","external"],"mappings":"AAEA,SAASA,aAAa,QAAQ,oCAAmC;AACjE,OAAOC,eAAe,uBAAsB;AAC5C,OAAOC,SAAS,qBAAoB;AACpC,OAAOC,UAAU,YAAW;AAC5B,SAASC,WAAW,QAAQ,OAAM;AAElC,SAASC,yBAAyB,EAAEC,mBAAmB,QAAQ,uBAAsB;AACrF,SAASC,2BAA2B,EAAEC,2BAA2B,QAAQ,2BAA0B;AACnG,SACEC,sCAAsC,EACtCC,2BAA2B,EAC3BC,0BAA0B,QACrB,wBAAuB;AAC9B,SAASC,sBAAsB,QAAQ,0CAAyC;AAChF,SAASC,oBAAoB,QAAQ,iCAAgC;AACrE,SAASC,mBAAmB,QAAQ,uCAAsC;AAC1E,SAASC,wBAAwB,QAAQ,yCAAwC;AACjF,SAASC,gBAAgB,QAAQ,oCAAmC;AA+BpE;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASC,YAAYC,OAA2B;IACrD,MAAM,EACJC,4BAA4B,EAAE,EAC9BC,iBAAiB,EACjBC,kBAAkB,KAAK,EACvBC,eAAe,KAAK,EACpBC,IAAI,EACL,GAAGL;IAEJ,OAAO,CAACM;QACN,MAAMC,OAAmB;YACvBC,KAAK;gBACHC,qBAAqB;oBACnBC,MAAM;wBACJC,qBAAqB;4BAAC;4BAAU;yBAAiB;oBACnD;gBACF;YACF;YACAC,QAAQ;gBACNC,QAAQ;YACV;YACAC,cAAc;gBACZ9B,KAAK;oBAAE+B,SAAS;wBAAEC,YAAY7B;oBAA0B;gBAAE;gBAC1D8B,KAAK;oBAAEF,SAAS;wBAAEC,YAAY7B;oBAA0B;gBAAE;YAC5D;YACA+B,cAAc;gBACZC,SAAS9B;gBACT+B,SAAS9B;YACX;YACA+B,SAAS;gBACP3B;gBACAI;gBACAD;gBACAD;gBACAD;gBACAX,IAAI;oBAAEsC,eAAe;gBAAM;gBAC3BxC,cAAc;oBACZyC,kBAAkB;wBAChBC,QAAQ;4BAAEC,cAAc,EAAE;4BAAEC,YAAYjC;wBAA2B;wBACnEkC,iBAAiB;+BACZpC;+BACAU;yBACJ;wBACDmB,SAAS;4BAAC;yBAAO;wBACjBQ,YAAY;wBACZC,aAAarC;wBACb,wEAAwE;wBACxE,sEAAsE;wBACtE,qEAAqE;wBACrE,qEAAqE;wBACrE,uEAAuE;wBACvE,uEAAuE;wBACvE,mEAAmE;wBACnE,oCAAoC;wBACpCsC,QAAQ;4BAAEC,OAAO,EAAE;wBAAC;oBACtB;oBACA,gEAAgE;oBAChE,EAAE;oBACF,oEAAoE;oBACpE,qEAAqE;oBACrE,oEAAoE;oBACpE,iDAAiD;oBACjD,qEAAqE;oBACrE,kEAAkE;oBAClE,iEAAiE;oBACjE,iEAAiE;oBACjE,+DAA+D;oBAC/D,qEAAqE;oBACrE,+DAA+D;oBAC/D,2DAA2D;oBAC3D,EAAE;oBACF,+DAA+D;oBAC/D,gEAAgE;oBAChE,kEAAkE;oBAClE,iEAAiE;oBACjE,kEAAkE;oBAClE,mEAAmE;oBACnE,kEAAkE;oBAClE,iEAAiE;oBACjE,kEAAkE;oBAClE,qEAAqE;oBACrE,kEAAkE;oBAClE,mEAAmE;oBACnE,oEAAoE;oBACpE,+DAA+D;oBAC/D,eAAe;oBACf,EAAE;oBACF,kEAAkE;oBAClE,uDAAuD;oBACvDC,QAAQ;wBACNC,mBAAmB;wBACnBC,sBAAsB;4BAAEC,iBAAiB,EAAE;wBAAC;wBAC5C,kEAAkE;wBAClE,kEAAkE;wBAClE,uEAAuE;wBACvE,yEAAyE;wBACzE,oEAAoE;wBACpE,kEAAkE;wBAClE,qEAAqE;wBACrEC,wBAAwB;wBACxBjC;oBACF;oBACAnB,KAAK;wBAAEqD,SAAS;oBAAK;oBACrBjC;gBACF;gBACArB,UAAU;oBAAEoC,SAAS,EAAE;oBAAEC,SAAS;gBAAa;aAChD;YACDL,SAAS;gBACPuB,OAAO;oBAAC;wBAAEC,MAAM;wBAAmBC,aAAavD,KAAK8B,OAAO,CAACb;oBAAmB;iBAAE;gBAClFuC,QAAQ;oBACN;oBACA;oBACA;oBACA;oBACA;iBACD;gBACDC,YAAY;oBAAC;oBAAQ;oBAAO;oBAAQ;oBAAO;oBAAQ;oBAAQ;iBAAQ;gBACnEC,eAAe;YACjB;YACA1B,KAAK;gBACH2B,UAAUxD;gBACV4B,YAAY7B;YACd;QACF;QAEA,OAAOkB,OAAOnB,YAAYqB,MAAMF,QAAQE;IAC1C;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"clientModuleResolution.d.ts","sourceRoot":"","sources":["../../../src/vite/workarounds/clientModuleResolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAKxC;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,YAAY,CA+ErD"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/vite/workarounds/clientModuleResolution.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\nimport fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Client-side module resolution:\n * 1. Stubs RSC modules (`@payloadcms/.../rsc`) with no-op components so the\n * Vite optimizer never tries to bundle their server implementations.\n * 2. Redirects bare `payload` imports made from user code (outside of\n * `node_modules` and our own packages) to `payload/shared`. The main\n * `payload` entry has top-level side effects requiring Node.js APIs.\n * 3. Resolves `/client` subpath exports for `@payloadcms/plugin-*` and\n * `@payloadcms/storage-*` packages when normal Vite resolution fails in\n * monorepo dev (no `dist/` built yet).\n */\nexport function clientModuleResolution(): PluginOption {\n const stubPrefix = '\\0payload:server-stub:'\n\n const serverOnlyPatterns: RegExp[] = [\n /^@payloadcms\\/richtext-lexical\\/rsc$/,\n /^@payloadcms\\/richtext-slate\\/rsc$/,\n /^@payloadcms\\/next\\/rsc$/,\n /^@payloadcms\\/tanstack-start\\/rsc$/,\n ]\n\n const serverOnlyExports: Record<string, string[]> = {\n '@payloadcms/next/rsc': ['CollectionCards', 'HierarchyTypeFieldServer'],\n '@payloadcms/richtext-lexical/rsc': [\n 'RscEntryLexicalCell',\n 'RscEntryLexicalField',\n 'LexicalDiffComponent',\n ],\n '@payloadcms/tanstack-start/rsc': [\n 'CollectionCards',\n 'HierarchyTypeFieldServer',\n 'renderPayloadComponentOnServer',\n ],\n }\n\n return {\n name: 'payload:client-module-resolution',\n enforce: 'pre',\n load(id) {\n if (!id.startsWith(stubPrefix)) {\n return\n }\n const specifier = id.slice(stubPrefix.length)\n const exports = serverOnlyExports[specifier]\n if (exports) {\n return exports.map((name) => `export const ${name} = () => null;`).join('\\n')\n }\n return `export default null;`\n },\n async resolveId(id, importer, options) {\n if (options?.ssr) {\n return\n }\n\n if (serverOnlyPatterns.some((p) => p.test(id))) {\n return stubPrefix + id\n }\n\n if (id === 'payload' && importer && !importer.includes('/node_modules/')) {\n const isPayloadPackage = /\\/packages\\/(?:payload|ui|richtext-|tanstack-start|next)\\//.test(\n importer,\n )\n if (!isPayloadPackage) {\n return this.resolve('payload/shared', importer, { ...options, skipSelf: true })\n }\n }\n\n if (/^@payloadcms\\/(?:plugin|storage)-[^/]+\\/client$/.test(id)) {\n const resolved = await this.resolve(id, importer, { ...options, skipSelf: true })\n if (resolved) {\n return resolved\n }\n const pkgName = id.replace(/\\/client$/, '')\n const pkgResolved = await this.resolve(pkgName, importer, { ...options, skipSelf: true })\n if (pkgResolved) {\n const pkgDir = path.dirname(pkgResolved.id)\n const candidates = [\n path.resolve(pkgDir, 'src', 'exports', 'client.ts'),\n path.resolve(pkgDir, 'src', 'exports', 'client.js'),\n path.resolve(pkgDir, 'dist', 'exports', 'client.js'),\n ]\n for (const candidate of candidates) {\n if (fs.existsSync(candidate)) {\n return candidate\n }\n }\n }\n }\n },\n }\n}\n"],"names":["fs","path","clientModuleResolution","stubPrefix","serverOnlyPatterns","serverOnlyExports","name","enforce","load","id","startsWith","specifier","slice","length","exports","map","join","resolveId","importer","options","ssr","some","p","test","includes","isPayloadPackage","resolve","skipSelf","resolved","pkgName","replace","pkgResolved","pkgDir","dirname","candidates","candidate","existsSync"],"mappings":"AAEA,OAAOA,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAE5B;;;;;;;;;;CAUC,GACD,OAAO,SAASC;IACd,MAAMC,aAAa;IAEnB,MAAMC,qBAA+B;QACnC;QACA;QACA;QACA;KACD;IAED,MAAMC,oBAA8C;QAClD,wBAAwB;YAAC;YAAmB;SAA2B;QACvE,oCAAoC;YAClC;YACA;YACA;SACD;QACD,kCAAkC;YAChC;YACA;YACA;SACD;IACH;IAEA,OAAO;QACLC,MAAM;QACNC,SAAS;QACTC,MAAKC,EAAE;YACL,IAAI,CAACA,GAAGC,UAAU,CAACP,aAAa;gBAC9B;YACF;YACA,MAAMQ,YAAYF,GAAGG,KAAK,CAACT,WAAWU,MAAM;YAC5C,MAAMC,UAAUT,iBAAiB,CAACM,UAAU;YAC5C,IAAIG,SAAS;gBACX,OAAOA,QAAQC,GAAG,CAAC,CAACT,OAAS,CAAC,aAAa,EAAEA,KAAK,cAAc,CAAC,EAAEU,IAAI,CAAC;YAC1E;YACA,OAAO,CAAC,oBAAoB,CAAC;QAC/B;QACA,MAAMC,WAAUR,EAAE,EAAES,QAAQ,EAAEC,OAAO;YACnC,IAAIA,SAASC,KAAK;gBAChB;YACF;YAEA,IAAIhB,mBAAmBiB,IAAI,CAAC,CAACC,IAAMA,EAAEC,IAAI,CAACd,MAAM;gBAC9C,OAAON,aAAaM;YACtB;YAEA,IAAIA,OAAO,aAAaS,YAAY,CAACA,SAASM,QAAQ,CAAC,mBAAmB;gBACxE,MAAMC,mBAAmB,6DAA6DF,IAAI,CACxFL;gBAEF,IAAI,CAACO,kBAAkB;oBACrB,OAAO,IAAI,CAACC,OAAO,CAAC,kBAAkBR,UAAU;wBAAE,GAAGC,OAAO;wBAAEQ,UAAU;oBAAK;gBAC/E;YACF;YAEA,IAAI,kDAAkDJ,IAAI,CAACd,KAAK;gBAC9D,MAAMmB,WAAW,MAAM,IAAI,CAACF,OAAO,CAACjB,IAAIS,UAAU;oBAAE,GAAGC,OAAO;oBAAEQ,UAAU;gBAAK;gBAC/E,IAAIC,UAAU;oBACZ,OAAOA;gBACT;gBACA,MAAMC,UAAUpB,GAAGqB,OAAO,CAAC,aAAa;gBACxC,MAAMC,cAAc,MAAM,IAAI,CAACL,OAAO,CAACG,SAASX,UAAU;oBAAE,GAAGC,OAAO;oBAAEQ,UAAU;gBAAK;gBACvF,IAAII,aAAa;oBACf,MAAMC,SAAS/B,KAAKgC,OAAO,CAACF,YAAYtB,EAAE;oBAC1C,MAAMyB,aAAa;wBACjBjC,KAAKyB,OAAO,CAACM,QAAQ,OAAO,WAAW;wBACvC/B,KAAKyB,OAAO,CAACM,QAAQ,OAAO,WAAW;wBACvC/B,KAAKyB,OAAO,CAACM,QAAQ,QAAQ,WAAW;qBACzC;oBACD,KAAK,MAAMG,aAAaD,WAAY;wBAClC,IAAIlC,GAAGoC,UAAU,CAACD,YAAY;4BAC5B,OAAOA;wBACT;oBACF;gBACF;YACF;QACF;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"devTransforms.d.ts","sourceRoot":"","sources":["../../../src/vite/workarounds/devTransforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,YAAY,CA2DnD"}