@payloadcms/tanstack-start 4.0.0-internal.e7d4ebc → 4.0.0-internal.ea6e8f8

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 (220) hide show
  1. package/dist/adapters/handleServerFunctions.d.ts.map +1 -0
  2. package/dist/adapters/handleServerFunctions.js +9 -0
  3. package/dist/adapters/handleServerFunctions.js.map +1 -0
  4. package/dist/{layouts/Root/withPayloadRoot.d.ts → adapters/layout/index.d.ts} +29 -4
  5. package/dist/adapters/layout/index.d.ts.map +1 -0
  6. package/dist/adapters/layout/index.js +105 -0
  7. package/dist/adapters/layout/index.js.map +1 -0
  8. package/dist/adapters/layout/lazy.d.ts +11 -0
  9. package/dist/adapters/layout/lazy.d.ts.map +1 -0
  10. package/dist/adapters/layout/lazy.js +23 -0
  11. package/dist/adapters/layout/lazy.js.map +1 -0
  12. package/dist/adapters/layout/server.d.ts +29 -0
  13. package/dist/adapters/layout/server.d.ts.map +1 -0
  14. package/dist/adapters/layout/server.js +63 -0
  15. package/dist/adapters/layout/server.js.map +1 -0
  16. package/dist/{utilities/meta.d.ts → adapters/metadata.d.ts} +10 -1
  17. package/dist/adapters/metadata.d.ts.map +1 -0
  18. package/dist/{utilities/meta.js → adapters/metadata.js} +60 -1
  19. package/dist/adapters/metadata.js.map +1 -0
  20. package/dist/{elements/RouterAdapter/index.d.ts → adapters/router.d.ts} +1 -1
  21. package/dist/adapters/router.d.ts.map +1 -0
  22. package/dist/{elements/RouterAdapter/index.js → adapters/router.js} +26 -4
  23. package/dist/adapters/router.js.map +1 -0
  24. package/dist/{utilities/serverAdapter.server.d.ts → adapters/server.d.ts} +1 -1
  25. package/dist/adapters/server.d.ts.map +1 -0
  26. package/dist/{utilities/serverAdapter.server.js → adapters/server.js} +1 -1
  27. package/dist/adapters/server.js.map +1 -0
  28. package/dist/{routes/adminRoutes.d.ts → adapters/views/index.d.ts} +11 -18
  29. package/dist/adapters/views/index.d.ts.map +1 -0
  30. package/dist/{routes/adminRoutes.js → adapters/views/index.js} +33 -58
  31. package/dist/adapters/views/index.js.map +1 -0
  32. package/dist/adapters/views/lazy.d.ts +4 -0
  33. package/dist/adapters/views/lazy.d.ts.map +1 -0
  34. package/dist/adapters/views/lazy.js +43 -0
  35. package/dist/adapters/views/lazy.js.map +1 -0
  36. package/dist/{utilities/loadAdminPage.d.ts → adapters/views/server.d.ts} +9 -6
  37. package/dist/adapters/views/server.d.ts.map +1 -0
  38. package/dist/{utilities/loadAdminPage.js → adapters/views/server.js} +15 -86
  39. package/dist/adapters/views/server.js.map +1 -0
  40. package/dist/auth/login.d.ts +3 -16
  41. package/dist/auth/login.d.ts.map +1 -1
  42. package/dist/auth/login.js +6 -46
  43. package/dist/auth/login.js.map +1 -1
  44. package/dist/auth/logout.d.ts +2 -5
  45. package/dist/auth/logout.d.ts.map +1 -1
  46. package/dist/auth/logout.js +6 -47
  47. package/dist/auth/logout.js.map +1 -1
  48. package/dist/auth/refresh.d.ts +2 -4
  49. package/dist/auth/refresh.d.ts.map +1 -1
  50. package/dist/auth/refresh.js +6 -49
  51. package/dist/auth/refresh.js.map +1 -1
  52. package/dist/exports/client.d.ts +2 -6
  53. package/dist/exports/client.d.ts.map +1 -1
  54. package/dist/exports/client.js +2 -6
  55. package/dist/exports/client.js.map +1 -1
  56. package/dist/exports/layouts.d.ts +2 -5
  57. package/dist/exports/layouts.d.ts.map +1 -1
  58. package/dist/exports/layouts.js +1 -3
  59. package/dist/exports/layouts.js.map +1 -1
  60. package/dist/exports/rsc.browser.d.ts +4 -1
  61. package/dist/exports/rsc.browser.d.ts.map +1 -1
  62. package/dist/exports/rsc.browser.js +4 -1
  63. package/dist/exports/rsc.browser.js.map +1 -1
  64. package/dist/exports/rsc.d.ts +0 -1
  65. package/dist/exports/rsc.d.ts.map +1 -1
  66. package/dist/exports/rsc.js +0 -1
  67. package/dist/exports/rsc.js.map +1 -1
  68. package/dist/exports/server.d.ts +8 -11
  69. package/dist/exports/server.d.ts.map +1 -1
  70. package/dist/exports/server.js +7 -10
  71. package/dist/exports/server.js.map +1 -1
  72. package/dist/{utilities/graphqlHandler.server.d.ts → routes/graphql/handler.server.d.ts} +1 -3
  73. package/dist/routes/graphql/handler.server.d.ts.map +1 -0
  74. package/dist/{utilities/graphqlHandler.server.js → routes/graphql/handler.server.js} +9 -6
  75. package/dist/routes/graphql/handler.server.js.map +1 -0
  76. package/dist/{utilities/handleAPIRoute.server.d.ts → routes/rest/handler.server.d.ts} +1 -1
  77. package/dist/routes/rest/handler.server.d.ts.map +1 -0
  78. package/dist/{utilities/handleAPIRoute.server.js → routes/rest/handler.server.js} +1 -1
  79. package/dist/routes/rest/handler.server.js.map +1 -0
  80. package/dist/routes/{apiRoute.d.ts → rest/index.d.ts} +1 -1
  81. package/dist/routes/rest/index.d.ts.map +1 -0
  82. package/dist/routes/{apiRoute.js → rest/index.js} +2 -2
  83. package/dist/routes/rest/index.js.map +1 -0
  84. package/dist/rsc/CollectionCards.js +1 -1
  85. package/dist/rsc/CollectionCards.js.map +1 -1
  86. package/dist/utilities/devConfigReload.server.d.ts +2 -0
  87. package/dist/utilities/devConfigReload.server.d.ts.map +1 -0
  88. package/dist/utilities/devConfigReload.server.js +63 -0
  89. package/dist/utilities/devConfigReload.server.js.map +1 -0
  90. package/dist/utilities/devConfigReloadEvent.d.ts +9 -0
  91. package/dist/utilities/devConfigReloadEvent.d.ts.map +1 -0
  92. package/dist/utilities/devConfigReloadEvent.js +9 -0
  93. package/dist/utilities/devConfigReloadEvent.js.map +1 -0
  94. package/dist/utilities/getRequestI18n.server.d.ts +1 -1
  95. package/dist/utilities/getRequestI18n.server.js +1 -1
  96. package/dist/utilities/getRequestI18n.server.js.map +1 -1
  97. package/dist/utilities/initAdminContext.server.d.ts +9 -0
  98. package/dist/utilities/initAdminContext.server.d.ts.map +1 -0
  99. package/dist/utilities/initAdminContext.server.js +13 -0
  100. package/dist/utilities/initAdminContext.server.js.map +1 -0
  101. package/dist/utilities/serializeForRsc.d.ts.map +1 -1
  102. package/dist/utilities/serializeForRsc.js +6 -1
  103. package/dist/utilities/serializeForRsc.js.map +1 -1
  104. package/dist/utilities/serverFunctionClient.d.ts.map +1 -1
  105. package/dist/utilities/serverFunctionClient.js +6 -1
  106. package/dist/utilities/serverFunctionClient.js.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 +19 -3
  110. package/dist/utilities/toSerializable.js.map +1 -1
  111. package/dist/withPayload/config/external.d.ts +16 -8
  112. package/dist/withPayload/config/external.d.ts.map +1 -1
  113. package/dist/withPayload/config/external.js +24 -10
  114. package/dist/withPayload/config/external.js.map +1 -1
  115. package/dist/withPayload/config/optimizeDeps.d.ts.map +1 -1
  116. package/dist/withPayload/config/optimizeDeps.js +44 -7
  117. package/dist/withPayload/config/optimizeDeps.js.map +1 -1
  118. package/dist/withPayload/devConfigReload.d.ts +14 -0
  119. package/dist/withPayload/devConfigReload.d.ts.map +1 -0
  120. package/dist/withPayload/devConfigReload.js +84 -0
  121. package/dist/withPayload/devConfigReload.js.map +1 -0
  122. package/dist/withPayload/importProtection.d.ts.map +1 -1
  123. package/dist/withPayload/importProtection.js +2 -2
  124. package/dist/withPayload/importProtection.js.map +1 -1
  125. package/dist/withPayload/index.d.ts +21 -10
  126. package/dist/withPayload/index.d.ts.map +1 -1
  127. package/dist/withPayload/index.js +39 -16
  128. package/dist/withPayload/index.js.map +1 -1
  129. package/dist/withPayload/workarounds/stripDistStyleImports.js +2 -2
  130. package/dist/withPayload/workarounds/stripDistStyleImports.js.map +1 -1
  131. package/package.json +15 -12
  132. package/dist/elements/DocumentHeaderClient/index.d.ts +0 -16
  133. package/dist/elements/DocumentHeaderClient/index.d.ts.map +0 -1
  134. package/dist/elements/DocumentHeaderClient/index.js +0 -116
  135. package/dist/elements/DocumentHeaderClient/index.js.map +0 -1
  136. package/dist/elements/RenderComponent/index.d.ts +0 -10
  137. package/dist/elements/RenderComponent/index.d.ts.map +0 -1
  138. package/dist/elements/RenderComponent/index.js +0 -12
  139. package/dist/elements/RenderComponent/index.js.map +0 -1
  140. package/dist/elements/RouterAdapter/index.d.ts.map +0 -1
  141. package/dist/elements/RouterAdapter/index.js.map +0 -1
  142. package/dist/layouts/Root/getLayoutData.d.ts +0 -12
  143. package/dist/layouts/Root/getLayoutData.d.ts.map +0 -1
  144. package/dist/layouts/Root/getLayoutData.js +0 -91
  145. package/dist/layouts/Root/getLayoutData.js.map +0 -1
  146. package/dist/layouts/Root/index.d.ts +0 -32
  147. package/dist/layouts/Root/index.d.ts.map +0 -1
  148. package/dist/layouts/Root/index.js +0 -53
  149. package/dist/layouts/Root/index.js.map +0 -1
  150. package/dist/layouts/Root/withPayloadRoot.d.ts.map +0 -1
  151. package/dist/layouts/Root/withPayloadRoot.js +0 -91
  152. package/dist/layouts/Root/withPayloadRoot.js.map +0 -1
  153. package/dist/node/cssLoader.d.mts +0 -25
  154. package/dist/node/cssLoader.d.mts.map +0 -1
  155. package/dist/node/cssLoader.js +0 -70
  156. package/dist/node/cssLoader.js.map +0 -1
  157. package/dist/node/cssLoader.mjs +0 -75
  158. package/dist/node/registerCssLoader.d.mts +0 -2
  159. package/dist/node/registerCssLoader.d.mts.map +0 -1
  160. package/dist/node/registerCssLoader.js +0 -10
  161. package/dist/node/registerCssLoader.js.map +0 -1
  162. package/dist/node/registerCssLoader.mjs +0 -10
  163. package/dist/routes/adminRoutes.d.ts.map +0 -1
  164. package/dist/routes/adminRoutes.js.map +0 -1
  165. package/dist/routes/apiRoute.d.ts.map +0 -1
  166. package/dist/routes/apiRoute.js.map +0 -1
  167. package/dist/routes/layoutRoute.d.ts +0 -26
  168. package/dist/routes/layoutRoute.d.ts.map +0 -1
  169. package/dist/routes/layoutRoute.js +0 -57
  170. package/dist/routes/layoutRoute.js.map +0 -1
  171. package/dist/rsc/renderPayloadRSC.d.ts +0 -6
  172. package/dist/rsc/renderPayloadRSC.d.ts.map +0 -1
  173. package/dist/rsc/renderPayloadRSC.js +0 -6
  174. package/dist/rsc/renderPayloadRSC.js.map +0 -1
  175. package/dist/utilities/devReloadStrategy.d.ts +0 -10
  176. package/dist/utilities/devReloadStrategy.d.ts.map +0 -1
  177. package/dist/utilities/devReloadStrategy.js +0 -27
  178. package/dist/utilities/devReloadStrategy.js.map +0 -1
  179. package/dist/utilities/getExistingAuthToken.d.ts +0 -7
  180. package/dist/utilities/getExistingAuthToken.d.ts.map +0 -1
  181. package/dist/utilities/getExistingAuthToken.js +0 -18
  182. package/dist/utilities/getExistingAuthToken.js.map +0 -1
  183. package/dist/utilities/getPreferences.d.ts +0 -10
  184. package/dist/utilities/getPreferences.d.ts.map +0 -1
  185. package/dist/utilities/getPreferences.js +0 -33
  186. package/dist/utilities/getPreferences.js.map +0 -1
  187. package/dist/utilities/getRequestLocale.d.ts +0 -7
  188. package/dist/utilities/getRequestLocale.d.ts.map +0 -1
  189. package/dist/utilities/getRequestLocale.js +0 -20
  190. package/dist/utilities/getRequestLocale.js.map +0 -1
  191. package/dist/utilities/graphqlHandler.server.d.ts.map +0 -1
  192. package/dist/utilities/graphqlHandler.server.js.map +0 -1
  193. package/dist/utilities/handleAPIRoute.server.d.ts.map +0 -1
  194. package/dist/utilities/handleAPIRoute.server.js.map +0 -1
  195. package/dist/utilities/handleServerFunctions.d.ts.map +0 -1
  196. package/dist/utilities/handleServerFunctions.js +0 -12
  197. package/dist/utilities/handleServerFunctions.js.map +0 -1
  198. package/dist/utilities/importMap.server.d.ts +0 -8
  199. package/dist/utilities/importMap.server.d.ts.map +0 -1
  200. package/dist/utilities/importMap.server.js +0 -11
  201. package/dist/utilities/importMap.server.js.map +0 -1
  202. package/dist/utilities/initReq.server.d.ts +0 -19
  203. package/dist/utilities/initReq.server.d.ts.map +0 -1
  204. package/dist/utilities/initReq.server.js +0 -87
  205. package/dist/utilities/initReq.server.js.map +0 -1
  206. package/dist/utilities/loadAdminPage.d.ts.map +0 -1
  207. package/dist/utilities/loadAdminPage.js.map +0 -1
  208. package/dist/utilities/loadLayoutData.d.ts +0 -15
  209. package/dist/utilities/loadLayoutData.d.ts.map +0 -1
  210. package/dist/utilities/loadLayoutData.js +0 -23
  211. package/dist/utilities/loadLayoutData.js.map +0 -1
  212. package/dist/utilities/meta.d.ts.map +0 -1
  213. package/dist/utilities/meta.js.map +0 -1
  214. package/dist/utilities/serverAdapter.server.d.ts.map +0 -1
  215. package/dist/utilities/serverAdapter.server.js.map +0 -1
  216. package/dist/utilities/setPayloadAuthCookie.d.ts +0 -9
  217. package/dist/utilities/setPayloadAuthCookie.d.ts.map +0 -1
  218. package/dist/utilities/setPayloadAuthCookie.js +0 -31
  219. package/dist/utilities/setPayloadAuthCookie.js.map +0 -1
  220. /package/dist/{utilities → adapters}/handleServerFunctions.d.ts +0 -0
