@payloadcms/tanstack-start 4.0.0-internal.5214550 → 4.0.0-internal.532221d

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 (205) 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 +18 -2
  15. package/dist/elements/RouterAdapter/index.js.map +1 -1
  16. package/dist/exports/client.d.ts +1 -2
  17. package/dist/exports/client.d.ts.map +1 -1
  18. package/dist/exports/client.js +1 -2
  19. package/dist/exports/client.js.map +1 -1
  20. package/dist/exports/layouts.d.ts +1 -3
  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 +3 -3
  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 +6 -4
  55. package/dist/routes/adminRoutes.d.ts.map +1 -1
  56. package/dist/routes/adminRoutes.js +35 -41
  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.map +1 -1
  63. package/dist/routes/layoutRoute.js +1 -0
  64. package/dist/routes/layoutRoute.js.map +1 -1
  65. package/dist/utilities/getRequestLocale.d.ts.map +1 -1
  66. package/dist/utilities/getRequestLocale.js +1 -2
  67. package/dist/utilities/getRequestLocale.js.map +1 -1
  68. package/dist/utilities/graphqlHandler.server.d.ts.map +1 -1
  69. package/dist/utilities/{handleAPIRoute.d.ts → handleAPIRoute.server.d.ts} +1 -1
  70. package/dist/utilities/handleAPIRoute.server.d.ts.map +1 -0
  71. package/dist/utilities/{handleAPIRoute.js → handleAPIRoute.server.js} +1 -1
  72. package/dist/utilities/handleAPIRoute.server.js.map +1 -0
  73. package/dist/utilities/handleServerFunctions.d.ts +1 -19
  74. package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
  75. package/dist/utilities/handleServerFunctions.js +8 -56
  76. package/dist/utilities/handleServerFunctions.js.map +1 -1
  77. package/dist/utilities/loadAdminPage.d.ts.map +1 -1
  78. package/dist/utilities/loadAdminPage.js +13 -12
  79. package/dist/utilities/loadAdminPage.js.map +1 -1
  80. package/dist/utilities/meta.d.ts +1 -0
  81. package/dist/utilities/meta.d.ts.map +1 -1
  82. package/dist/utilities/meta.js +2 -1
  83. package/dist/utilities/meta.js.map +1 -1
  84. package/dist/utilities/routerSearch.d.ts +40 -0
  85. package/dist/utilities/routerSearch.d.ts.map +1 -0
  86. package/dist/utilities/routerSearch.js +45 -0
  87. package/dist/utilities/routerSearch.js.map +1 -0
  88. package/dist/utilities/serverAdapter.server.d.ts.map +1 -1
  89. package/dist/withPayload/config/external.d.ts +36 -0
  90. package/dist/withPayload/config/external.d.ts.map +1 -0
  91. package/dist/withPayload/config/external.js +82 -0
  92. package/dist/withPayload/config/external.js.map +1 -0
  93. package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -0
  94. package/dist/withPayload/config/optimizeDeps.js.map +1 -0
  95. package/dist/withPayload/config/scss.d.ts.map +1 -0
  96. package/dist/withPayload/config/scss.js.map +1 -0
  97. package/dist/withPayload/importProtection.d.ts.map +1 -0
  98. package/dist/{vite → withPayload}/importProtection.js +3 -7
  99. package/dist/withPayload/importProtection.js.map +1 -0
  100. package/dist/{vite → withPayload}/index.d.ts +28 -10
  101. package/dist/withPayload/index.d.ts.map +1 -0
  102. package/dist/{vite → withPayload}/index.js +58 -30
  103. package/dist/withPayload/index.js.map +1 -0
  104. package/dist/withPayload/workarounds/clientModuleResolution.d.ts.map +1 -0
  105. package/dist/withPayload/workarounds/clientModuleResolution.js.map +1 -0
  106. package/dist/withPayload/workarounds/devTransforms.d.ts.map +1 -0
  107. package/dist/{vite → withPayload}/workarounds/devTransforms.js +5 -0
  108. package/dist/withPayload/workarounds/devTransforms.js.map +1 -0
  109. package/dist/withPayload/workarounds/reactDomServerInRsc.d.ts.map +1 -0
  110. package/dist/withPayload/workarounds/reactDomServerInRsc.js.map +1 -0
  111. package/dist/withPayload/workarounds/stripDistStyleImports.d.ts.map +1 -0
  112. package/dist/{vite → withPayload}/workarounds/stripDistStyleImports.js +1 -1
  113. package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -0
  114. package/dist/withPayload/workarounds/stubPrettierInClient.d.ts +13 -0
  115. package/dist/withPayload/workarounds/stubPrettierInClient.d.ts.map +1 -0
  116. package/dist/withPayload/workarounds/stubPrettierInClient.js +32 -0
  117. package/dist/withPayload/workarounds/stubPrettierInClient.js.map +1 -0
  118. package/dist/withPayload/workarounds/wrapCjsForClient.d.ts.map +1 -0
  119. package/dist/withPayload/workarounds/wrapCjsForClient.js.map +1 -0
  120. package/package.json +19 -12
  121. package/dist/elements/DocumentHeaderClient/index.d.ts +0 -16
  122. package/dist/elements/DocumentHeaderClient/index.d.ts.map +0 -1
  123. package/dist/elements/DocumentHeaderClient/index.js +0 -116
  124. package/dist/elements/DocumentHeaderClient/index.js.map +0 -1
  125. package/dist/elements/RenderComponent/index.d.ts +0 -10
  126. package/dist/elements/RenderComponent/index.d.ts.map +0 -1
  127. package/dist/elements/RenderComponent/index.js +0 -12
  128. package/dist/elements/RenderComponent/index.js.map +0 -1
  129. package/dist/exports/vite.d.ts +0 -3
  130. package/dist/exports/vite.d.ts.map +0 -1
  131. package/dist/exports/vite.js +0 -3
  132. package/dist/exports/vite.js.map +0 -1
  133. package/dist/layouts/Root/index.d.ts +0 -32
  134. package/dist/layouts/Root/index.d.ts.map +0 -1
  135. package/dist/layouts/Root/index.js +0 -51
  136. package/dist/layouts/Root/index.js.map +0 -1
  137. package/dist/rsc/renderPayloadRSC.d.ts +0 -6
  138. package/dist/rsc/renderPayloadRSC.d.ts.map +0 -1
  139. package/dist/rsc/renderPayloadRSC.js +0 -6
  140. package/dist/rsc/renderPayloadRSC.js.map +0 -1
  141. package/dist/utilities/getExistingAuthToken.d.ts +0 -7
  142. package/dist/utilities/getExistingAuthToken.d.ts.map +0 -1
  143. package/dist/utilities/getExistingAuthToken.js +0 -18
  144. package/dist/utilities/getExistingAuthToken.js.map +0 -1
  145. package/dist/utilities/getPreferences.d.ts +0 -10
  146. package/dist/utilities/getPreferences.d.ts.map +0 -1
  147. package/dist/utilities/getPreferences.js +0 -33
  148. package/dist/utilities/getPreferences.js.map +0 -1
  149. package/dist/utilities/getRequestTheme.d.ts +0 -10
  150. package/dist/utilities/getRequestTheme.d.ts.map +0 -1
  151. package/dist/utilities/getRequestTheme.js +0 -25
  152. package/dist/utilities/getRequestTheme.js.map +0 -1
  153. package/dist/utilities/handleAPIRoute.d.ts.map +0 -1
  154. package/dist/utilities/handleAPIRoute.js.map +0 -1
  155. package/dist/utilities/importMap.server.d.ts +0 -8
  156. package/dist/utilities/importMap.server.d.ts.map +0 -1
  157. package/dist/utilities/importMap.server.js +0 -11
  158. package/dist/utilities/importMap.server.js.map +0 -1
  159. package/dist/utilities/serverFunctionHandlers.d.ts +0 -18
  160. package/dist/utilities/serverFunctionHandlers.d.ts.map +0 -1
  161. package/dist/utilities/serverFunctionHandlers.js +0 -17
  162. package/dist/utilities/serverFunctionHandlers.js.map +0 -1
  163. package/dist/utilities/setPayloadAuthCookie.d.ts +0 -9
  164. package/dist/utilities/setPayloadAuthCookie.d.ts.map +0 -1
  165. package/dist/utilities/setPayloadAuthCookie.js +0 -31
  166. package/dist/utilities/setPayloadAuthCookie.js.map +0 -1
  167. package/dist/vite/config/external.d.ts +0 -11
  168. package/dist/vite/config/external.d.ts.map +0 -1
  169. package/dist/vite/config/external.js +0 -48
  170. package/dist/vite/config/external.js.map +0 -1
  171. package/dist/vite/config/optimizeDeps.d.ts.map +0 -1
  172. package/dist/vite/config/optimizeDeps.js.map +0 -1
  173. package/dist/vite/config/scss.d.ts.map +0 -1
  174. package/dist/vite/config/scss.js.map +0 -1
  175. package/dist/vite/importProtection.d.ts.map +0 -1
  176. package/dist/vite/importProtection.js.map +0 -1
  177. package/dist/vite/index.d.ts.map +0 -1
  178. package/dist/vite/index.js.map +0 -1
  179. package/dist/vite/workarounds/clientModuleResolution.d.ts.map +0 -1
  180. package/dist/vite/workarounds/clientModuleResolution.js.map +0 -1
  181. package/dist/vite/workarounds/devTransforms.d.ts.map +0 -1
  182. package/dist/vite/workarounds/devTransforms.js.map +0 -1
  183. package/dist/vite/workarounds/reactDomServerInRsc.d.ts.map +0 -1
  184. package/dist/vite/workarounds/reactDomServerInRsc.js.map +0 -1
  185. package/dist/vite/workarounds/stripDistStyleImports.d.ts.map +0 -1
  186. package/dist/vite/workarounds/stripDistStyleImports.js.map +0 -1
  187. package/dist/vite/workarounds/stubPrettierInClient.d.ts +0 -21
  188. package/dist/vite/workarounds/stubPrettierInClient.d.ts.map +0 -1
  189. package/dist/vite/workarounds/stubPrettierInClient.js +0 -39
  190. package/dist/vite/workarounds/stubPrettierInClient.js.map +0 -1
  191. package/dist/vite/workarounds/wrapCjsForClient.d.ts.map +0 -1
  192. package/dist/vite/workarounds/wrapCjsForClient.js.map +0 -1
  193. /package/dist/{vite → withPayload}/config/optimizeDeps.d.ts +0 -0
  194. /package/dist/{vite → withPayload}/config/optimizeDeps.js +0 -0
  195. /package/dist/{vite → withPayload}/config/scss.d.ts +0 -0
  196. /package/dist/{vite → withPayload}/config/scss.js +0 -0
  197. /package/dist/{vite → withPayload}/importProtection.d.ts +0 -0
  198. /package/dist/{vite → withPayload}/workarounds/clientModuleResolution.d.ts +0 -0
  199. /package/dist/{vite → withPayload}/workarounds/clientModuleResolution.js +0 -0
  200. /package/dist/{vite → withPayload}/workarounds/devTransforms.d.ts +0 -0
  201. /package/dist/{vite → withPayload}/workarounds/reactDomServerInRsc.d.ts +0 -0
  202. /package/dist/{vite → withPayload}/workarounds/reactDomServerInRsc.js +0 -0
  203. /package/dist/{vite → withPayload}/workarounds/stripDistStyleImports.d.ts +0 -0
  204. /package/dist/{vite → withPayload}/workarounds/wrapCjsForClient.d.ts +0 -0
  205. /package/dist/{vite → withPayload}/workarounds/wrapCjsForClient.js +0 -0