@@ -25,9 +25,45 @@
25
25
  // server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev
26
26
  // server with a `MISSING_EXPORT` error before any test runs.
27
27
  '@azure/storage-blob',
28
+ // Preserve RSC client boundaries on storage admin upload handlers.
29
+ '@payloadcms/storage-azure',
30
+ '@payloadcms/storage-r2',
31
+ '@payloadcms/storage-vercel-blob',
28
32
  '@aws-sdk/client-s3',
29
33
  '@aws-sdk/s3-request-presigner',
30
- '@google-cloud/storage'
34
+ '@google-cloud/storage',
35
+ // Packages whose admin component barrel re-exports `'use client'` modules
36
+ // without carrying the directive itself. Pre-bundling one puts those modules
37
+ // in the optimized dep chunk *and* in the `rsc` environment as client
38
+ // references, which `@vitejs/plugin-rsc` warns about ("client component
39
+ // dependency is inconsistently optimized") once per component. Barrels that
40
+ // start with `'use client'` (e.g. `richtext-lexical`, `plugin-stripe`) don't
41
+ // warn and stay pre-bundled. Only shows up in published installs; workspace
42
+ // source is never pre-bundled.
43
+ '@payloadcms/plugin-cloud-storage',
44
+ '@payloadcms/plugin-ecommerce',
45
+ '@payloadcms/plugin-form-builder',
46
+ '@payloadcms/plugin-import-export',
47
+ '@payloadcms/plugin-multi-tenant',
48
+ '@payloadcms/plugin-search',
49
+ '@payloadcms/plugin-sentry',
50
+ '@payloadcms/plugin-seo',
51
+ // Database adapters and their drivers. The client scan reaches them through the
52
+ // Payload config (it follows server functions' `import('@payload-config')`
53
+ // without TanStack's server-fn stripping), so Vite would pre-bundle the whole
54
+ // driver for a browser that never loads it. Mongoose 9 has no browser build, so
55
+ // that bundles `mongodb`, whose optional `@aws-sdk/credential-providers` peer —
56
+ // when linked, as in the monorepo via `@payloadcms/payload-cloud` — fails the
57
+ // same `MISSING_EXPORT` way. Published installs reach the adapter packages;
58
+ // the monorepo, which resolves them to source, reaches the drivers.
59
+ '@payloadcms/db-d1-sqlite',
60
+ '@payloadcms/db-mongodb',
61
+ '@payloadcms/db-postgres',
62
+ '@payloadcms/db-sqlite',
63
+ '@payloadcms/db-vercel-postgres',
64
+ '@payloadcms/drizzle',
65
+ 'mongodb',
66
+ 'mongoose'
31
67
  ];
32
68
  /**
33
69
  * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
@@ -91,16 +127,16 @@
91
127
  '@payloadcms/ui > react-select > prop-types > react-is',
92
128
  '@payloadcms/ui > date-fns/locale/en-US',
93
129
  // Further late discoveries observed re-optimizing mid-run in CI cold starts
94
- // (see CI logs: "✨ new dependencies optimized: @dnd-kit/modifiers / ajv /
130
+ // (see CI logs: "✨ new dependencies optimized: @dnd-kit/modifiers / zod /
95
131
  // dequal/lite"). The modular dashboard pulls in `@dnd-kit/modifiers` on first
96
132
  // render; form-state diffing reaches `dequal/lite` (a distinct entry point
97
133
  // from the already-listed `dequal`); client-side field validation reaches
98
- // `ajv` *through `payload`* — it is `ssrExternal` server-side but still
134
+ // `zod` *through `payload`* — it is `ssrExternal` server-side but still
99
135
  // bundled into the client, and must be pathed via `payload` so the optimizer
100
136
  // pre-bundles the exact copy the runtime loads.
101
137
  '@payloadcms/ui > @dnd-kit/modifiers',
102
138
  '@payloadcms/ui > dequal/lite',
103
- 'payload > ajv',
139
+ 'payload > zod',
104
140
  // The storage client-upload suites (esp. vercel-blob) crawl part of the
105
141
  // `payload` server runtime into the client bundle and discover these late,
106
142
  // triggering several "optimized dependencies changed. reloading" waves that
@@ -113,11 +149,12 @@
113
149
  'payload > path-to-regexp',
114
150
  'payload > console-table-printer',
115
151
  'payload > ci-info',
116
- 'payload > image-size',
117
- 'payload > image-size/fromFile',
152
+ 'payload > image-dimensions',
118
153
  'payload > ipaddr.js',
119
154
  'payload > range-parser',
120
- 'payload > sanitize-filename'
155
+ 'payload > sanitize-filename',
156
+ // `@azure/storage-blob` is excluded, so pre-bundle its CommonJS browser dependency explicitly.
157
+ '@azure/storage-blob > events'
121
158
  ];
122
159
 
123
160
  //# sourceMappingURL=optimizeDeps.js.map
@@ -1 +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"}
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 // Preserve RSC client boundaries on storage admin upload handlers.\n '@payloadcms/storage-azure',\n '@payloadcms/storage-r2',\n '@payloadcms/storage-vercel-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n // Packages whose admin component barrel re-exports `'use client'` modules\n // without carrying the directive itself. Pre-bundling one puts those modules\n // in the optimized dep chunk *and* in the `rsc` environment as client\n // references, which `@vitejs/plugin-rsc` warns about (\"client component\n // dependency is inconsistently optimized\") once per component. Barrels that\n // start with `'use client'` (e.g. `richtext-lexical`, `plugin-stripe`) don't\n // warn and stay pre-bundled. Only shows up in published installs; workspace\n // source is never pre-bundled.\n '@payloadcms/plugin-cloud-storage',\n '@payloadcms/plugin-ecommerce',\n '@payloadcms/plugin-form-builder',\n '@payloadcms/plugin-import-export',\n '@payloadcms/plugin-multi-tenant',\n '@payloadcms/plugin-search',\n '@payloadcms/plugin-sentry',\n '@payloadcms/plugin-seo',\n // Database adapters and their drivers. The client scan reaches them through the\n // Payload config (it follows server functions' `import('@payload-config')`\n // without TanStack's server-fn stripping), so Vite would pre-bundle the whole\n // driver for a browser that never loads it. Mongoose 9 has no browser build, so\n // that bundles `mongodb`, whose optional `@aws-sdk/credential-providers` peer —\n // when linked, as in the monorepo via `@payloadcms/payload-cloud` — fails the\n // same `MISSING_EXPORT` way. Published installs reach the adapter packages;\n // the monorepo, which resolves them to source, reaches the drivers.\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n 'mongodb',\n 'mongoose',\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 / zod /\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 // `zod` *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 > zod',\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-dimensions',\n 'payload > ipaddr.js',\n 'payload > range-parser',\n 'payload > sanitize-filename',\n // `@azure/storage-blob` is excluded, so pre-bundle its CommonJS browser dependency explicitly.\n '@azure/storage-blob > events',\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,mEAAmE;IACnE;IACA;IACA;IACA;IACA;IACA;IACA,0EAA0E;IAC1E,6EAA6E;IAC7E,sEAAsE;IACtE,wEAAwE;IACxE,4EAA4E;IAC5E,6EAA6E;IAC7E,4EAA4E;IAC5E,+BAA+B;IAC/B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,gFAAgF;IAChF,2EAA2E;IAC3E,8EAA8E;IAC9E,gFAAgF;IAChF,gFAAgF;IAChF,8EAA8E;IAC9E,4EAA4E;IAC5E,oEAAoE;IACpE;IACA;IACA;IACA;IACA;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,+FAA+F;IAC/F;CACD,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { PluginOption } from 'vite';
2
+ /**
3
+ * Reloads Payload when `payload.config.ts`, or anything it imports, changes.
4
+ *
5
+ * Vite re-evaluates the config module on its own, but `getPayload` keeps
6
+ * serving its cached instance until a `DevReloadStrategy` marks it stale. This
7
+ * plugin only broadcasts the change; `devConfigReload.server.ts` subscribes
8
+ * from inside the server runtime and marks the instance, which `getPayload`
9
+ * then reloads on its next call.
10
+ */
11
+ export declare function payloadDevConfigReload({ payloadConfigPath, }: {
12
+ payloadConfigPath: string;
13
+ }): PluginOption;
14
+ //# sourceMappingURL=devConfigReload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devConfigReload.d.ts","sourceRoot":"","sources":["../../src/withPayload/devConfigReload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,YAAY,EAAiB,MAAM,MAAM,CAAA;AAO9E;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,iBAAiB,GAClB,EAAE;IACD,iBAAiB,EAAE,MAAM,CAAA;CAC1B,GAAG,YAAY,CA+Cf"}
@@ -0,0 +1,84 @@
1
+ import path from 'node:path';
2
+ import { normalizePath } from 'vite';
3
+ import { PAYLOAD_CONFIG_CHANGED_EVENT } from '../utilities/devConfigReloadEvent.js';
4
+ /**
5
+ * Reloads Payload when `payload.config.ts`, or anything it imports, changes.
6
+ *
7
+ * Vite re-evaluates the config module on its own, but `getPayload` keeps
8
+ * serving its cached instance until a `DevReloadStrategy` marks it stale. This
9
+ * plugin only broadcasts the change; `devConfigReload.server.ts` subscribes
10
+ * from inside the server runtime and marks the instance, which `getPayload`
11
+ * then reloads on its next call.
12
+ */ export function payloadDevConfigReload({ payloadConfigPath }) {
13
+ const configFile = normalizePath(path.resolve(payloadConfigPath));
14
+ let server;
15
+ // Vite runs `hotUpdate` once per environment (client, ssr, rsc) per change,
16
+ // sharing one timestamp; without this the notice prints three times.
17
+ let lastHandled = '';
18
+ return {
19
+ name: 'payload:dev-config-reload',
20
+ apply: 'serve',
21
+ configureServer (devServer) {
22
+ server = devServer;
23
+ },
24
+ hotUpdate ({ file, modules, timestamp }) {
25
+ if (!server) {
26
+ return;
27
+ }
28
+ const changeKey = `${file}:${timestamp}`;
29
+ if (changeKey === lastHandled) {
30
+ return;
31
+ }
32
+ if (!affectsPayloadConfig({
33
+ configFile,
34
+ file,
35
+ modules
36
+ })) {
37
+ return;
38
+ }
39
+ lastHandled = changeKey;
40
+ server.config.logger.info(`payload config changed, reloading Payload (${path.basename(file)})`, {
41
+ timestamp: true
42
+ });
43
+ // Broadcast to every environment rather than just `this.environment`: the
44
+ // changed module may only be in the graph of the environment that saw it,
45
+ // while the Payload instance was built in another. Each environment's
46
+ // runtime subscribes with its own copy of `payload`, and environments with
47
+ // no subscriber (e.g. `client`) simply ignore the event.
48
+ for (const environment of Object.values(server.environments)){
49
+ environment.hot.send({
50
+ type: 'custom',
51
+ event: PAYLOAD_CONFIG_CHANGED_EVENT
52
+ });
53
+ }
54
+ }
55
+ };
56
+ }
57
+ /**
58
+ * Whether `file` is the Payload config or something it imports. Walks *up*
59
+ * through importers, since the config sits at the root of that subtree.
60
+ */ function affectsPayloadConfig({ configFile, file, modules }) {
61
+ if (normalizePath(file) === configFile) {
62
+ return true;
63
+ }
64
+ const seen = new Set();
65
+ const queue = [
66
+ ...modules
67
+ ];
68
+ while(queue.length > 0){
69
+ const mod = queue.pop();
70
+ if (seen.has(mod)) {
71
+ continue;
72
+ }
73
+ seen.add(mod);
74
+ if (mod.file && normalizePath(mod.file) === configFile) {
75
+ return true;
76
+ }
77
+ for (const importer of mod.importers){
78
+ queue.push(importer);
79
+ }
80
+ }
81
+ return false;
82
+ }
83
+
84
+ //# sourceMappingURL=devConfigReload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/withPayload/devConfigReload.ts"],"sourcesContent":["import type { EnvironmentModuleNode, PluginOption, ViteDevServer } from 'vite'\n\nimport path from 'node:path'\nimport { normalizePath } from 'vite'\n\nimport { PAYLOAD_CONFIG_CHANGED_EVENT } from '../utilities/devConfigReloadEvent.js'\n\n/**\n * Reloads Payload when `payload.config.ts`, or anything it imports, changes.\n *\n * Vite re-evaluates the config module on its own, but `getPayload` keeps\n * serving its cached instance until a `DevReloadStrategy` marks it stale. This\n * plugin only broadcasts the change; `devConfigReload.server.ts` subscribes\n * from inside the server runtime and marks the instance, which `getPayload`\n * then reloads on its next call.\n */\nexport function payloadDevConfigReload({\n payloadConfigPath,\n}: {\n payloadConfigPath: string\n}): PluginOption {\n const configFile = normalizePath(path.resolve(payloadConfigPath))\n\n let server: undefined | ViteDevServer\n\n // Vite runs `hotUpdate` once per environment (client, ssr, rsc) per change,\n // sharing one timestamp; without this the notice prints three times.\n let lastHandled = ''\n\n return {\n name: 'payload:dev-config-reload',\n apply: 'serve',\n configureServer(devServer) {\n server = devServer\n },\n hotUpdate({ file, modules, timestamp }) {\n if (!server) {\n return\n }\n\n const changeKey = `${file}:${timestamp}`\n\n if (changeKey === lastHandled) {\n return\n }\n\n if (!affectsPayloadConfig({ configFile, file, modules })) {\n return\n }\n\n lastHandled = changeKey\n\n server.config.logger.info(\n `payload config changed, reloading Payload (${path.basename(file)})`,\n { timestamp: true },\n )\n\n // Broadcast to every environment rather than just `this.environment`: the\n // changed module may only be in the graph of the environment that saw it,\n // while the Payload instance was built in another. Each environment's\n // runtime subscribes with its own copy of `payload`, and environments with\n // no subscriber (e.g. `client`) simply ignore the event.\n for (const environment of Object.values(server.environments)) {\n environment.hot.send({ type: 'custom', event: PAYLOAD_CONFIG_CHANGED_EVENT })\n }\n },\n }\n}\n\n/**\n * Whether `file` is the Payload config or something it imports. Walks *up*\n * through importers, since the config sits at the root of that subtree.\n */\nfunction affectsPayloadConfig({\n configFile,\n file,\n modules,\n}: {\n configFile: string\n file: string\n modules: EnvironmentModuleNode[]\n}): boolean {\n if (normalizePath(file) === configFile) {\n return true\n }\n\n const seen = new Set<EnvironmentModuleNode>()\n const queue = [...modules]\n\n while (queue.length > 0) {\n const mod = queue.pop()!\n\n if (seen.has(mod)) {\n continue\n }\n seen.add(mod)\n\n if (mod.file && normalizePath(mod.file) === configFile) {\n return true\n }\n\n for (const importer of mod.importers) {\n queue.push(importer)\n }\n }\n\n return false\n}\n"],"names":["path","normalizePath","PAYLOAD_CONFIG_CHANGED_EVENT","payloadDevConfigReload","payloadConfigPath","configFile","resolve","server","lastHandled","name","apply","configureServer","devServer","hotUpdate","file","modules","timestamp","changeKey","affectsPayloadConfig","config","logger","info","basename","environment","Object","values","environments","hot","send","type","event","seen","Set","queue","length","mod","pop","has","add","importer","importers","push"],"mappings":"AAEA,OAAOA,UAAU,YAAW;AAC5B,SAASC,aAAa,QAAQ,OAAM;AAEpC,SAASC,4BAA4B,QAAQ,uCAAsC;AAEnF;;;;;;;;CAQC,GACD,OAAO,SAASC,uBAAuB,EACrCC,iBAAiB,EAGlB;IACC,MAAMC,aAAaJ,cAAcD,KAAKM,OAAO,CAACF;IAE9C,IAAIG;IAEJ,4EAA4E;IAC5E,qEAAqE;IACrE,IAAIC,cAAc;IAElB,OAAO;QACLC,MAAM;QACNC,OAAO;QACPC,iBAAgBC,SAAS;YACvB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"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,CAoC9E;AAED,eAAO,MAAM,sCAAsC,EAAE,MAAM,EAAsC,CAAA"}
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,7 +30,7 @@ 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
- const allowedClientFileImporters = /\/richtext-lexical\/.*\/exports\/client\/|\/tanstack-start\/.*\/views\/AdminView|\/ui\//;
33
+ const allowedClientFileImporters = /\/richtext-lexical\/.*\/exports\/client\/|\/ui\//;
34
34
  if (info.envType === 'server' && info.resolved?.includes('.client.') && allowedClientFileImporters.test(info.importer)) {
35
35
  return false;
36
36
  }