@@ -0,0 +1,45 @@
1
+ import * as qs from 'qs-esm';
2
+ /**
3
+ * `parseSearch` for TanStack Router's `createRouter`, required for Payload's
4
+ * admin UI. Pair with {@link payloadStringifySearch}.
5
+ *
6
+ * Payload serializes query state (notably the list-view `where` filter) with
7
+ * `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack
8
+ * Router's default serializer treats each bracketed string as a flat key and
9
+ * JSON-encodes values, so it never round-trips Payload's nested query: every
10
+ * navigation re-encodes the already-encoded value, exponentially nesting it
11
+ * (`[true,"[true,\"[true…"]`) until the filter is unusable. Parsing and
12
+ * stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps
13
+ * the URL idempotent and the nested `where` intact across navigations.
14
+ *
15
+ * This is a router-global serializer: it applies to every route, not just
16
+ * `/admin`. On your own routes, search values arrive as strings (qs does no
17
+ * JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where
18
+ * you need numbers or booleans.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { createRouter } from '@tanstack/react-router'
23
+ * import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start/shared'
24
+ *
25
+ * export function getRouter() {
26
+ * return createRouter({
27
+ * parseSearch: payloadParseSearch,
28
+ * routeTree,
29
+ * stringifySearch: payloadStringifySearch,
30
+ * })
31
+ * }
32
+ * ```
33
+ */ export const payloadParseSearch = (searchStr)=>qs.parse(searchStr, {
34
+ depth: 10,
35
+ ignoreQueryPrefix: true
36
+ });
37
+ /**
38
+ * `stringifySearch` for TanStack Router's `createRouter`, required for Payload's
39
+ * admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.
40
+ */ export const payloadStringifySearch = (search)=>{
41
+ const searchStr = qs.stringify(search);
42
+ return searchStr ? `?${searchStr}` : '';
43
+ };
44
+
45
+ //# sourceMappingURL=routerSearch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/routerSearch.ts"],"sourcesContent":["import * as qs from 'qs-esm'\n\n/**\n * `parseSearch` for TanStack Router's `createRouter`, required for Payload's\n * admin UI. Pair with {@link payloadStringifySearch}.\n *\n * Payload serializes query state (notably the list-view `where` filter) with\n * `qs` bracket notation — e.g. `?where[or][0][and][0][x][equals]=y`. TanStack\n * Router's default serializer treats each bracketed string as a flat key and\n * JSON-encodes values, so it never round-trips Payload's nested query: every\n * navigation re-encodes the already-encoded value, exponentially nesting it\n * (`[true,\"[true,\\\"[true…\"]`) until the filter is unusable. Parsing and\n * stringifying with `qs` (same options as `payload`/`@payloadcms/ui`) keeps\n * the URL idempotent and the nested `where` intact across navigations.\n *\n * This is a router-global serializer: it applies to every route, not just\n * `/admin`. On your own routes, search values arrive as strings (qs does no\n * JSON type-coercion), so coerce in `validateSearch` (e.g. `Number(...)`) where\n * you need numbers or booleans.\n *\n * @example\n * ```ts\n * import { createRouter } from '@tanstack/react-router'\n * import { payloadParseSearch, payloadStringifySearch } from '@payloadcms/tanstack-start/shared'\n *\n * export function getRouter() {\n * return createRouter({\n * parseSearch: payloadParseSearch,\n * routeTree,\n * stringifySearch: payloadStringifySearch,\n * })\n * }\n * ```\n */\nexport const payloadParseSearch = (searchStr: string) =>\n qs.parse(searchStr, { depth: 10, ignoreQueryPrefix: true })\n\n/**\n * `stringifySearch` for TanStack Router's `createRouter`, required for Payload's\n * admin UI. Pair with {@link payloadParseSearch}; see it for the full rationale.\n */\nexport const payloadStringifySearch = (search: Record<string, unknown>) => {\n const searchStr = qs.stringify(search)\n return searchStr ? `?${searchStr}` : ''\n}\n"],"names":["qs","payloadParseSearch","searchStr","parse","depth","ignoreQueryPrefix","payloadStringifySearch","search","stringify"],"mappings":"AAAA,YAAYA,QAAQ,SAAQ;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BC,GACD,OAAO,MAAMC,qBAAqB,CAACC,YACjCF,GAAGG,KAAK,CAACD,WAAW;QAAEE,OAAO;QAAIC,mBAAmB;IAAK,GAAE;AAE7D;;;CAGC,GACD,OAAO,MAAMC,yBAAyB,CAACC;IACrC,MAAML,YAAYF,GAAGQ,SAAS,CAACD;IAC/B,OAAOL,YAAY,CAAC,CAAC,EAAEA,WAAW,GAAG;AACvC,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"serverAdapter.server.d.ts","sourceRoot":"","sources":["../../src/utilities/serverAdapter.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,GAAI,KAAK,aAAa,KAAG,aAgBjE,CAAA"}
1
+ {"version":3,"file":"serverAdapter.server.d.ts","sourceRoot":"","sources":["../../src/utilities/serverAdapter.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"}
@@ -0,0 +1,36 @@
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
+ * Packages externalized during dev serve (`ssr.external`). Node's loader resolves
7
+ * their CJS/UMD directly; letting Vite's dev SSR transform touch them can break
8
+ * fragile UMD wrappers (e.g. `pluralize`, whose `this`-based global assignment
9
+ * throws when transformed rather than required).
10
+ *
11
+ * Note `pluralize` is deliberately excluded from {@link buildExternalPackages}:
12
+ * for the production build it must bundle (see there).
13
+ */
14
+ export declare const ssrExternalPackages: string[];
15
+ /**
16
+ * External packages for the production `vite build` only (not dev serve).
17
+ *
18
+ * Externalizes the `@payloadcms/*` package boundaries — plus `payload` — so each
19
+ * resolves its own transitive Node deps (`pino`, `drizzle-orm`, `libsql`, …) from
20
+ * its own `node_modules` at runtime. Externalizing only the leaf deps breaks under
21
+ * pnpm: a leaf imported by bundled code becomes an unresolvable bare specifier from
22
+ * `dist/`, since pnpm does not hoist it.
23
+ *
24
+ * Kept out of dev's `ssr.external` on purpose: the monorepo resolves these to
25
+ * TypeScript source (`.ts` imported via `.js` specifiers), which only Vite's
26
+ * transform can resolve — an externalized copy would hit Node's raw resolver and
27
+ * fail on the `.js`→`.ts` mismatch.
28
+ *
29
+ * `pluralize` is excluded: it is reached from client-safe code (`payload`'s
30
+ * `formatLabels`, shipped in the `/shared` export), so externalizing it would
31
+ * leave a bare specifier in a bundled client chunk that pnpm can't resolve from
32
+ * `dist/` at runtime. It must bundle for the build.
33
+ */
34
+ export declare const buildExternalPackages: string[];
35
+ export declare const payloadNoExternalPatterns: Array<RegExp | string>;
36
+ //# sourceMappingURL=external.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/withPayload/config/external.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,EA+BvC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,EAUzC,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO5D,CAAA"}
@@ -0,0 +1,82 @@
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
+ * Packages externalized during dev serve (`ssr.external`). Node's loader resolves
6
+ * their CJS/UMD directly; letting Vite's dev SSR transform touch them can break
7
+ * fragile UMD wrappers (e.g. `pluralize`, whose `this`-based global assignment
8
+ * throws when transformed rather than required).
9
+ *
10
+ * Note `pluralize` is deliberately excluded from {@link buildExternalPackages}:
11
+ * for the production build it must bundle (see there).
12
+ */ export const ssrExternalPackages = [
13
+ 'ajv',
14
+ 'fast-uri',
15
+ 'drizzle-kit',
16
+ 'drizzle-kit/api',
17
+ 'drizzle-orm',
18
+ 'sharp',
19
+ 'require-in-the-middle',
20
+ 'json-schema-to-typescript',
21
+ 'pino',
22
+ 'pino-pretty',
23
+ 'graphql',
24
+ 'nodemailer',
25
+ 'aws4',
26
+ 'pluralize',
27
+ 'console-table-printer',
28
+ '@azure/storage-blob',
29
+ '@aws-sdk/client-s3',
30
+ '@aws-sdk/s3-request-presigner',
31
+ '@google-cloud/storage',
32
+ // Database drivers + their lazily-required companions, one group per adapter.
33
+ // Postgres (`@payloadcms/db-postgres`, `@payloadcms/db-vercel-postgres`)
34
+ 'pg',
35
+ 'pg-native',
36
+ 'pg-cloudflare',
37
+ // SQLite (`@payloadcms/db-sqlite`)
38
+ 'better-sqlite3',
39
+ 'libsql',
40
+ // Mongo (`@payloadcms/db-mongodb`)
41
+ 'mongodb',
42
+ 'mongoose'
43
+ ];
44
+ /**
45
+ * External packages for the production `vite build` only (not dev serve).
46
+ *
47
+ * Externalizes the `@payloadcms/*` package boundaries — plus `payload` — so each
48
+ * resolves its own transitive Node deps (`pino`, `drizzle-orm`, `libsql`, …) from
49
+ * its own `node_modules` at runtime. Externalizing only the leaf deps breaks under
50
+ * pnpm: a leaf imported by bundled code becomes an unresolvable bare specifier from
51
+ * `dist/`, since pnpm does not hoist it.
52
+ *
53
+ * Kept out of dev's `ssr.external` on purpose: the monorepo resolves these to
54
+ * TypeScript source (`.ts` imported via `.js` specifiers), which only Vite's
55
+ * transform can resolve — an externalized copy would hit Node's raw resolver and
56
+ * fail on the `.js`→`.ts` mismatch.
57
+ *
58
+ * `pluralize` is excluded: it is reached from client-safe code (`payload`'s
59
+ * `formatLabels`, shipped in the `/shared` export), so externalizing it would
60
+ * leave a bare specifier in a bundled client chunk that pnpm can't resolve from
61
+ * `dist/` at runtime. It must bundle for the build.
62
+ */ export const buildExternalPackages = [
63
+ 'payload',
64
+ 'payload/node',
65
+ '@payloadcms/drizzle',
66
+ '@payloadcms/db-mongodb',
67
+ '@payloadcms/db-postgres',
68
+ '@payloadcms/db-vercel-postgres',
69
+ '@payloadcms/db-sqlite',
70
+ '@payloadcms/db-d1-sqlite',
71
+ ...ssrExternalPackages.filter((pkg)=>pkg !== 'pluralize')
72
+ ];
73
+ export const payloadNoExternalPatterns = [
74
+ '@payloadcms/ui',
75
+ '@payloadcms/translations',
76
+ '@payloadcms/tanstack-start',
77
+ /^@payloadcms\/richtext-lexical/,
78
+ /^@payloadcms\/plugin-/,
79
+ /^@payloadcms\/storage-/
80
+ ];
81
+
82
+ //# sourceMappingURL=external.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/withPayload/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 * Packages externalized during dev serve (`ssr.external`). Node's loader resolves\n * their CJS/UMD directly; letting Vite's dev SSR transform touch them can break\n * fragile UMD wrappers (e.g. `pluralize`, whose `this`-based global assignment\n * throws when transformed rather than required).\n *\n * Note `pluralize` is deliberately excluded from {@link buildExternalPackages}:\n * for the production build it must bundle (see there).\n */\nexport const ssrExternalPackages: string[] = [\n 'ajv',\n 'fast-uri',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'drizzle-orm',\n 'sharp',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n 'pino',\n 'pino-pretty',\n 'graphql',\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 // Database drivers + their lazily-required companions, one group per adapter.\n // Postgres (`@payloadcms/db-postgres`, `@payloadcms/db-vercel-postgres`)\n 'pg',\n 'pg-native',\n 'pg-cloudflare',\n // SQLite (`@payloadcms/db-sqlite`)\n 'better-sqlite3',\n 'libsql',\n // Mongo (`@payloadcms/db-mongodb`)\n 'mongodb',\n 'mongoose',\n]\n\n/**\n * External packages for the production `vite build` only (not dev serve).\n *\n * Externalizes the `@payloadcms/*` package boundaries — plus `payload` — so each\n * resolves its own transitive Node deps (`pino`, `drizzle-orm`, `libsql`, …) from\n * its own `node_modules` at runtime. Externalizing only the leaf deps breaks under\n * pnpm: a leaf imported by bundled code becomes an unresolvable bare specifier from\n * `dist/`, since pnpm does not hoist it.\n *\n * Kept out of dev's `ssr.external` on purpose: the monorepo resolves these to\n * TypeScript source (`.ts` imported via `.js` specifiers), which only Vite's\n * transform can resolve — an externalized copy would hit Node's raw resolver and\n * fail on the `.js`→`.ts` mismatch.\n *\n * `pluralize` is excluded: it is reached from client-safe code (`payload`'s\n * `formatLabels`, shipped in the `/shared` export), so externalizing it would\n * leave a bare specifier in a bundled client chunk that pnpm can't resolve from\n * `dist/` at runtime. It must bundle for the build.\n */\nexport const buildExternalPackages: string[] = [\n 'payload',\n 'payload/node',\n '@payloadcms/drizzle',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-d1-sqlite',\n ...ssrExternalPackages.filter((pkg) => pkg !== 'pluralize'),\n]\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","buildExternalPackages","filter","pkg","payloadNoExternalPatterns"],"mappings":"AAAA;;;CAGC,GAED;;;;;;;;CAQC,GACD,OAAO,MAAMA,sBAAgC;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,8EAA8E;IAC9E,yEAAyE;IACzE;IACA;IACA;IACA,mCAAmC;IACnC;IACA;IACA,mCAAmC;IACnC;IACA;CACD,CAAA;AAED;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,MAAMC,wBAAkC;IAC7C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;OACGD,oBAAoBE,MAAM,CAAC,CAACC,MAAQA,QAAQ;CAChD,CAAA;AAED,OAAO,MAAMC,4BAAoD;IAC/D;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimizeDeps.d.ts","sourceRoot":"","sources":["../../../src/withPayload/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"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/withPayload/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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scss.d.ts","sourceRoot":"","sources":["../../../src/withPayload/config/scss.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;qBAEZ,MAAM,GAAG,IAAI,GAAG,GAAG;GAWvC,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/withPayload/config/scss.ts"],"sourcesContent":["import { createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * SCSS `@import`/`@use` importers applied for every Payload consumer.\n *\n * Resolves webpack-style `~@payloadcms/...` tilde specifiers (emitted by\n * first-party Payload package styles, e.g. `@payloadcms/richtext-slate`) to the\n * installed package via Node resolution. Because it goes through the package's\n * `exports` map, it picks the workspace `src` scss in the monorepo and the\n * published `dist` scss in a consumer install automatically — no per-app\n * `findFileUrl` shim needed.\n */\nexport const payloadScssImporters = [\n {\n findFileUrl(url: string): null | URL {\n if (!url.startsWith('~@payloadcms/')) {\n return null\n }\n try {\n return pathToFileURL(require.resolve(url.slice(1)))\n } catch {\n return null\n }\n },\n },\n]\n"],"names":["createRequire","pathToFileURL","require","url","payloadScssImporters","findFileUrl","startsWith","resolve","slice"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAa;AAC3C,SAASC,aAAa,QAAQ,WAAU;AAExC,MAAMC,UAAUF,cAAc,YAAYG,GAAG;AAE7C;;;;;;;;;CASC,GACD,OAAO,MAAMC,uBAAuB;IAClC;QACEC,aAAYF,GAAW;YACrB,IAAI,CAACA,IAAIG,UAAU,CAAC,kBAAkB;gBACpC,OAAO;YACT;YACA,IAAI;gBACF,OAAOL,cAAcC,QAAQK,OAAO,CAACJ,IAAIK,KAAK,CAAC;YACjD,EAAE,OAAM;gBACN,OAAO;YACT;QACF;IACF;CACD,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importProtection.d.ts","sourceRoot":"","sources":["../../src/withPayload/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,CAmC9E;AAED,eAAO,MAAM,sCAAsC,EAAE,MAAM,EAAsC,CAAA"}
@@ -11,7 +11,7 @@ import { builtinModules } from 'node:module';
11
11
  /^@payloadcms\/richtext-lexical\/rsc/,
12
12
  /^@payloadcms\/richtext-slate\/rsc/,
13
13
  '@payloadcms/ui/server',
14
- /^@payloadcms\/tanstack-start\/(layouts|rsc|server|views\/server)/,
14
+ /^@payloadcms\/tanstack-start\/(layouts|rsc|server)/,
15
15
  'sharp',
16
16
  'busboy',
17
17
  'croner',
@@ -30,12 +30,8 @@ import { builtinModules } from 'node:module';
30
30
  * to permit even when they appear to cross a server/client boundary.
31
31
  */ export function onImportProtectionViolation(violation) {
32
32
  const info = violation;
33
- // Payload's `.client.*` components must be server-rendered, so exempt them from
34
- // TanStack's default `**/*.client.*` SSR denial. Matched by resolved path
35
- // (installed and linked/monorepo) so a host's own `.client.*` files stay
36
- // protected.
37
- const payloadClientFile = /@payloadcms\/|\/packages\/(?:ui|richtext-lexical|richtext-slate|plugin-[^/]+)\//;
38
- if (info.envType === 'server' && info.resolved?.includes('.client.') && payloadClientFile.test(info.resolved)) {
33
+ const allowedClientFileImporters = /\/richtext-lexical\/.*\/exports\/client\/|\/ui\//;
34
+ if (info.envType === 'server' && info.resolved?.includes('.client.') && allowedClientFileImporters.test(info.importer)) {
39
35
  return false;
40
36
  }
41
37
  if (info.importer.includes('/richtext-lexical/') && info.importer.includes('/field/Diff/')) {
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/withPayload/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)/,\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 = /\\/richtext-lexical\\/.*\\/exports\\/client\\/|\\/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,6BAA6B;IAEnC,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"}
@@ -5,6 +5,10 @@ import rsc from '@vitejs/plugin-rsc';
5
5
  export type WithPayloadOptions = {
6
6
  /** Extra import-protection `ignoreImporters` patterns for the TanStack Start plugin. */
7
7
  additionalIgnoreImporters?: RegExp[];
8
+ /** Route id of Payload's admin layout, eager-loaded instead of code-split. Defaults to `'/_payload'`. */
9
+ adminRouteId?: string;
10
+ /** Extra globs exempted from the `.client.*` SSR denial (beyond the default node_modules exemption). */
11
+ clientDenialExcludeFiles?: string[];
8
12
  /** Path to the user's `payload.config.ts` (required) */
9
13
  payloadConfigPath: string;
10
14
  /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'` */
@@ -23,13 +27,15 @@ export type PayloadPluginOptions = {
23
27
  tanstackStart: NonNullable<Parameters<typeof tanstackStart>[0]>;
24
28
  };
25
29
  export type WithPayloadBuilderContext = {
26
- /** Payload's base Vite config; `plugins` holds Payload's workaround plugins only. */
27
- config: UserConfig;
28
30
  env: ConfigEnv;
29
31
  /** Options to pass to the `viteReact`/`rsc`/`tanstackStart` factories you import. */
30
32
  pluginOptions: PayloadPluginOptions;
31
33
  };
32
- /** Assembles the final Vite config from Payload's base config and plugin options. */
34
+ /**
35
+ * Returns the extra Vite config — the plugins you instantiate plus any overrides.
36
+ * `withPayload` deep-merges it onto Payload's base config, so you don't spread or
37
+ * merge the base yourself.
38
+ */
33
39
  export type WithPayloadBuilder = (context: WithPayloadBuilderContext) => UserConfig;
34
40
  /**
35
41
  * Vite config helper for Payload + TanStack Start; the counterpart to Next.js'
@@ -38,28 +44,28 @@ export type WithPayloadBuilder = (context: WithPayloadBuilderContext) => UserCon
38
44
  * Zero-config — Payload instantiates the RSC, React, and TanStack Start plugins:
39
45
  *
40
46
  * ```ts
41
- * export default withPayload({ payloadConfigPath: './src/payload.config.ts' })
47
+ * export default withPayload(undefined, { payloadConfigPath: './src/payload.config.ts' })
42
48
  * ```
43
49
  *
44
50
  * Guest mode — pass a `build` callback to instantiate them yourself (one copy of
45
- * each; `@vitejs/plugin-rsc` is a hard singleton):
51
+ * each; `@vitejs/plugin-rsc` is a hard singleton). Return only your additions;
52
+ * `withPayload` deep-merges them onto Payload's base config:
46
53
  *
47
54
  * ```ts
48
55
  * export default withPayload(
49
- * { payloadConfigPath: './src/payload.config.ts' },
50
- * ({ config, pluginOptions }) => ({
51
- * ...config,
56
+ * ({ pluginOptions }) => ({
52
57
  * plugins: [
53
- * ...config.plugins,
54
58
  * rsc(pluginOptions.rsc),
55
59
  * tanstackStart(pluginOptions.tanstackStart),
56
60
  * viteReact(pluginOptions.react),
57
61
  * ],
62
+ * // ...other config options
58
63
  * }),
64
+ * { payloadConfigPath: './src/payload.config.ts' },
59
65
  * )
60
66
  * ```
61
67
  */
62
- export declare function withPayload(options: WithPayloadOptions, build?: WithPayloadBuilder): UserConfigFnObject;
68
+ export declare function withPayload(build: undefined | WithPayloadBuilder, options: WithPayloadOptions): UserConfigFnObject;
63
69
  /** `@vitejs/plugin-rsc` options for Payload: `serverHandler: false` (TanStack owns the handler). */
64
70
  export declare function payloadRscOptions(): NonNullable<Parameters<typeof rsc>[0]>;
65
71
  /** `@vitejs/plugin-react` options for Payload: transform every `.[jt]sx?` file. */
@@ -67,6 +73,18 @@ export declare function payloadReactOptions(): NonNullable<Parameters<typeof vit
67
73
  export type PayloadTanstackStartOptionsArgs = {
68
74
  /** Additional import-protection `ignoreImporters` patterns. */
69
75
  additionalIgnoreImporters?: RegExp[];
76
+ /**
77
+ * Route id of Payload's admin layout route, eager-loaded (not code-split) so it
78
+ * hydrates on first paint. It and its children skip splitting; host routes keep
79
+ * TanStack's default. Defaults to `'/_payload'` (the `_payload.tsx` convention).
80
+ */
81
+ adminRouteId?: string;
82
+ /**
83
+ * Extra globs exempted from TanStack's `.client.*` SSR denial, on top of the
84
+ * default node_modules exemption. Needed only when Payload's own `.client.*`
85
+ * files resolve outside node_modules (e.g. the monorepo's `packages` sources).
86
+ */
87
+ clientDenialExcludeFiles?: string[];
70
88
  /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'`. */
71
89
  routesDirectory?: string;
72
90
  /** TanStack source directory. Defaults to `'src'`. */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/withPayload/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAwB,UAAU,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AAI3F,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AACjE,OAAO,SAAS,MAAM,sBAAsB,CAAA;AAC5C,OAAO,GAAG,MAAM,oBAAoB,CAAA;AA8DpC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,wFAAwF;IACxF,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAA;IACpC,yGAAyG;IACzG,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wGAAwG;IACxG,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,wDAAwD;IACxD,iBAAiB,EAAE,MAAM,CAAA;IACzB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yFAAyF;IACzF,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wFAAwF;IACxF,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED,wEAAwE;AACxE,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACnD,GAAG,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3C,aAAa,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAChE,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,SAAS,CAAA;IACd,qFAAqF;IACrF,aAAa,EAAE,oBAAoB,CAAA;CACpC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,yBAAyB,KAAK,UAAU,CAAA;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,GAAG,kBAAkB,EACrC,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,CAwHpB;AAED,oGAAoG;AACpG,wBAAgB,iBAAiB,IAAI,WAAW,CAAC,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAE1E;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,IAAI,WAAW,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAElF;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,+DAA+D;IAC/D,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAA;IACpC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,wFAAwF;IACxF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,GAAE,+BAAoC,GACzC,WAAW,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAwClD"}
@@ -1,9 +1,11 @@
1
+ // Optional peers, not deps: `plugin-rsc` is a singleton, so bundling our own copy
2
+ // alongside the host's would load two instances and crash.
1
3
  import { tanstackStart } from '@tanstack/react-start/plugin/vite';
2
4
  import viteReact from '@vitejs/plugin-react';
3
5
  import rsc from '@vitejs/plugin-rsc';
4
6
  import path from 'node:path';
5
7
  import { createLogger, mergeConfig } from 'vite';
6
- import { payloadNoExternalPatterns, ssrExternalPackages } from './config/external.js';
8
+ import { buildExternalPackages, payloadNoExternalPatterns, ssrExternalPackages } from './config/external.js';
7
9
  import { optimizeDepsExcludeDefaults, optimizeDepsIncludeDefaults } from './config/optimizeDeps.js';
8
10
  import { payloadScssImporters } from './config/scss.js';
9
11
  import { defaultImportProtectionIgnoreImporters, onImportProtectionViolation, serverOnlyClientSpecifiers } from './importProtection.js';
@@ -54,29 +56,48 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
54
56
  * Zero-config — Payload instantiates the RSC, React, and TanStack Start plugins:
55
57
  *
56
58
  * ```ts
57
- * export default withPayload({ payloadConfigPath: './src/payload.config.ts' })
59
+ * export default withPayload(undefined, { payloadConfigPath: './src/payload.config.ts' })
58
60
  * ```
59
61
  *
60
62
  * Guest mode — pass a `build` callback to instantiate them yourself (one copy of
61
- * each; `@vitejs/plugin-rsc` is a hard singleton):
63
+ * each; `@vitejs/plugin-rsc` is a hard singleton). Return only your additions;
64
+ * `withPayload` deep-merges them onto Payload's base config:
62
65
  *
63
66
  * ```ts
64
67
  * export default withPayload(
65
- * { payloadConfigPath: './src/payload.config.ts' },
66
- * ({ config, pluginOptions }) => ({
67
- * ...config,
68
+ * ({ pluginOptions }) => ({
68
69
  * plugins: [
69
- * ...config.plugins,
70
70
  * rsc(pluginOptions.rsc),
71
71
  * tanstackStart(pluginOptions.tanstackStart),
72
72
  * viteReact(pluginOptions.react),
73
73
  * ],
74
+ * // ...other config options
74
75
  * }),
76
+ * { payloadConfigPath: './src/payload.config.ts' },
75
77
  * )
76
78
  * ```
77
- */ export function withPayload(options, build) {
78
- const { additionalIgnoreImporters = [], payloadConfigPath, routesDirectory = 'app', silenceDependencyWarnings = true, srcDirectory = 'src', vite } = options;
79
+ */ export function withPayload(build, options) {
80
+ const { additionalIgnoreImporters = [], adminRouteId, clientDenialExcludeFiles = [], payloadConfigPath, routesDirectory = 'app', silenceDependencyWarnings = true, srcDirectory = 'src', vite } = options;
79
81
  return (env)=>{
82
+ // `pluralize` ships a UMD wrapper that throws when run through Vite's dev SSR
83
+ // transform, so dev serve keeps it external and lets Node require it.
84
+ // The production build must bundle it instead: it is reached from the
85
+ // force-bundled `@payloadcms/ui` / `@payloadcms/translations`, and Vite would
86
+ // otherwise externalize it into a client chunk as a bare specifier that pnpm
87
+ // can't resolve from `dist/` at runtime. Dropping it from the externals list
88
+ // isn't enough — Vite externalizes deps of `noExternal` packages by default,
89
+ // so it must be forced back in via `noExternal`.
90
+ const isBuild = env.command === 'build';
91
+ const noExternalPatterns = isBuild ? [
92
+ ...payloadNoExternalPatterns,
93
+ 'pluralize'
94
+ ] : payloadNoExternalPatterns;
95
+ // Dev serve externalizes the server-only Node packages (including `pluralize`,
96
+ // whose UMD wrapper breaks under Vite's SSR transform). The prod build instead
97
+ // externalizes the package boundaries (`buildExternalPackages`) and drops
98
+ // `pluralize` so it bundles — leaving it in `ssr.external` here would win over
99
+ // `noExternal` and re-emit the bare specifier.
100
+ const ssrExternal = isBuild ? buildExternalPackages : ssrExternalPackages;
80
101
  const base = {
81
102
  build: {
82
103
  cssMinify: 'esbuild'
@@ -99,21 +120,21 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
99
120
  rsc: {
100
121
  build: {
101
122
  rollupOptions: {
102
- external: ssrExternalPackages
123
+ external: buildExternalPackages
103
124
  }
104
125
  },
105
126
  resolve: {
106
- noExternal: payloadNoExternalPatterns
127
+ noExternal: noExternalPatterns
107
128
  }
108
129
  },
109
130
  ssr: {
110
131
  build: {
111
132
  rollupOptions: {
112
- external: ssrExternalPackages
133
+ external: buildExternalPackages
113
134
  }
114
135
  },
115
136
  resolve: {
116
- noExternal: payloadNoExternalPatterns
137
+ noExternal: noExternalPatterns
117
138
  }
118
139
  }
119
140
  },
@@ -158,8 +179,8 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
158
179
  tsconfigPaths: true
159
180
  },
160
181
  ssr: {
161
- external: ssrExternalPackages,
162
- noExternal: payloadNoExternalPatterns
182
+ external: ssrExternal,
183
+ noExternal: noExternalPatterns
163
184
  }
164
185
  };
165
186
  const pluginOptions = {
@@ -167,16 +188,17 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
167
188
  rsc: payloadRscOptions(),
168
189
  tanstackStart: payloadTanstackStartOptions({
169
190
  additionalIgnoreImporters,
191
+ adminRouteId,
192
+ clientDenialExcludeFiles,
170
193
  routesDirectory,
171
194
  srcDirectory
172
195
  })
173
196
  };
174
197
  if (build) {
175
- return applyDependencyWarningSuppression(build({
176
- config: base,
198
+ return applyDependencyWarningSuppression(mergeConfig(base, build({
177
199
  env,
178
200
  pluginOptions
179
- }), silenceDependencyWarnings);
201
+ })), silenceDependencyWarnings);
180
202
  }
181
203
  base.plugins = [
182
204
  ...base.plugins,
@@ -204,11 +226,8 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
204
226
  * code-splitting). TanStack Start is one-per-app, so a host that already runs it
205
227
  * should merge these into its single `tanstackStart` call.
206
228
  */ export function payloadTanstackStartOptions(args = {}) {
207
- const { additionalIgnoreImporters = [], routesDirectory = 'app', srcDirectory = 'src' } = args;
229
+ const { additionalIgnoreImporters = [], adminRouteId = '/_payload', clientDenialExcludeFiles = [], routesDirectory = 'app', srcDirectory = 'src' } = args;
208
230
  return {
209
- // No `server` rule: keep TanStack's default `.client.*` SSR protection for
210
- // host files. Payload's own `.client.*` are exempted in
211
- // `onImportProtectionViolation`.
212
231
  importProtection: {
213
232
  client: {
214
233
  excludeFiles: [],
@@ -222,17 +241,26 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
222
241
  '**/*'
223
242
  ],
224
243
  mockAccess: 'warn',
225
- onViolation: onImportProtectionViolation
244
+ onViolation: onImportProtectionViolation,
245
+ // Payload's `.client.*` components are React Client Components that must be
246
+ // server-rendered during SSR; TanStack's default `**/*.client.*` server
247
+ // denial would mock and crash them. All such files live in `@payloadcms/*`
248
+ // packages, so keep the denial (host `.client.*` files still get it) and
249
+ // just exempt Payload's — `node_modules` covers published installs.
250
+ server: {
251
+ excludeFiles: [
252
+ '**/node_modules/**',
253
+ ...clientDenialExcludeFiles
254
+ ]
255
+ }
226
256
  },
227
- // Disable per-route code-splitting so route components ship in the initial
228
- // bundle and hydrate on first paint — otherwise the admin renders but isn't
229
- // interactive until each lazy `?tsr-split=` chunk lands. `defaultBehavior:
230
- // []` is the knob the splitter actually honours; `autoCodeSplitting: false`
231
- // is a belt-and-braces signal (the plugin's schema strips it).
232
257
  router: {
233
- autoCodeSplitting: false,
234
258
  codeSplittingOptions: {
235
- defaultBehavior: []
259
+ // Eager-load only Payload's admin routes so they hydrate on first paint —
260
+ // a split admin renders but isn't interactive until its lazy `?tsr-split=`
261
+ // chunk lands. Returning `[]` disables splitting for a route; `undefined`
262
+ // lets host routes keep TanStack's default per-route splitting.
263
+ splitBehavior: ({ routeId })=>routeId === adminRouteId || routeId.startsWith(`${adminRouteId}/`) ? [] : undefined
236
264
  },
237
265
  // Ignore generated importMap files and colocated `*.functions.ts` modules
238
266
  // (they define `createServerFn`s, not routes).
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/withPayload/index.ts"],"sourcesContent":["import type { ConfigEnv, Logger, PluginOption, UserConfig, UserConfigFnObject } from 'vite'\n\n// Optional peers, not deps: `plugin-rsc` is a singleton, so bundling our own copy\n// alongside the host's would load two instances and crash.\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 { createLogger, mergeConfig } from 'vite'\n\nimport {\n buildExternalPackages,\n payloadNoExternalPatterns,\n ssrExternalPackages,\n} from './config/external.js'\nimport { optimizeDepsExcludeDefaults, optimizeDepsIncludeDefaults } from './config/optimizeDeps.js'\nimport { payloadScssImporters } from './config/scss.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 { stubPrettierInClient } from './workarounds/stubPrettierInClient.js'\nimport { wrapCjsForClient } from './workarounds/wrapCjsForClient.js'\n\n/**\n * Vite dependency warnings Payload consumers can't act on: third-party packages\n * ship sourcemaps whose original sources aren't published, so Vite warns on\n * every one. Suppressed by default (see `silenceDependencyWarnings`).\n */\nconst suppressibleWarningPatterns = ['points to missing source files', 'Sourcemap for']\n\n/**\n * Wraps a Vite logger so warnings matching {@link suppressibleWarningPatterns}\n * are dropped. Mutates and returns the given logger (or a fresh default one).\n */\nfunction withQuietedDependencyWarnings(existing?: Logger): Logger {\n const logger = existing ?? createLogger()\n const shouldSuppress = (msg: unknown): boolean =>\n typeof msg === 'string' && suppressibleWarningPatterns.some((pattern) => msg.includes(pattern))\n\n const baseWarn = logger.warn.bind(logger)\n const baseWarnOnce = logger.warnOnce.bind(logger)\n logger.warn = (msg, options) => {\n if (!shouldSuppress(msg)) {\n baseWarn(msg, options)\n }\n }\n logger.warnOnce = (msg, options) => {\n if (!shouldSuppress(msg)) {\n baseWarnOnce(msg, options)\n }\n }\n return logger\n}\n\n/** Applies dependency-warning suppression to a config in place when enabled. */\nfunction applyDependencyWarningSuppression(config: UserConfig, enabled: boolean): UserConfig {\n if (enabled) {\n config.customLogger = withQuietedDependencyWarnings(config.customLogger)\n }\n return config\n}\n\nexport type WithPayloadOptions = {\n /** Extra import-protection `ignoreImporters` patterns for the TanStack Start plugin. */\n additionalIgnoreImporters?: RegExp[]\n /** Route id of Payload's admin layout, eager-loaded instead of code-split. Defaults to `'/_payload'`. */\n adminRouteId?: string\n /** Extra globs exempted from the `.client.*` SSR denial (beyond the default node_modules exemption). */\n clientDenialExcludeFiles?: string[]\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 /** Silence Vite warnings about third-party dependency sourcemaps. Defaults to `true`. */\n silenceDependencyWarnings?: boolean\n /** TanStack source directory. Defaults to `'src'` */\n srcDirectory?: string\n /** Extra Vite config deep-merged over the Payload defaults. Ignored in `build` mode. */\n vite?: UserConfig\n}\n\n/** The options Payload's admin requires for each third-party plugin. */\nexport type PayloadPluginOptions = {\n react: NonNullable<Parameters<typeof viteReact>[0]>\n rsc: NonNullable<Parameters<typeof rsc>[0]>\n tanstackStart: NonNullable<Parameters<typeof tanstackStart>[0]>\n}\n\nexport type WithPayloadBuilderContext = {\n env: ConfigEnv\n /** Options to pass to the `viteReact`/`rsc`/`tanstackStart` factories you import. */\n pluginOptions: PayloadPluginOptions\n}\n\n/**\n * Returns the extra Vite config — the plugins you instantiate plus any overrides.\n * `withPayload` deep-merges it onto Payload's base config, so you don't spread or\n * merge the base yourself.\n */\nexport type WithPayloadBuilder = (context: WithPayloadBuilderContext) => UserConfig\n\n/**\n * Vite config helper for Payload + TanStack Start; the counterpart to Next.js'\n * `withPayload`.\n *\n * Zero-config — Payload instantiates the RSC, React, and TanStack Start plugins:\n *\n * ```ts\n * export default withPayload(undefined, { payloadConfigPath: './src/payload.config.ts' })\n * ```\n *\n * Guest mode — pass a `build` callback to instantiate them yourself (one copy of\n * each; `@vitejs/plugin-rsc` is a hard singleton). Return only your additions;\n * `withPayload` deep-merges them onto Payload's base config:\n *\n * ```ts\n * export default withPayload(\n * ({ pluginOptions }) => ({\n * plugins: [\n * rsc(pluginOptions.rsc),\n * tanstackStart(pluginOptions.tanstackStart),\n * viteReact(pluginOptions.react),\n * ],\n * // ...other config options\n * }),\n * { payloadConfigPath: './src/payload.config.ts' },\n * )\n * ```\n */\nexport function withPayload(\n build: undefined | WithPayloadBuilder,\n options: WithPayloadOptions,\n): UserConfigFnObject {\n const {\n additionalIgnoreImporters = [],\n adminRouteId,\n clientDenialExcludeFiles = [],\n payloadConfigPath,\n routesDirectory = 'app',\n silenceDependencyWarnings = true,\n srcDirectory = 'src',\n vite,\n } = options\n\n return (env) => {\n // `pluralize` ships a UMD wrapper that throws when run through Vite's dev SSR\n // transform, so dev serve keeps it external and lets Node require it.\n // The production build must bundle it instead: it is reached from the\n // force-bundled `@payloadcms/ui` / `@payloadcms/translations`, and Vite would\n // otherwise externalize it into a client chunk as a bare specifier that pnpm\n // can't resolve from `dist/` at runtime. Dropping it from the externals list\n // isn't enough — Vite externalizes deps of `noExternal` packages by default,\n // so it must be forced back in via `noExternal`.\n const isBuild = env.command === 'build'\n const noExternalPatterns = isBuild\n ? [...payloadNoExternalPatterns, 'pluralize']\n : payloadNoExternalPatterns\n // Dev serve externalizes the server-only Node packages (including `pluralize`,\n // whose UMD wrapper breaks under Vite's SSR transform). The prod build instead\n // externalizes the package boundaries (`buildExternalPackages`) and drops\n // `pluralize` so it bundles — leaving it in `ssr.external` here would win over\n // `noExternal` and re-emit the bare specifier.\n const ssrExternal = isBuild ? buildExternalPackages : ssrExternalPackages\n\n const base: UserConfig = {\n build: {\n cssMinify: 'esbuild',\n },\n css: {\n preprocessorOptions: {\n scss: {\n importers: payloadScssImporters,\n silenceDeprecations: ['import', 'global-builtin'],\n } as any,\n },\n },\n define: {\n global: 'globalThis',\n },\n environments: {\n rsc: {\n build: { rollupOptions: { external: buildExternalPackages } },\n resolve: { noExternal: noExternalPatterns },\n },\n ssr: {\n build: { rollupOptions: { external: buildExternalPackages } },\n resolve: { noExternal: noExternalPatterns },\n },\n } as any,\n optimizeDeps: {\n exclude: optimizeDepsExcludeDefaults,\n include: optimizeDepsIncludeDefaults,\n },\n // Payload's internal workaround plugins only. The RSC, TanStack Start, and\n // React plugins are appended below (default form) or by the consumer's\n // `build` callback (guest form).\n plugins: [\n clientModuleResolution(),\n wrapCjsForClient(),\n ssrStripDistStyleImports(),\n reactDomServerInRsc(),\n stubPrettierInClient(),\n payloadDevTransforms(),\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: ssrExternal,\n noExternal: noExternalPatterns,\n },\n }\n\n const pluginOptions: PayloadPluginOptions = {\n react: payloadReactOptions(),\n rsc: payloadRscOptions(),\n tanstackStart: payloadTanstackStartOptions({\n additionalIgnoreImporters,\n adminRouteId,\n clientDenialExcludeFiles,\n routesDirectory,\n srcDirectory,\n }),\n }\n\n if (build) {\n return applyDependencyWarningSuppression(\n mergeConfig(base, build({ env, pluginOptions })),\n silenceDependencyWarnings,\n )\n }\n\n base.plugins = [\n ...(base.plugins as PluginOption[]),\n rsc(pluginOptions.rsc),\n tanstackStart(pluginOptions.tanstackStart),\n viteReact(pluginOptions.react),\n ]\n\n const merged = vite ? mergeConfig(base, vite) : base\n\n return applyDependencyWarningSuppression(merged, silenceDependencyWarnings)\n }\n}\n\n/** `@vitejs/plugin-rsc` options for Payload: `serverHandler: false` (TanStack owns the handler). */\nexport function payloadRscOptions(): NonNullable<Parameters<typeof rsc>[0]> {\n return { serverHandler: false }\n}\n\n/** `@vitejs/plugin-react` options for Payload: transform every `.[jt]sx?` file. */\nexport function payloadReactOptions(): NonNullable<Parameters<typeof viteReact>[0]> {\n return { exclude: [], include: /\\.[jt]sx?$/ }\n}\n\nexport type PayloadTanstackStartOptionsArgs = {\n /** Additional import-protection `ignoreImporters` patterns. */\n additionalIgnoreImporters?: RegExp[]\n /**\n * Route id of Payload's admin layout route, eager-loaded (not code-split) so it\n * hydrates on first paint. It and its children skip splitting; host routes keep\n * TanStack's default. Defaults to `'/_payload'` (the `_payload.tsx` convention).\n */\n adminRouteId?: string\n /**\n * Extra globs exempted from TanStack's `.client.*` SSR denial, on top of the\n * default node_modules exemption. Needed only when Payload's own `.client.*`\n * files resolve outside node_modules (e.g. the monorepo's `packages` sources).\n */\n clientDenialExcludeFiles?: 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\n/**\n * The `tanstackStart` options Payload's admin requires (import-protection and\n * code-splitting). TanStack Start is one-per-app, so a host that already runs it\n * should merge these into its single `tanstackStart` call.\n */\nexport function payloadTanstackStartOptions(\n args: PayloadTanstackStartOptionsArgs = {},\n): NonNullable<Parameters<typeof tanstackStart>[0]> {\n const {\n additionalIgnoreImporters = [],\n adminRouteId = '/_payload',\n clientDenialExcludeFiles = [],\n routesDirectory = 'app',\n srcDirectory = 'src',\n } = args\n\n return {\n importProtection: {\n client: { excludeFiles: [], specifiers: serverOnlyClientSpecifiers },\n ignoreImporters: [...defaultImportProtectionIgnoreImporters, ...additionalIgnoreImporters],\n include: ['**/*'],\n mockAccess: 'warn',\n onViolation: onImportProtectionViolation,\n // Payload's `.client.*` components are React Client Components that must be\n // server-rendered during SSR; TanStack's default `**/*.client.*` server\n // denial would mock and crash them. All such files live in `@payloadcms/*`\n // packages, so keep the denial (host `.client.*` files still get it) and\n // just exempt Payload's — `node_modules` covers published installs.\n server: { excludeFiles: ['**/node_modules/**', ...clientDenialExcludeFiles] },\n },\n router: {\n codeSplittingOptions: {\n // Eager-load only Payload's admin routes so they hydrate on first paint —\n // a split admin renders but isn't interactive until its lazy `?tsr-split=`\n // chunk lands. Returning `[]` disables splitting for a route; `undefined`\n // lets host routes keep TanStack's default per-route splitting.\n splitBehavior: ({ routeId }: { routeId: string }) =>\n routeId === adminRouteId || routeId.startsWith(`${adminRouteId}/`) ? [] : undefined,\n },\n // Ignore generated importMap files and colocated `*.functions.ts` modules\n // (they define `createServerFn`s, not routes).\n routeFileIgnorePattern: 'importMap\\\\.(?:js|server\\\\.ts)$|\\\\.functions\\\\.',\n routesDirectory,\n } as any,\n rsc: { enabled: true },\n srcDirectory,\n }\n}\n"],"names":["tanstackStart","viteReact","rsc","path","createLogger","mergeConfig","buildExternalPackages","payloadNoExternalPatterns","ssrExternalPackages","optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults","payloadScssImporters","defaultImportProtectionIgnoreImporters","onImportProtectionViolation","serverOnlyClientSpecifiers","clientModuleResolution","payloadDevTransforms","reactDomServerInRsc","ssrStripDistStyleImports","stubPrettierInClient","wrapCjsForClient","suppressibleWarningPatterns","withQuietedDependencyWarnings","existing","logger","shouldSuppress","msg","some","pattern","includes","baseWarn","warn","bind","baseWarnOnce","warnOnce","options","applyDependencyWarningSuppression","config","enabled","customLogger","withPayload","build","additionalIgnoreImporters","adminRouteId","clientDenialExcludeFiles","payloadConfigPath","routesDirectory","silenceDependencyWarnings","srcDirectory","vite","env","isBuild","command","noExternalPatterns","ssrExternal","base","cssMinify","css","preprocessorOptions","scss","importers","silenceDeprecations","define","global","environments","rollupOptions","external","resolve","noExternal","ssr","optimizeDeps","exclude","include","plugins","alias","find","replacement","dedupe","extensions","tsconfigPaths","pluginOptions","react","payloadReactOptions","payloadRscOptions","payloadTanstackStartOptions","merged","serverHandler","args","importProtection","client","excludeFiles","specifiers","ignoreImporters","mockAccess","onViolation","server","router","codeSplittingOptions","splitBehavior","routeId","startsWith","undefined","routeFileIgnorePattern"],"mappings":"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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientModuleResolution.d.ts","sourceRoot":"","sources":["../../../src/withPayload/workarounds/clientModuleResolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAKxC;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,YAAY,CA+ErD"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/withPayload/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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devTransforms.d.ts","sourceRoot":"","sources":["../../../src/withPayload/workarounds/devTransforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,YAAY,CAgEnD"}