@@ -1 +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|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
+ {"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,10 +5,14 @@ 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
8
  /** Extra globs exempted from the `.client.*` SSR denial (beyond the default node_modules exemption). */
11
9
  clientDenialExcludeFiles?: string[];
10
+ /**
11
+ * Packages added to `ssr.external` on dev serve only (the build bundles them).
12
+ * List CommonJS deps that 500 with `__cjs_module_runner_transform` — the RSC
13
+ * plugin's CJS-to-ESM rewrite breaks on their circular `require`s.
14
+ */
15
+ devServerExternalPackages?: string[];
12
16
  /** Path to the user's `payload.config.ts` (required) */
13
17
  payloadConfigPath: string;
14
18
  /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'` */
@@ -20,8 +24,13 @@ export type WithPayloadOptions = {
20
24
  /** Extra Vite config deep-merged over the Payload defaults. Ignored in `build` mode. */
21
25
  vite?: UserConfig;
22
26
  };
27
+ /** The `nitro()` options Payload's server build requires. Typed structurally — `nitro` is the host's dependency, not Payload's. */
28
+ export type PayloadNitroOptions = {
29
+ traceDeps: string[];
30
+ };
23
31
  /** The options Payload's admin requires for each third-party plugin. */
24
32
  export type PayloadPluginOptions = {
33
+ nitro: PayloadNitroOptions;
25
34
  react: NonNullable<Parameters<typeof viteReact>[0]>;
26
35
  rsc: NonNullable<Parameters<typeof rsc>[0]>;
27
36
  tanstackStart: NonNullable<Parameters<typeof tanstackStart>[0]>;
@@ -58,6 +67,7 @@ export type WithPayloadBuilder = (context: WithPayloadBuilderContext) => UserCon
58
67
  * rsc(pluginOptions.rsc),
59
68
  * tanstackStart(pluginOptions.tanstackStart),
60
69
  * viteReact(pluginOptions.react),
70
+ * nitro(pluginOptions.nitro), // only if the app deploys through Nitro
61
71
  * ],
62
72
  * // ...other config options
63
73
  * }),
@@ -68,17 +78,18 @@ export type WithPayloadBuilder = (context: WithPayloadBuilderContext) => UserCon
68
78
  export declare function withPayload(build: undefined | WithPayloadBuilder, options: WithPayloadOptions): UserConfigFnObject;
69
79
  /** `@vitejs/plugin-rsc` options for Payload: `serverHandler: false` (TanStack owns the handler). */
70
80
  export declare function payloadRscOptions(): NonNullable<Parameters<typeof rsc>[0]>;
81
+ /**
82
+ * `nitro/vite` options for Payload's server build. `tslib*` full-traces `tslib`
83
+ * so an externalized dep's `tslib/modules/index.js` import (its `import.node`
84
+ * export condition) ships — otherwise the build is green and the server 500s
85
+ * with `ERR_MODULE_NOT_FOUND` on the first request.
86
+ */
87
+ export declare function payloadNitroOptions(): PayloadNitroOptions;
71
88
  /** `@vitejs/plugin-react` options for Payload: transform every `.[jt]sx?` file. */
72
89
  export declare function payloadReactOptions(): NonNullable<Parameters<typeof viteReact>[0]>;
73
90
  export type PayloadTanstackStartOptionsArgs = {
74
91
  /** Additional import-protection `ignoreImporters` patterns. */
75
92
  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
93
  /**
83
94
  * Extra globs exempted from TanStack's `.client.*` SSR denial, on top of the
84
95
  * default node_modules exemption. Needed only when Payload's own `.client.*`
@@ -91,8 +102,8 @@ export type PayloadTanstackStartOptionsArgs = {
91
102
  srcDirectory?: string;
92
103
  };
93
104
  /**
94
- * The `tanstackStart` options Payload's admin requires (import-protection and
95
- * code-splitting). TanStack Start is one-per-app, so a host that already runs it
105
+ * The `tanstackStart` options Payload's admin requires (import protection and
106
+ * route discovery). TanStack Start is one-per-app, so a host that already runs it
96
107
  * should merge these into its single `tanstackStart` call.
97
108
  */
98
109
  export declare function payloadTanstackStartOptions(args?: PayloadTanstackStartOptionsArgs): NonNullable<Parameters<typeof tanstackStart>[0]>;
@@ -1 +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,E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E1E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,mBAAmB,CAEzD;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,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,CA+BlD"}
@@ -8,6 +8,7 @@ import { createLogger, mergeConfig } from 'vite';
8
8
  import { buildExternalPackages, payloadNoExternalPatterns, ssrExternalPackages } from './config/external.js';
9
9
  import { optimizeDepsExcludeDefaults, optimizeDepsIncludeDefaults } from './config/optimizeDeps.js';
10
10
  import { payloadScssImporters } from './config/scss.js';
11
+ import { payloadDevConfigReload } from './devConfigReload.js';
11
12
  import { defaultImportProtectionIgnoreImporters, onImportProtectionViolation, serverOnlyClientSpecifiers } from './importProtection.js';
12
13
  import { clientModuleResolution } from './workarounds/clientModuleResolution.js';
13
14
  import { payloadDevTransforms } from './workarounds/devTransforms.js';
@@ -19,9 +20,16 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
19
20
  * Vite dependency warnings Payload consumers can't act on: third-party packages
20
21
  * ship sourcemaps whose original sources aren't published, so Vite warns on
21
22
  * every one. Suppressed by default (see `silenceDependencyWarnings`).
23
+ *
24
+ * `Failed to load source map` covers deps that ship a `sourceMappingURL` comment
25
+ * without the `.map` file it points at (e.g. `undici`'s `lib/llhttp/*.js`, pulled
26
+ * in via `@vercel/blob`). Vite appends the underlying `ENOENT` stack to that one,
27
+ * so each occurrence is a ~10-line block that buries real log output.
22
28
  */ const suppressibleWarningPatterns = [
23
29
  'points to missing source files',
24
- 'Sourcemap for'
30
+ 'Sourcemap for',
31
+ 'Failed to load source map',
32
+ 'references a map file outside its package'
25
33
  ];
26
34
  /**
27
35
  * Wraps a Vite logger so warnings matching {@link suppressibleWarningPatterns}
@@ -70,6 +78,7 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
70
78
  * rsc(pluginOptions.rsc),
71
79
  * tanstackStart(pluginOptions.tanstackStart),
72
80
  * viteReact(pluginOptions.react),
81
+ * nitro(pluginOptions.nitro), // only if the app deploys through Nitro
73
82
  * ],
74
83
  * // ...other config options
75
84
  * }),
@@ -77,7 +86,7 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
77
86
  * )
78
87
  * ```
79
88
  */ export function withPayload(build, options) {
80
- const { additionalIgnoreImporters = [], adminRouteId, clientDenialExcludeFiles = [], payloadConfigPath, routesDirectory = 'app', silenceDependencyWarnings = true, srcDirectory = 'src', vite } = options;
89
+ const { additionalIgnoreImporters = [], clientDenialExcludeFiles = [], devServerExternalPackages = [], payloadConfigPath, routesDirectory = 'app', silenceDependencyWarnings = true, srcDirectory = 'src', vite } = options;
81
90
  return (env)=>{
82
91
  // `pluralize` ships a UMD wrapper that throws when run through Vite's dev SSR
83
92
  // transform, so dev serve keeps it external and lets Node require it.
@@ -97,7 +106,13 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
97
106
  // externalizes the package boundaries (`buildExternalPackages`) and drops
98
107
  // `pluralize` so it bundles — leaving it in `ssr.external` here would win over
99
108
  // `noExternal` and re-emit the bare specifier.
100
- const ssrExternal = isBuild ? buildExternalPackages : ssrExternalPackages;
109
+ // Dev serve also honors `devServerExternalPackages`, the app's own CJS
110
+ // dependencies that break under the RSC plugin's CJS-to-ESM rewrite; the build
111
+ // needs none of it, since Rollup bundles CJS correctly.
112
+ const ssrExternal = isBuild ? buildExternalPackages : [
113
+ ...ssrExternalPackages,
114
+ ...devServerExternalPackages
115
+ ];
101
116
  const base = {
102
117
  build: {
103
118
  cssMinify: 'esbuild'
@@ -151,7 +166,10 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
151
166
  ssrStripDistStyleImports(),
152
167
  reactDomServerInRsc(),
153
168
  stubPrettierInClient(),
154
- payloadDevTransforms()
169
+ payloadDevTransforms(),
170
+ payloadDevConfigReload({
171
+ payloadConfigPath
172
+ })
155
173
  ],
156
174
  resolve: {
157
175
  alias: [
@@ -184,11 +202,11 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
184
202
  }
185
203
  };
186
204
  const pluginOptions = {
205
+ nitro: payloadNitroOptions(),
187
206
  react: payloadReactOptions(),
188
207
  rsc: payloadRscOptions(),
189
208
  tanstackStart: payloadTanstackStartOptions({
190
209
  additionalIgnoreImporters,
191
- adminRouteId,
192
210
  clientDenialExcludeFiles,
193
211
  routesDirectory,
194
212
  srcDirectory
@@ -215,6 +233,18 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
215
233
  serverHandler: false
216
234
  };
217
235
  }
236
+ /**
237
+ * `nitro/vite` options for Payload's server build. `tslib*` full-traces `tslib`
238
+ * so an externalized dep's `tslib/modules/index.js` import (its `import.node`
239
+ * export condition) ships — otherwise the build is green and the server 500s
240
+ * with `ERR_MODULE_NOT_FOUND` on the first request.
241
+ */ export function payloadNitroOptions() {
242
+ return {
243
+ traceDeps: [
244
+ 'tslib*'
245
+ ]
246
+ };
247
+ }
218
248
  /** `@vitejs/plugin-react` options for Payload: transform every `.[jt]sx?` file. */ export function payloadReactOptions() {
219
249
  return {
220
250
  exclude: [],
@@ -222,11 +252,11 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
222
252
  };
223
253
  }
224
254
  /**
225
- * The `tanstackStart` options Payload's admin requires (import-protection and
226
- * code-splitting). TanStack Start is one-per-app, so a host that already runs it
255
+ * The `tanstackStart` options Payload's admin requires (import protection and
256
+ * route discovery). TanStack Start is one-per-app, so a host that already runs it
227
257
  * should merge these into its single `tanstackStart` call.
228
258
  */ export function payloadTanstackStartOptions(args = {}) {
229
- const { additionalIgnoreImporters = [], adminRouteId = '/_payload', clientDenialExcludeFiles = [], routesDirectory = 'app', srcDirectory = 'src' } = args;
259
+ const { additionalIgnoreImporters = [], clientDenialExcludeFiles = [], routesDirectory = 'app', srcDirectory = 'src' } = args;
230
260
  return {
231
261
  importProtection: {
232
262
  client: {
@@ -255,16 +285,9 @@ import { wrapCjsForClient } from './workarounds/wrapCjsForClient.js';
255
285
  }
256
286
  },
257
287
  router: {
258
- codeSplittingOptions: {
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
264
- },
265
288
  // Ignore generated importMap files and colocated `*.functions.ts` modules
266
289
  // (they define `createServerFn`s, not routes).
267
- routeFileIgnorePattern: 'importMap\\.(?:js|server\\.ts)$|\\.functions\\.',
290
+ routeFileIgnorePattern: 'importMap\\.(?:d\\.ts|js|server\\.ts)$|\\.functions\\.',
268
291
  routesDirectory
269
292
  },
270
293
  rsc: {
@@ -1 +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":"AAEA,kFAAkF;AAClF,2DAA2D;AAC3D,SAASA,aAAa,QAAQ,oCAAmC;AACjE,OAAOC,eAAe,uBAAsB;AAC5C,OAAOC,SAAS,qBAAoB;AACpC,OAAOC,UAAU,YAAW;AAC5B,SAASC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AA2C8B;aAA0B;YAC1F8B,SAAS;gBAAC;aAAO;YACjBqB,YAAY;YACZC,aAAajF;YACb,4EAA4E;YAC5E,wEAAwE;YACxE,2EAA2E;YAC3E,yEAAyE;YACzE,oEAAoE;YACpEkF,QAAQ;gBAAEL,cAAc;oBAAC;uBAAyB9C;iBAAyB;YAAC;QAC9E;QACAoD,QAAQ;YACNC,sBAAsB;gBACpB,0EAA0E;gBAC1E,2EAA2E;gBAC3E,0EAA0E;gBAC1E,gEAAgE;gBAChEC,eAAe,CAAC,EAAEC,OAAO,EAAuB,GAC9CA,YAAYxD,gBAAgBwD,QAAQC,UAAU,CAAC,GAAGzD,aAAa,CAAC,CAAC,IAAI,EAAE,GAAG0D;YAC9E;YACA,0EAA0E;YAC1E,+CAA+C;YAC/CC,wBAAwB;YACxBxD;QACF;QACA5C,KAAK;YAAEoC,SAAS;QAAK;QACrBU;IACF;AACF"}
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 { payloadDevConfigReload } from './devConfigReload.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 *\n * `Failed to load source map` covers deps that ship a `sourceMappingURL` comment\n * without the `.map` file it points at (e.g. `undici`'s `lib/llhttp/*.js`, pulled\n * in via `@vercel/blob`). Vite appends the underlying `ENOENT` stack to that one,\n * so each occurrence is a ~10-line block that buries real log output.\n */\nconst suppressibleWarningPatterns = [\n 'points to missing source files',\n 'Sourcemap for',\n 'Failed to load source map',\n 'references a map file outside its package',\n]\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 /** Extra globs exempted from the `.client.*` SSR denial (beyond the default node_modules exemption). */\n clientDenialExcludeFiles?: string[]\n /**\n * Packages added to `ssr.external` on dev serve only (the build bundles them).\n * List CommonJS deps that 500 with `__cjs_module_runner_transform` — the RSC\n * plugin's CJS-to-ESM rewrite breaks on their circular `require`s.\n */\n devServerExternalPackages?: 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 `nitro()` options Payload's server build requires. Typed structurally — `nitro` is the host's dependency, not Payload's. */\nexport type PayloadNitroOptions = {\n traceDeps: string[]\n}\n\n/** The options Payload's admin requires for each third-party plugin. */\nexport type PayloadPluginOptions = {\n nitro: PayloadNitroOptions\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 * nitro(pluginOptions.nitro), // only if the app deploys through Nitro\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 clientDenialExcludeFiles = [],\n devServerExternalPackages = [],\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 // Dev serve also honors `devServerExternalPackages`, the app's own CJS\n // dependencies that break under the RSC plugin's CJS-to-ESM rewrite; the build\n // needs none of it, since Rollup bundles CJS correctly.\n const ssrExternal = isBuild\n ? buildExternalPackages\n : [...ssrExternalPackages, ...devServerExternalPackages]\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 payloadDevConfigReload({ payloadConfigPath }),\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 nitro: payloadNitroOptions(),\n react: payloadReactOptions(),\n rsc: payloadRscOptions(),\n tanstackStart: payloadTanstackStartOptions({\n additionalIgnoreImporters,\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/**\n * `nitro/vite` options for Payload's server build. `tslib*` full-traces `tslib`\n * so an externalized dep's `tslib/modules/index.js` import (its `import.node`\n * export condition) ships — otherwise the build is green and the server 500s\n * with `ERR_MODULE_NOT_FOUND` on the first request.\n */\nexport function payloadNitroOptions(): PayloadNitroOptions {\n return { traceDeps: ['tslib*'] }\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 * 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 * route discovery). 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 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 // Ignore generated importMap files and colocated `*.functions.ts` modules\n // (they define `createServerFn`s, not routes).\n routeFileIgnorePattern: 'importMap\\\\.(?:d\\\\.ts|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","payloadDevConfigReload","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","clientDenialExcludeFiles","devServerExternalPackages","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","nitro","payloadNitroOptions","react","payloadReactOptions","payloadRscOptions","payloadTanstackStartOptions","merged","serverHandler","traceDeps","args","importProtection","client","excludeFiles","specifiers","ignoreImporters","mockAccess","onViolation","server","router","routeFileIgnorePattern"],"mappings":"AAEA,kFAAkF;AAClF,2DAA2D;AAC3D,SAASA,aAAa,QAAQ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