@payloadcms/tanstack-start 4.0.0-internal.183b315 → 4.0.0-internal.21664f3

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 (153) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/elements/RouterAdapter/index.d.ts.map +1 -1
  3. package/dist/elements/RouterAdapter/index.js +55 -16
  4. package/dist/elements/RouterAdapter/index.js.map +1 -1
  5. package/dist/exports/client.d.ts +4 -0
  6. package/dist/exports/client.d.ts.map +1 -1
  7. package/dist/exports/client.js +4 -0
  8. package/dist/exports/client.js.map +1 -1
  9. package/dist/exports/layouts.d.ts +1 -0
  10. package/dist/exports/layouts.d.ts.map +1 -1
  11. package/dist/exports/layouts.js +1 -0
  12. package/dist/exports/layouts.js.map +1 -1
  13. package/dist/exports/server.d.ts +3 -2
  14. package/dist/exports/server.d.ts.map +1 -1
  15. package/dist/exports/server.js +3 -2
  16. package/dist/exports/server.js.map +1 -1
  17. package/dist/exports/vite.d.ts +2 -2
  18. package/dist/exports/vite.d.ts.map +1 -1
  19. package/dist/exports/vite.js +1 -1
  20. package/dist/exports/vite.js.map +1 -1
  21. package/dist/index.d.ts +2 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/layouts/Root/getLayoutData.d.ts.map +1 -1
  26. package/dist/layouts/Root/getLayoutData.js +37 -1
  27. package/dist/layouts/Root/getLayoutData.js.map +1 -1
  28. package/dist/layouts/Root/index.d.ts +9 -2
  29. package/dist/layouts/Root/index.d.ts.map +1 -1
  30. package/dist/layouts/Root/index.js +4 -2
  31. package/dist/layouts/Root/index.js.map +1 -1
  32. package/dist/layouts/Root/withPayloadRoot.d.ts +41 -0
  33. package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -0
  34. package/dist/layouts/Root/withPayloadRoot.js +91 -0
  35. package/dist/layouts/Root/withPayloadRoot.js.map +1 -0
  36. package/dist/node/cssLoader.d.mts +24 -2
  37. package/dist/node/cssLoader.d.mts.map +1 -1
  38. package/dist/routes/adminRoutes.d.ts +111 -0
  39. package/dist/routes/adminRoutes.d.ts.map +1 -0
  40. package/dist/routes/adminRoutes.js +108 -0
  41. package/dist/routes/adminRoutes.js.map +1 -0
  42. package/dist/routes/apiRoute.d.ts +29 -0
  43. package/dist/routes/apiRoute.d.ts.map +1 -0
  44. package/dist/routes/apiRoute.js +38 -0
  45. package/dist/routes/apiRoute.js.map +1 -0
  46. package/dist/routes/layoutRoute.d.ts +26 -0
  47. package/dist/routes/layoutRoute.d.ts.map +1 -0
  48. package/dist/routes/layoutRoute.js +57 -0
  49. package/dist/routes/layoutRoute.js.map +1 -0
  50. package/dist/utilities/graphqlHandler.server.d.ts.map +1 -1
  51. package/dist/utilities/handleAPIRoute.d.ts +11 -0
  52. package/dist/utilities/handleAPIRoute.d.ts.map +1 -0
  53. package/dist/utilities/handleAPIRoute.js +17 -0
  54. package/dist/utilities/handleAPIRoute.js.map +1 -0
  55. package/dist/utilities/importMap.server.d.ts +4 -5
  56. package/dist/utilities/importMap.server.d.ts.map +1 -1
  57. package/dist/utilities/importMap.server.js +5 -6
  58. package/dist/utilities/importMap.server.js.map +1 -1
  59. package/dist/utilities/loadAdminPage.d.ts +54 -0
  60. package/dist/utilities/loadAdminPage.d.ts.map +1 -0
  61. package/dist/utilities/loadAdminPage.js +239 -0
  62. package/dist/utilities/loadAdminPage.js.map +1 -0
  63. package/dist/utilities/loadLayoutData.d.ts +15 -0
  64. package/dist/utilities/loadLayoutData.d.ts.map +1 -0
  65. package/dist/utilities/loadLayoutData.js +23 -0
  66. package/dist/utilities/loadLayoutData.js.map +1 -0
  67. package/dist/utilities/meta.d.ts +1 -0
  68. package/dist/utilities/meta.d.ts.map +1 -1
  69. package/dist/utilities/meta.js +2 -1
  70. package/dist/utilities/meta.js.map +1 -1
  71. package/dist/utilities/routerSearch.d.ts +40 -0
  72. package/dist/utilities/routerSearch.d.ts.map +1 -0
  73. package/dist/utilities/routerSearch.js +45 -0
  74. package/dist/utilities/routerSearch.js.map +1 -0
  75. package/dist/utilities/serializeForRsc.d.ts.map +1 -1
  76. package/dist/utilities/serializeForRsc.js +17 -0
  77. package/dist/utilities/serializeForRsc.js.map +1 -1
  78. package/dist/utilities/serverAdapter.server.d.ts.map +1 -1
  79. package/dist/utilities/serverFunctionClient.d.ts +29 -0
  80. package/dist/utilities/serverFunctionClient.d.ts.map +1 -0
  81. package/dist/utilities/serverFunctionClient.js +109 -0
  82. package/dist/utilities/serverFunctionClient.js.map +1 -0
  83. package/dist/vite/config/external.d.ts +11 -0
  84. package/dist/vite/config/external.d.ts.map +1 -0
  85. package/dist/vite/config/external.js +48 -0
  86. package/dist/vite/config/external.js.map +1 -0
  87. package/dist/vite/config/optimizeDeps.d.ts +25 -0
  88. package/dist/vite/config/optimizeDeps.d.ts.map +1 -0
  89. package/dist/vite/config/optimizeDeps.js +123 -0
  90. package/dist/vite/config/optimizeDeps.js.map +1 -0
  91. package/dist/vite/config/scss.d.ts +14 -0
  92. package/dist/vite/config/scss.d.ts.map +1 -0
  93. package/dist/vite/config/scss.js +28 -0
  94. package/dist/vite/config/scss.js.map +1 -0
  95. package/dist/vite/index.d.ts +99 -0
  96. package/dist/vite/index.d.ts.map +1 -0
  97. package/dist/vite/index.js +258 -0
  98. package/dist/vite/index.js.map +1 -0
  99. package/dist/vite/workarounds/clientModuleResolution.d.ts.map +1 -0
  100. package/dist/vite/workarounds/clientModuleResolution.js.map +1 -0
  101. package/dist/vite/workarounds/devTransforms.d.ts +19 -0
  102. package/dist/vite/workarounds/devTransforms.d.ts.map +1 -0
  103. package/dist/vite/{plugins → workarounds}/devTransforms.js +18 -2
  104. package/dist/vite/workarounds/devTransforms.js.map +1 -0
  105. package/dist/vite/workarounds/reactDomServerInRsc.d.ts.map +1 -0
  106. package/dist/vite/workarounds/reactDomServerInRsc.js.map +1 -0
  107. package/dist/vite/workarounds/stripDistStyleImports.d.ts.map +1 -0
  108. package/dist/vite/workarounds/stripDistStyleImports.js +140 -0
  109. package/dist/vite/workarounds/stripDistStyleImports.js.map +1 -0
  110. package/dist/vite/workarounds/stubPrettierInClient.d.ts +13 -0
  111. package/dist/vite/workarounds/stubPrettierInClient.d.ts.map +1 -0
  112. package/dist/vite/workarounds/stubPrettierInClient.js +32 -0
  113. package/dist/vite/workarounds/stubPrettierInClient.js.map +1 -0
  114. package/dist/vite/workarounds/wrapCjsForClient.d.ts.map +1 -0
  115. package/dist/vite/workarounds/wrapCjsForClient.js.map +1 -0
  116. package/package.json +12 -7
  117. package/dist/@types/assets.d.js +0 -2
  118. package/dist/@types/assets.d.js.map +0 -1
  119. package/dist/auth/switchLanguage.d.ts +0 -6
  120. package/dist/auth/switchLanguage.d.ts.map +0 -1
  121. package/dist/auth/switchLanguage.js +0 -11
  122. package/dist/auth/switchLanguage.js.map +0 -1
  123. package/dist/utilities/getRequestTheme.d.ts +0 -10
  124. package/dist/utilities/getRequestTheme.d.ts.map +0 -1
  125. package/dist/utilities/getRequestTheme.js +0 -25
  126. package/dist/utilities/getRequestTheme.js.map +0 -1
  127. package/dist/vite/constants.d.ts +0 -37
  128. package/dist/vite/constants.d.ts.map +0 -1
  129. package/dist/vite/constants.js +0 -129
  130. package/dist/vite/constants.js.map +0 -1
  131. package/dist/vite/plugin.d.ts +0 -38
  132. package/dist/vite/plugin.d.ts.map +0 -1
  133. package/dist/vite/plugin.js +0 -182
  134. package/dist/vite/plugin.js.map +0 -1
  135. package/dist/vite/plugins/clientModuleResolution.d.ts.map +0 -1
  136. package/dist/vite/plugins/clientModuleResolution.js.map +0 -1
  137. package/dist/vite/plugins/devTransforms.d.ts +0 -8
  138. package/dist/vite/plugins/devTransforms.d.ts.map +0 -1
  139. package/dist/vite/plugins/devTransforms.js.map +0 -1
  140. package/dist/vite/plugins/reactDomServerInRsc.d.ts.map +0 -1
  141. package/dist/vite/plugins/reactDomServerInRsc.js.map +0 -1
  142. package/dist/vite/plugins/stripDistStyleImports.d.ts.map +0 -1
  143. package/dist/vite/plugins/stripDistStyleImports.js +0 -89
  144. package/dist/vite/plugins/stripDistStyleImports.js.map +0 -1
  145. package/dist/vite/plugins/wrapCjsForClient.d.ts.map +0 -1
  146. package/dist/vite/plugins/wrapCjsForClient.js.map +0 -1
  147. /package/dist/vite/{plugins → workarounds}/clientModuleResolution.d.ts +0 -0
  148. /package/dist/vite/{plugins → workarounds}/clientModuleResolution.js +0 -0
  149. /package/dist/vite/{plugins → workarounds}/reactDomServerInRsc.d.ts +0 -0
  150. /package/dist/vite/{plugins → workarounds}/reactDomServerInRsc.js +0 -0
  151. /package/dist/vite/{plugins → workarounds}/stripDistStyleImports.d.ts +0 -0
  152. /package/dist/vite/{plugins → workarounds}/wrapCjsForClient.d.ts +0 -0
  153. /package/dist/vite/{plugins → workarounds}/wrapCjsForClient.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/serializeForRsc.ts"],"sourcesContent":["import type React from 'react'\n\nimport { renderServerComponent } from '@tanstack/react-start/rsc'\n\n/**\n * Recursively walk a server-function return value and prepare it for transit\n * to the client as an RSC payload.\n *\n * Mirrors `toSerializable`'s walk (Maps, Sets, Dates, typed arrays, circular\n * refs) with two key differences:\n *\n * 1. React elements are NOT stripped. They are passed through\n * `renderServerComponent` from `@tanstack/react-start/rsc` to produce a\n * \"renderable RSC handle\". TanStack Start's `$RSC` serialization adapter\n * streams the underlying Flight payload to the client, where it is\n * decoded back into a renderable React node. This matches the way\n * Next.js's RSC payload format ships React elements over server actions\n * and lets server-rendered custom field components (e.g. those returned\n * by `buildFormState` / `RenderServerComponent`) survive a `form-state`\n * round trip.\n *\n * 2. Functions, Symbols, and RegExps are still stripped — TanStack's seroval\n * transport cannot handle them, and Payload doesn't intentionally include\n * them in server-function return values.\n *\n * Use this in `createServerFn` handlers that return Payload form/view state\n * containing React elements (e.g. `state[path].customComponents.Field`).\n */\nexport async function serializeForRsc<T>(value: T): Promise<T> {\n return (await walk(value, new WeakMap<object, unknown>(), new WeakSet<object>())) as T\n}\n\nasync function walk(\n value: unknown,\n cache: WeakMap<object, unknown>,\n ancestors: WeakSet<object>,\n): Promise<unknown> {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return await renderServerComponent(value as React.ReactElement)\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n return obj\n }\n\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = await walk(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = await walk(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(await walk(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = await walk(obj[key], cache, ancestors)\n if (v !== undefined) {\n result[key] = v\n }\n }\n ancestors.delete(obj)\n return result\n}\n"],"names":["renderServerComponent","serializeForRsc","value","walk","WeakMap","WeakSet","cache","ancestors","undefined","t","obj","$$typeof","has","get","Date","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","arr","item","push","ArrayBuffer","isView","result","key","Object","keys"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,4BAA2B;AAEjE;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,eAAeC,gBAAmBC,KAAQ;IAC/C,OAAQ,MAAMC,KAAKD,OAAO,IAAIE,WAA4B,IAAIC;AAChE;AAEA,eAAeF,KACbD,KAAc,EACdI,KAA+B,EAC/BC,SAA0B;IAE1B,IAAIL,UAAU,QAAQA,UAAUM,WAAW;QACzC,OAAON;IACT;IAEA,MAAMO,IAAI,OAAOP;IACjB,IAAIO,MAAM,cAAcA,MAAM,UAAU;QACtC,OAAOD;IACT;IACA,IAAIC,MAAM,UAAU;QAClB,OAAOP;IACT;IAEA,MAAMQ,MAAMR;IAEZ,IAAI,OAAOQ,IAAIC,QAAQ,KAAK,UAAU;QACpC,OAAO,MAAMX,sBAAsBE;IACrC;IAEA,IAAIK,UAAUK,GAAG,CAACF,MAAM;QACtB,OAAOF;IACT;IAEA,IAAIF,MAAMM,GAAG,CAACF,MAAM;QAClB,OAAOJ,MAAMO,GAAG,CAACH;IACnB;IAEA,IAAIA,eAAeI,MAAM;QACvB,OAAOJ;IACT;IAEA,IAAIA,eAAeK,QAAQ;QACzB,OAAOP;IACT;IAEAD,UAAUS,GAAG,CAACN;IAEd,IAAIA,eAAeO,KAAK;QACtB,MAAMC,UAAU,IAAID;QACpBX,MAAMa,GAAG,CAACT,KAAKQ;QACf,KAAK,MAAM,CAACE,GAAGC,EAAE,IAAIX,IAAK;YACxB,MAAMY,KAAK,MAAMnB,KAAKkB,GAAGf,OAAOC;YAChC,IAAIe,OAAOd,WAAW;gBACpBU,QAAQC,GAAG,CAACC,GAAGE;YACjB;QACF;QACAf,UAAUgB,MAAM,CAACb;QACjB,OAAOQ;IACT;IAEA,IAAIR,eAAec,KAAK;QACtB,MAAMN,UAAU,IAAIM;QACpBlB,MAAMa,GAAG,CAACT,KAAKQ;QACf,KAAK,MAAMG,KAAKX,IAAK;YACnB,MAAMY,KAAK,MAAMnB,KAAKkB,GAAGf,OAAOC;YAChC,IAAIe,OAAOd,WAAW;gBACpBU,QAAQF,GAAG,CAACM;YACd;QACF;QACAf,UAAUgB,MAAM,CAACb;QACjB,OAAOQ;IACT;IAEA,IAAIO,MAAMC,OAAO,CAAChB,MAAM;QACtB,MAAMiB,MAAiB,EAAE;QACzBrB,MAAMa,GAAG,CAACT,KAAKiB;QACf,KAAK,MAAMC,QAAQlB,IAAK;YACtBiB,IAAIE,IAAI,CAAC,MAAM1B,KAAKyB,MAAMtB,OAAOC;QACnC;QACAA,UAAUgB,MAAM,CAACb;QACjB,OAAOiB;IACT;IAEA,IAAIG,YAAYC,MAAM,CAACrB,MAAM;QAC3BH,UAAUgB,MAAM,CAACb;QACjB,OAAOA;IACT;IAEA,MAAMsB,SAAkC,CAAC;IACzC1B,MAAMa,GAAG,CAACT,KAAKsB;IACf,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAACzB,KAAM;QAClC,MAAMW,IAAI,MAAMlB,KAAKO,GAAG,CAACuB,IAAI,EAAE3B,OAAOC;QACtC,IAAIc,MAAMb,WAAW;YACnBwB,MAAM,CAACC,IAAI,GAAGZ;QAChB;IACF;IACAd,UAAUgB,MAAM,CAACb;IACjB,OAAOsB;AACT"}
1
+ {"version":3,"sources":["../../src/utilities/serializeForRsc.ts"],"sourcesContent":["import type React from 'react'\n\nimport { renderServerComponent } from '@tanstack/react-start/rsc'\nimport { createElement, Fragment } from 'react'\n\n/**\n * Recursively walk a server-function return value and prepare it for transit\n * to the client as an RSC payload.\n *\n * Mirrors `toSerializable`'s walk (Maps, Sets, Dates, typed arrays, circular\n * refs) with two key differences:\n *\n * 1. React elements are NOT stripped. They are passed through\n * `renderServerComponent` from `@tanstack/react-start/rsc` to produce a\n * \"renderable RSC handle\". TanStack Start's `$RSC` serialization adapter\n * streams the underlying Flight payload to the client, where it is\n * decoded back into a renderable React node. This matches the way\n * Next.js's RSC payload format ships React elements over server actions\n * and lets server-rendered custom field components (e.g. those returned\n * by `buildFormState` / `RenderServerComponent`) survive a `form-state`\n * round trip.\n *\n * 2. Functions, Symbols, and RegExps are still stripped — TanStack's seroval\n * transport cannot handle them, and Payload doesn't intentionally include\n * them in server-function return values.\n *\n * Use this in `createServerFn` handlers that return Payload form/view state\n * containing React elements (e.g. `state[path].customComponents.Field`).\n */\nexport async function serializeForRsc<T>(value: T): Promise<T> {\n return (await walk(value, new WeakMap<object, unknown>(), new WeakSet<object>())) as T\n}\n\nasync function walk(\n value: unknown,\n cache: WeakMap<object, unknown>,\n ancestors: WeakSet<object>,\n): Promise<unknown> {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return await renderServerComponent(value as React.ReactElement)\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n return obj\n }\n\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = await walk(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = await walk(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n // An array consisting entirely of React elements (e.g. a field's\n // `beforeInput` / `afterInput` component list, produced by\n // `RenderServerComponent`) must be rendered as a SINGLE RSC handle.\n // Converting each element individually below turns every item into its own\n // `renderServerComponent` handle, which drops the element's React `key` —\n // the client then renders `{[handle, handle]}` as unkeyed array children\n // and React warns \"Each child in a list should have a unique key prop\".\n // Payload always renders these component arrays wholesale (`{BeforeInput}`),\n // so collapsing them into one Fragment-rendered handle is render-equivalent\n // and keeps the per-element keys intact inside the single Flight payload.\n const items = obj.filter((item) => item !== null && item !== undefined)\n const isReactElementArray =\n items.length > 0 &&\n items.every(\n (item) => typeof item === 'object' && typeof (item as { $$typeof?: unknown }).$$typeof === 'symbol',\n )\n if (isReactElementArray) {\n ancestors.delete(obj)\n return await renderServerComponent(createElement(Fragment, null, ...(obj as React.ReactNode[])))\n }\n\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(await walk(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = await walk(obj[key], cache, ancestors)\n if (v !== undefined) {\n result[key] = v\n }\n }\n ancestors.delete(obj)\n return result\n}\n"],"names":["renderServerComponent","createElement","Fragment","serializeForRsc","value","walk","WeakMap","WeakSet","cache","ancestors","undefined","t","obj","$$typeof","has","get","Date","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","items","filter","item","isReactElementArray","length","every","arr","push","ArrayBuffer","isView","result","key","Object","keys"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,4BAA2B;AACjE,SAASC,aAAa,EAAEC,QAAQ,QAAQ,QAAO;AAE/C;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,eAAeC,gBAAmBC,KAAQ;IAC/C,OAAQ,MAAMC,KAAKD,OAAO,IAAIE,WAA4B,IAAIC;AAChE;AAEA,eAAeF,KACbD,KAAc,EACdI,KAA+B,EAC/BC,SAA0B;IAE1B,IAAIL,UAAU,QAAQA,UAAUM,WAAW;QACzC,OAAON;IACT;IAEA,MAAMO,IAAI,OAAOP;IACjB,IAAIO,MAAM,cAAcA,MAAM,UAAU;QACtC,OAAOD;IACT;IACA,IAAIC,MAAM,UAAU;QAClB,OAAOP;IACT;IAEA,MAAMQ,MAAMR;IAEZ,IAAI,OAAOQ,IAAIC,QAAQ,KAAK,UAAU;QACpC,OAAO,MAAMb,sBAAsBI;IACrC;IAEA,IAAIK,UAAUK,GAAG,CAACF,MAAM;QACtB,OAAOF;IACT;IAEA,IAAIF,MAAMM,GAAG,CAACF,MAAM;QAClB,OAAOJ,MAAMO,GAAG,CAACH;IACnB;IAEA,IAAIA,eAAeI,MAAM;QACvB,OAAOJ;IACT;IAEA,IAAIA,eAAeK,QAAQ;QACzB,OAAOP;IACT;IAEAD,UAAUS,GAAG,CAACN;IAEd,IAAIA,eAAeO,KAAK;QACtB,MAAMC,UAAU,IAAID;QACpBX,MAAMa,GAAG,CAACT,KAAKQ;QACf,KAAK,MAAM,CAACE,GAAGC,EAAE,IAAIX,IAAK;YACxB,MAAMY,KAAK,MAAMnB,KAAKkB,GAAGf,OAAOC;YAChC,IAAIe,OAAOd,WAAW;gBACpBU,QAAQC,GAAG,CAACC,GAAGE;YACjB;QACF;QACAf,UAAUgB,MAAM,CAACb;QACjB,OAAOQ;IACT;IAEA,IAAIR,eAAec,KAAK;QACtB,MAAMN,UAAU,IAAIM;QACpBlB,MAAMa,GAAG,CAACT,KAAKQ;QACf,KAAK,MAAMG,KAAKX,IAAK;YACnB,MAAMY,KAAK,MAAMnB,KAAKkB,GAAGf,OAAOC;YAChC,IAAIe,OAAOd,WAAW;gBACpBU,QAAQF,GAAG,CAACM;YACd;QACF;QACAf,UAAUgB,MAAM,CAACb;QACjB,OAAOQ;IACT;IAEA,IAAIO,MAAMC,OAAO,CAAChB,MAAM;QACtB,iEAAiE;QACjE,2DAA2D;QAC3D,oEAAoE;QACpE,2EAA2E;QAC3E,0EAA0E;QAC1E,yEAAyE;QACzE,wEAAwE;QACxE,6EAA6E;QAC7E,4EAA4E;QAC5E,0EAA0E;QAC1E,MAAMiB,QAAQjB,IAAIkB,MAAM,CAAC,CAACC,OAASA,SAAS,QAAQA,SAASrB;QAC7D,MAAMsB,sBACJH,MAAMI,MAAM,GAAG,KACfJ,MAAMK,KAAK,CACT,CAACH,OAAS,OAAOA,SAAS,YAAY,OAAO,AAACA,KAAgClB,QAAQ,KAAK;QAE/F,IAAImB,qBAAqB;YACvBvB,UAAUgB,MAAM,CAACb;YACjB,OAAO,MAAMZ,sBAAsBC,cAAcC,UAAU,SAAUU;QACvE;QAEA,MAAMuB,MAAiB,EAAE;QACzB3B,MAAMa,GAAG,CAACT,KAAKuB;QACf,KAAK,MAAMJ,QAAQnB,IAAK;YACtBuB,IAAIC,IAAI,CAAC,MAAM/B,KAAK0B,MAAMvB,OAAOC;QACnC;QACAA,UAAUgB,MAAM,CAACb;QACjB,OAAOuB;IACT;IAEA,IAAIE,YAAYC,MAAM,CAAC1B,MAAM;QAC3BH,UAAUgB,MAAM,CAACb;QACjB,OAAOA;IACT;IAEA,MAAM2B,SAAkC,CAAC;IACzC/B,MAAMa,GAAG,CAACT,KAAK2B;IACf,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAAC9B,KAAM;QAClC,MAAMW,IAAI,MAAMlB,KAAKO,GAAG,CAAC4B,IAAI,EAAEhC,OAAOC;QACtC,IAAIc,MAAMb,WAAW;YACnB6B,MAAM,CAACC,IAAI,GAAGjB;QAChB;IACF;IACAd,UAAUgB,MAAM,CAACb;IACjB,OAAO2B;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"serverAdapter.server.d.ts","sourceRoot":"","sources":["../../src/utilities/serverAdapter.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,aAAa,EAAE,MAAM,SAAS,CAAA;AAsDxE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aA8CnC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,GAAI,KAAK,aAAa,KAAG,aAgBjE,CAAA"}
1
+ {"version":3,"file":"serverAdapter.server.d.ts","sourceRoot":"","sources":["../../src/utilities/serverAdapter.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,aAAa,EAAE,MAAM,SAAS,CAAA;AAsDxE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aA8CnC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B,QAAS,aAAa,KAAG,aAgBjE,CAAA"}
@@ -0,0 +1,29 @@
1
+ import type { ServerFunctionClient, ServerFunctionClientArgs } from 'payload';
2
+ /**
3
+ * Builds the client-side `ServerFunctionClient` wired into
4
+ * `RootProvider.serverFunction`, given the app's `createServerFn`-based
5
+ * dispatcher (`runServerFn`).
6
+ *
7
+ * Strips functions / symbols / RegExps / React elements from the args before
8
+ * dispatching: the previous `fetch + JSON.stringify` pipeline silently dropped
9
+ * those, but TanStack Start's seroval-based wire format errors instead. We
10
+ * mirror the relaxed behaviour so existing callers (e.g. `getFormState` in
11
+ * `ServerFunctionsProvider`) that may pass the live form state — which can
12
+ * carry stray functions — keep working without each call site sanitising.
13
+ *
14
+ * Delegates to `runServerFn`, so the response (including any RSC handles for
15
+ * server-rendered custom components) is decoded by TanStack Start back into
16
+ * renderable React nodes on the client.
17
+ */
18
+ export declare function createServerFunctionClient({ runServerFn, }: {
19
+ runServerFn: (input: {
20
+ data: ServerFunctionClientArgs;
21
+ }) => Promise<unknown>;
22
+ }): ServerFunctionClient;
23
+ /**
24
+ * Recursively removes values TanStack Start's seroval wire format cannot
25
+ * serialize (functions, symbols, RegExps, React elements, cyclic refs) and
26
+ * normalizes `Date` subclasses to plain `Date`.
27
+ */
28
+ export declare function stripUnserializable(value: unknown, cache?: WeakMap<object, unknown>, ancestors?: WeakSet<object>): unknown;
29
+ //# sourceMappingURL=serverFunctionClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverFunctionClient.d.ts","sourceRoot":"","sources":["../../src/utilities/serverFunctionClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAE7E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,wBAAwB,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC7E,GAAG,oBAAoB,CAKvB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAiB,EAC/C,SAAS,GAAE,OAAO,CAAC,MAAM,CAAiB,GACzC,OAAO,CA4FT"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Builds the client-side `ServerFunctionClient` wired into
3
+ * `RootProvider.serverFunction`, given the app's `createServerFn`-based
4
+ * dispatcher (`runServerFn`).
5
+ *
6
+ * Strips functions / symbols / RegExps / React elements from the args before
7
+ * dispatching: the previous `fetch + JSON.stringify` pipeline silently dropped
8
+ * those, but TanStack Start's seroval-based wire format errors instead. We
9
+ * mirror the relaxed behaviour so existing callers (e.g. `getFormState` in
10
+ * `ServerFunctionsProvider`) that may pass the live form state — which can
11
+ * carry stray functions — keep working without each call site sanitising.
12
+ *
13
+ * Delegates to `runServerFn`, so the response (including any RSC handles for
14
+ * server-rendered custom components) is decoded by TanStack Start back into
15
+ * renderable React nodes on the client.
16
+ */ export function createServerFunctionClient({ runServerFn }) {
17
+ return async (args)=>{
18
+ const safeArgs = stripUnserializable(args);
19
+ return await runServerFn({
20
+ data: safeArgs
21
+ });
22
+ };
23
+ }
24
+ /**
25
+ * Recursively removes values TanStack Start's seroval wire format cannot
26
+ * serialize (functions, symbols, RegExps, React elements, cyclic refs) and
27
+ * normalizes `Date` subclasses to plain `Date`.
28
+ */ export function stripUnserializable(value, cache = new WeakMap(), ancestors = new WeakSet()) {
29
+ if (value === null || value === undefined) {
30
+ return value;
31
+ }
32
+ const t = typeof value;
33
+ if (t === 'function' || t === 'symbol') {
34
+ return undefined;
35
+ }
36
+ if (t !== 'object') {
37
+ return value;
38
+ }
39
+ const obj = value;
40
+ if (typeof obj.$$typeof === 'symbol') {
41
+ return undefined;
42
+ }
43
+ if (ancestors.has(obj)) {
44
+ return undefined;
45
+ }
46
+ if (cache.has(obj)) {
47
+ return cache.get(obj);
48
+ }
49
+ if (obj instanceof Date) {
50
+ // Normalize to a plain `Date`. Subclasses (e.g. `@date-fns/tz`'s `TZDate`,
51
+ // used by the schedule-publish drawer) are `instanceof Date` but have a
52
+ // different `constructor`, which TanStack Start's seroval serializer
53
+ // rejects with "The value [object Date] ... cannot be parsed/serialized".
54
+ return new Date(obj.getTime());
55
+ }
56
+ if (obj instanceof RegExp) {
57
+ return undefined;
58
+ }
59
+ ancestors.add(obj);
60
+ if (obj instanceof Map) {
61
+ const cleaned = new Map();
62
+ cache.set(obj, cleaned);
63
+ for (const [k, v] of obj){
64
+ const cv = stripUnserializable(v, cache, ancestors);
65
+ if (cv !== undefined) {
66
+ cleaned.set(k, cv);
67
+ }
68
+ }
69
+ ancestors.delete(obj);
70
+ return cleaned;
71
+ }
72
+ if (obj instanceof Set) {
73
+ const cleaned = new Set();
74
+ cache.set(obj, cleaned);
75
+ for (const v of obj){
76
+ const cv = stripUnserializable(v, cache, ancestors);
77
+ if (cv !== undefined) {
78
+ cleaned.add(cv);
79
+ }
80
+ }
81
+ ancestors.delete(obj);
82
+ return cleaned;
83
+ }
84
+ if (Array.isArray(obj)) {
85
+ const arr = [];
86
+ cache.set(obj, arr);
87
+ for (const item of obj){
88
+ arr.push(stripUnserializable(item, cache, ancestors));
89
+ }
90
+ ancestors.delete(obj);
91
+ return arr;
92
+ }
93
+ if (ArrayBuffer.isView(obj)) {
94
+ ancestors.delete(obj);
95
+ return obj;
96
+ }
97
+ const result = {};
98
+ cache.set(obj, result);
99
+ for (const key of Object.keys(obj)){
100
+ const v = stripUnserializable(obj[key], cache, ancestors);
101
+ if (v !== undefined) {
102
+ result[key] = v;
103
+ }
104
+ }
105
+ ancestors.delete(obj);
106
+ return result;
107
+ }
108
+
109
+ //# sourceMappingURL=serverFunctionClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/serverFunctionClient.ts"],"sourcesContent":["import type { ServerFunctionClient, ServerFunctionClientArgs } from 'payload'\n\n/**\n * Builds the client-side `ServerFunctionClient` wired into\n * `RootProvider.serverFunction`, given the app's `createServerFn`-based\n * dispatcher (`runServerFn`).\n *\n * Strips functions / symbols / RegExps / React elements from the args before\n * dispatching: the previous `fetch + JSON.stringify` pipeline silently dropped\n * those, but TanStack Start's seroval-based wire format errors instead. We\n * mirror the relaxed behaviour so existing callers (e.g. `getFormState` in\n * `ServerFunctionsProvider`) that may pass the live form state — which can\n * carry stray functions — keep working without each call site sanitising.\n *\n * Delegates to `runServerFn`, so the response (including any RSC handles for\n * server-rendered custom components) is decoded by TanStack Start back into\n * renderable React nodes on the client.\n */\nexport function createServerFunctionClient({\n runServerFn,\n}: {\n runServerFn: (input: { data: ServerFunctionClientArgs }) => Promise<unknown>\n}): ServerFunctionClient {\n return (async (args: ServerFunctionClientArgs) => {\n const safeArgs = stripUnserializable(args) as ServerFunctionClientArgs\n return await runServerFn({ data: safeArgs })\n }) as ServerFunctionClient\n}\n\n/**\n * Recursively removes values TanStack Start's seroval wire format cannot\n * serialize (functions, symbols, RegExps, React elements, cyclic refs) and\n * normalizes `Date` subclasses to plain `Date`.\n */\nexport function stripUnserializable(\n value: unknown,\n cache: WeakMap<object, unknown> = new WeakMap(),\n ancestors: WeakSet<object> = new WeakSet(),\n): unknown {\n if (value === null || value === undefined) {\n return value\n }\n\n const t = typeof value\n if (t === 'function' || t === 'symbol') {\n return undefined\n }\n if (t !== 'object') {\n return value\n }\n\n const obj = value as Record<string, unknown>\n\n if (typeof obj.$$typeof === 'symbol') {\n return undefined\n }\n\n if (ancestors.has(obj)) {\n return undefined\n }\n\n if (cache.has(obj)) {\n return cache.get(obj)\n }\n\n if (obj instanceof Date) {\n // Normalize to a plain `Date`. Subclasses (e.g. `@date-fns/tz`'s `TZDate`,\n // used by the schedule-publish drawer) are `instanceof Date` but have a\n // different `constructor`, which TanStack Start's seroval serializer\n // rejects with \"The value [object Date] ... cannot be parsed/serialized\".\n return new Date(obj.getTime())\n }\n\n if (obj instanceof RegExp) {\n return undefined\n }\n\n ancestors.add(obj)\n\n if (obj instanceof Map) {\n const cleaned = new Map()\n cache.set(obj, cleaned)\n for (const [k, v] of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.set(k, cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (obj instanceof Set) {\n const cleaned = new Set()\n cache.set(obj, cleaned)\n for (const v of obj) {\n const cv = stripUnserializable(v, cache, ancestors)\n if (cv !== undefined) {\n cleaned.add(cv)\n }\n }\n ancestors.delete(obj)\n return cleaned\n }\n\n if (Array.isArray(obj)) {\n const arr: unknown[] = []\n cache.set(obj, arr)\n for (const item of obj) {\n arr.push(stripUnserializable(item, cache, ancestors))\n }\n ancestors.delete(obj)\n return arr\n }\n\n if (ArrayBuffer.isView(obj)) {\n ancestors.delete(obj)\n return obj\n }\n\n const result: Record<string, unknown> = {}\n cache.set(obj, result)\n for (const key of Object.keys(obj)) {\n const v = stripUnserializable(obj[key], cache, ancestors)\n if (v !== undefined) {\n result[key] = v\n }\n }\n ancestors.delete(obj)\n return result\n}\n"],"names":["createServerFunctionClient","runServerFn","args","safeArgs","stripUnserializable","data","value","cache","WeakMap","ancestors","WeakSet","undefined","t","obj","$$typeof","has","get","Date","getTime","RegExp","add","Map","cleaned","set","k","v","cv","delete","Set","Array","isArray","arr","item","push","ArrayBuffer","isView","result","key","Object","keys"],"mappings":"AAEA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,SAASA,2BAA2B,EACzCC,WAAW,EAGZ;IACC,OAAQ,OAAOC;QACb,MAAMC,WAAWC,oBAAoBF;QACrC,OAAO,MAAMD,YAAY;YAAEI,MAAMF;QAAS;IAC5C;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASC,oBACdE,KAAc,EACdC,QAAkC,IAAIC,SAAS,EAC/CC,YAA6B,IAAIC,SAAS;IAE1C,IAAIJ,UAAU,QAAQA,UAAUK,WAAW;QACzC,OAAOL;IACT;IAEA,MAAMM,IAAI,OAAON;IACjB,IAAIM,MAAM,cAAcA,MAAM,UAAU;QACtC,OAAOD;IACT;IACA,IAAIC,MAAM,UAAU;QAClB,OAAON;IACT;IAEA,MAAMO,MAAMP;IAEZ,IAAI,OAAOO,IAAIC,QAAQ,KAAK,UAAU;QACpC,OAAOH;IACT;IAEA,IAAIF,UAAUM,GAAG,CAACF,MAAM;QACtB,OAAOF;IACT;IAEA,IAAIJ,MAAMQ,GAAG,CAACF,MAAM;QAClB,OAAON,MAAMS,GAAG,CAACH;IACnB;IAEA,IAAIA,eAAeI,MAAM;QACvB,2EAA2E;QAC3E,wEAAwE;QACxE,qEAAqE;QACrE,0EAA0E;QAC1E,OAAO,IAAIA,KAAKJ,IAAIK,OAAO;IAC7B;IAEA,IAAIL,eAAeM,QAAQ;QACzB,OAAOR;IACT;IAEAF,UAAUW,GAAG,CAACP;IAEd,IAAIA,eAAeQ,KAAK;QACtB,MAAMC,UAAU,IAAID;QACpBd,MAAMgB,GAAG,CAACV,KAAKS;QACf,KAAK,MAAM,CAACE,GAAGC,EAAE,IAAIZ,IAAK;YACxB,MAAMa,KAAKtB,oBAAoBqB,GAAGlB,OAAOE;YACzC,IAAIiB,OAAOf,WAAW;gBACpBW,QAAQC,GAAG,CAACC,GAAGE;YACjB;QACF;QACAjB,UAAUkB,MAAM,CAACd;QACjB,OAAOS;IACT;IAEA,IAAIT,eAAee,KAAK;QACtB,MAAMN,UAAU,IAAIM;QACpBrB,MAAMgB,GAAG,CAACV,KAAKS;QACf,KAAK,MAAMG,KAAKZ,IAAK;YACnB,MAAMa,KAAKtB,oBAAoBqB,GAAGlB,OAAOE;YACzC,IAAIiB,OAAOf,WAAW;gBACpBW,QAAQF,GAAG,CAACM;YACd;QACF;QACAjB,UAAUkB,MAAM,CAACd;QACjB,OAAOS;IACT;IAEA,IAAIO,MAAMC,OAAO,CAACjB,MAAM;QACtB,MAAMkB,MAAiB,EAAE;QACzBxB,MAAMgB,GAAG,CAACV,KAAKkB;QACf,KAAK,MAAMC,QAAQnB,IAAK;YACtBkB,IAAIE,IAAI,CAAC7B,oBAAoB4B,MAAMzB,OAAOE;QAC5C;QACAA,UAAUkB,MAAM,CAACd;QACjB,OAAOkB;IACT;IAEA,IAAIG,YAAYC,MAAM,CAACtB,MAAM;QAC3BJ,UAAUkB,MAAM,CAACd;QACjB,OAAOA;IACT;IAEA,MAAMuB,SAAkC,CAAC;IACzC7B,MAAMgB,GAAG,CAACV,KAAKuB;IACf,KAAK,MAAMC,OAAOC,OAAOC,IAAI,CAAC1B,KAAM;QAClC,MAAMY,IAAIrB,oBAAoBS,GAAG,CAACwB,IAAI,EAAE9B,OAAOE;QAC/C,IAAIgB,MAAMd,WAAW;YACnByB,MAAM,CAACC,IAAI,GAAGZ;QAChB;IACF;IACAhB,UAAUkB,MAAM,CAACd;IACjB,OAAOuB;AACT"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * SSR/RSC externalization config used by `withPayload`. Kept separate from the
3
+ * client optimizer config (`./optimizeDeps.ts`) so each concern stays small.
4
+ */
5
+ /**
6
+ * Server-only packages (Node-only or only ever used by the server bundle).
7
+ * These are the Vite equivalent of Next.js's `serverExternalPackages`.
8
+ */
9
+ export declare const ssrExternalPackages: string[];
10
+ export declare const payloadNoExternalPatterns: Array<RegExp | string>;
11
+ //# sourceMappingURL=external.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/vite/config/external.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,EA+BvC,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO5D,CAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * SSR/RSC externalization config used by `withPayload`. Kept separate from the
3
+ * client optimizer config (`./optimizeDeps.ts`) so each concern stays small.
4
+ */ /**
5
+ * Server-only packages (Node-only or only ever used by the server bundle).
6
+ * These are the Vite equivalent of Next.js's `serverExternalPackages`.
7
+ */ export const ssrExternalPackages = [
8
+ 'ajv',
9
+ 'fast-uri',
10
+ 'drizzle-kit',
11
+ 'drizzle-kit/api',
12
+ 'drizzle-orm',
13
+ 'sharp',
14
+ 'require-in-the-middle',
15
+ 'json-schema-to-typescript',
16
+ 'pino',
17
+ 'pino-pretty',
18
+ 'graphql',
19
+ 'nodemailer',
20
+ 'aws4',
21
+ 'pluralize',
22
+ 'console-table-printer',
23
+ '@azure/storage-blob',
24
+ '@aws-sdk/client-s3',
25
+ '@aws-sdk/s3-request-presigner',
26
+ '@google-cloud/storage',
27
+ // Database drivers + their lazily-required companions, one group per adapter.
28
+ // Postgres (`@payloadcms/db-postgres`, `@payloadcms/db-vercel-postgres`)
29
+ 'pg',
30
+ 'pg-native',
31
+ 'pg-cloudflare',
32
+ // SQLite (`@payloadcms/db-sqlite`)
33
+ 'better-sqlite3',
34
+ 'libsql',
35
+ // Mongo (`@payloadcms/db-mongodb`)
36
+ 'mongodb',
37
+ 'mongoose'
38
+ ];
39
+ export const payloadNoExternalPatterns = [
40
+ '@payloadcms/ui',
41
+ '@payloadcms/translations',
42
+ '@payloadcms/tanstack-start',
43
+ /^@payloadcms\/richtext-lexical/,
44
+ /^@payloadcms\/plugin-/,
45
+ /^@payloadcms\/storage-/
46
+ ];
47
+
48
+ //# sourceMappingURL=external.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/vite/config/external.ts"],"sourcesContent":["/**\n * SSR/RSC externalization config used by `withPayload`. Kept separate from the\n * client optimizer config (`./optimizeDeps.ts`) so each concern stays small.\n */\n\n/**\n * Server-only packages (Node-only or only ever used by the server bundle).\n * These are the Vite equivalent of Next.js's `serverExternalPackages`.\n */\nexport const ssrExternalPackages: string[] = [\n 'ajv',\n 'fast-uri',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'drizzle-orm',\n 'sharp',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n 'pino',\n 'pino-pretty',\n 'graphql',\n 'nodemailer',\n 'aws4',\n 'pluralize',\n 'console-table-printer',\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n // Database drivers + their lazily-required companions, one group per adapter.\n // Postgres (`@payloadcms/db-postgres`, `@payloadcms/db-vercel-postgres`)\n 'pg',\n 'pg-native',\n 'pg-cloudflare',\n // SQLite (`@payloadcms/db-sqlite`)\n 'better-sqlite3',\n 'libsql',\n // Mongo (`@payloadcms/db-mongodb`)\n 'mongodb',\n 'mongoose',\n]\n\nexport const payloadNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\n /^@payloadcms\\/plugin-/,\n /^@payloadcms\\/storage-/,\n]\n"],"names":["ssrExternalPackages","payloadNoExternalPatterns"],"mappings":"AAAA;;;CAGC,GAED;;;CAGC,GACD,OAAO,MAAMA,sBAAgC;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,8EAA8E;IAC9E,yEAAyE;IACzE;IACA;IACA;IACA,mCAAmC;IACnC;IACA;IACA,mCAAmC;IACnC;IACA;CACD,CAAA;AAED,OAAO,MAAMC,4BAAoD;IAC/D;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Client dep-optimizer config used by `withPayload`. Kept separate from the
3
+ * SSR/RSC externalization config (`./external.ts`) so each concern stays small.
4
+ */
5
+ /**
6
+ * Packages we know contain Node-only code or top-level side effects requiring
7
+ * Node APIs. Excluding them from the client optimizer prevents Vite from
8
+ * walking into their main entries and trying to bundle server-only imports
9
+ * for the browser.
10
+ */
11
+ export declare const optimizeDepsExcludeDefaults: string[];
12
+ /**
13
+ * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
14
+ * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
15
+ * these up because their parent packages are in `optimizeDeps.exclude`, so we
16
+ * list them explicitly using the `parent > child` syntax.
17
+ *
18
+ * Each entry below fixes a specific late-discovery re-optimization: without it,
19
+ * Vite discovers the dep *after* its initial crawl, forcing a full dep
20
+ * re-optimization mid-session that 404s in-flight `.vite/deps/*` chunks and
21
+ * remounts the admin (dropping client state). This is why the list can't simply
22
+ * be deleted — it is the "complete first pass" for the admin's dep graph.
23
+ */
24
+ export declare const optimizeDepsIncludeDefaults: string[];
25
+ //# sourceMappingURL=optimizeDeps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimizeDeps.d.ts","sourceRoot":"","sources":["../../../src/vite/config/optimizeDeps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAsB/C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EA8E/C,CAAA"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Client dep-optimizer config used by `withPayload`. Kept separate from the
3
+ * SSR/RSC externalization config (`./external.ts`) so each concern stays small.
4
+ */ /**
5
+ * Packages we know contain Node-only code or top-level side effects requiring
6
+ * Node APIs. Excluding them from the client optimizer prevents Vite from
7
+ * walking into their main entries and trying to bundle server-only imports
8
+ * for the browser.
9
+ */ export const optimizeDepsExcludeDefaults = [
10
+ 'sharp',
11
+ '@payloadcms/ui',
12
+ '@payloadcms/tanstack-start',
13
+ 'payload',
14
+ 'pino',
15
+ 'pino-pretty',
16
+ 'busboy',
17
+ 'get-tsconfig',
18
+ 'ws',
19
+ 'croner',
20
+ 'prompts',
21
+ 'file-type',
22
+ // Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite
23
+ // sometimes walks these from the main package entry while scanning
24
+ // workspace deps, and the browser sub-bundles do not expose the
25
+ // server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev
26
+ // server with a `MISSING_EXPORT` error before any test runs.
27
+ '@azure/storage-blob',
28
+ '@aws-sdk/client-s3',
29
+ '@aws-sdk/s3-request-presigner',
30
+ '@google-cloud/storage'
31
+ ];
32
+ /**
33
+ * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
34
+ * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
35
+ * these up because their parent packages are in `optimizeDeps.exclude`, so we
36
+ * list them explicitly using the `parent > child` syntax.
37
+ *
38
+ * Each entry below fixes a specific late-discovery re-optimization: without it,
39
+ * Vite discovers the dep *after* its initial crawl, forcing a full dep
40
+ * re-optimization mid-session that 404s in-flight `.vite/deps/*` chunks and
41
+ * remounts the admin (dropping client state). This is why the list can't simply
42
+ * be deleted — it is the "complete first pass" for the admin's dep graph.
43
+ */ export const optimizeDepsIncludeDefaults = [
44
+ '@payloadcms/ui > sonner',
45
+ '@payloadcms/ui > @faceless-ui/modal',
46
+ '@payloadcms/ui > @faceless-ui/window-info',
47
+ '@payloadcms/ui > @faceless-ui/scroll-info',
48
+ '@payloadcms/ui > @dnd-kit/core',
49
+ '@payloadcms/ui > @dnd-kit/sortable',
50
+ '@payloadcms/ui > @dnd-kit/utilities',
51
+ '@payloadcms/ui > react-datepicker',
52
+ '@payloadcms/ui > react-select',
53
+ '@payloadcms/ui > react-select/creatable',
54
+ '@payloadcms/ui > react-image-crop',
55
+ '@payloadcms/ui > @monaco-editor/react',
56
+ '@payloadcms/ui > date-fns',
57
+ '@payloadcms/ui > date-fns/transpose',
58
+ '@payloadcms/ui > @date-fns/tz/date/mini',
59
+ '@payloadcms/ui > uuid',
60
+ '@payloadcms/ui > use-context-selector',
61
+ '@payloadcms/ui > bson-objectid',
62
+ '@payloadcms/ui > dequal',
63
+ '@payloadcms/ui > object-to-formdata',
64
+ '@payloadcms/ui > md5',
65
+ 'payload > deepmerge',
66
+ 'payload > pluralize',
67
+ // `scheduler` is a transitive dep of `react-dom`, not a direct dependency of
68
+ // the app, so a bare `'scheduler'` specifier fails to resolve from an isolated
69
+ // install (`test/node_modules` built with `pnpm i --ignore-workspace`), where
70
+ // it isn't hoisted to the top level. Path it through `react-dom` so the
71
+ // optimizer resolves the exact copy the runtime loads.
72
+ 'react-dom > scheduler',
73
+ // `@payloadcms/ui` (in `optimizeDeps.exclude`) ships compiled output that the
74
+ // React Compiler rewrote to `import { c } from 'react/compiler-runtime'`.
75
+ // Because its parent is excluded, the optimizer never crawls in to discover
76
+ // this entry, so Vite serves `react/compiler-runtime` raw. That file is
77
+ // CommonJS (`module.exports = require(...)`), so the named `c` export can't be
78
+ // statically extracted and every client component throws "does not provide an
79
+ // export named 'c'". Pre-bundling it lets esbuild synthesize the named export.
80
+ 'react/compiler-runtime',
81
+ // Transitive deps that Vite otherwise discovers *after* the initial crawl
82
+ // (react-select pulls in @floating-ui at runtime; react-is is reached via
83
+ // react-transition-group/prop-types; the default date-fns locale is loaded
84
+ // through a dynamic `date-fns/locale/${key}` import). A late discovery forces
85
+ // a full dep re-optimization mid-session, which 404s every in-flight
86
+ // `.vite/deps/*` chunk ("Pre-transform error: file does not exist in the
87
+ // optimize deps directory") and breaks the admin UI in CI cold starts.
88
+ // Pre-bundling them keeps the first optimization pass complete.
89
+ '@payloadcms/ui > react-select > @floating-ui/dom',
90
+ '@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',
91
+ '@payloadcms/ui > react-select > prop-types > react-is',
92
+ '@payloadcms/ui > date-fns/locale/en-US',
93
+ // Further late discoveries observed re-optimizing mid-run in CI cold starts
94
+ // (see CI logs: "✨ new dependencies optimized: @dnd-kit/modifiers / ajv /
95
+ // dequal/lite"). The modular dashboard pulls in `@dnd-kit/modifiers` on first
96
+ // render; form-state diffing reaches `dequal/lite` (a distinct entry point
97
+ // from the already-listed `dequal`); client-side field validation reaches
98
+ // `ajv` *through `payload`* — it is `ssrExternal` server-side but still
99
+ // bundled into the client, and must be pathed via `payload` so the optimizer
100
+ // pre-bundles the exact copy the runtime loads.
101
+ '@payloadcms/ui > @dnd-kit/modifiers',
102
+ '@payloadcms/ui > dequal/lite',
103
+ 'payload > ajv',
104
+ // The storage client-upload suites (esp. vercel-blob) crawl part of the
105
+ // `payload` server runtime into the client bundle and discover these late,
106
+ // triggering several "optimized dependencies changed. reloading" waves that
107
+ // reload the page mid-test (the bulk-upload drawer's Create New button /
108
+ // dropzone vanish and the direct-to-bucket PUT never fires). Pre-bundle the
109
+ // whole observed set so the first pass is complete.
110
+ 'payload > undici',
111
+ 'payload > jose',
112
+ 'payload > dataloader',
113
+ 'payload > path-to-regexp',
114
+ 'payload > console-table-printer',
115
+ 'payload > ci-info',
116
+ 'payload > image-size',
117
+ 'payload > image-size/fromFile',
118
+ 'payload > ipaddr.js',
119
+ 'payload > range-parser',
120
+ 'payload > sanitize-filename'
121
+ ];
122
+
123
+ //# sourceMappingURL=optimizeDeps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/vite/config/optimizeDeps.ts"],"sourcesContent":["/**\n * Client dep-optimizer config used by `withPayload`. Kept separate from the\n * SSR/RSC externalization config (`./external.ts`) so each concern stays small.\n */\n\n/**\n * Packages we know contain Node-only code or top-level side effects requiring\n * Node APIs. Excluding them from the client optimizer prevents Vite from\n * walking into their main entries and trying to bundle server-only imports\n * for the browser.\n */\nexport const optimizeDepsExcludeDefaults: string[] = [\n 'sharp',\n '@payloadcms/ui',\n '@payloadcms/tanstack-start',\n 'payload',\n 'pino',\n 'pino-pretty',\n 'busboy',\n 'get-tsconfig',\n 'ws',\n 'croner',\n 'prompts',\n 'file-type',\n // Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite\n // sometimes walks these from the main package entry while scanning\n // workspace deps, and the browser sub-bundles do not expose the\n // server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev\n // server with a `MISSING_EXPORT` error before any test runs.\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be\n * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick\n * these up because their parent packages are in `optimizeDeps.exclude`, so we\n * list them explicitly using the `parent > child` syntax.\n *\n * Each entry below fixes a specific late-discovery re-optimization: without it,\n * Vite discovers the dep *after* its initial crawl, forcing a full dep\n * re-optimization mid-session that 404s in-flight `.vite/deps/*` chunks and\n * remounts the admin (dropping client state). This is why the list can't simply\n * be deleted — it is the \"complete first pass\" for the admin's dep graph.\n */\nexport const optimizeDepsIncludeDefaults: string[] = [\n '@payloadcms/ui > sonner',\n '@payloadcms/ui > @faceless-ui/modal',\n '@payloadcms/ui > @faceless-ui/window-info',\n '@payloadcms/ui > @faceless-ui/scroll-info',\n '@payloadcms/ui > @dnd-kit/core',\n '@payloadcms/ui > @dnd-kit/sortable',\n '@payloadcms/ui > @dnd-kit/utilities',\n '@payloadcms/ui > react-datepicker',\n '@payloadcms/ui > react-select',\n '@payloadcms/ui > react-select/creatable',\n '@payloadcms/ui > react-image-crop',\n '@payloadcms/ui > @monaco-editor/react',\n '@payloadcms/ui > date-fns',\n '@payloadcms/ui > date-fns/transpose',\n '@payloadcms/ui > @date-fns/tz/date/mini',\n '@payloadcms/ui > uuid',\n '@payloadcms/ui > use-context-selector',\n '@payloadcms/ui > bson-objectid',\n '@payloadcms/ui > dequal',\n '@payloadcms/ui > object-to-formdata',\n '@payloadcms/ui > md5',\n 'payload > deepmerge',\n 'payload > pluralize',\n // `scheduler` is a transitive dep of `react-dom`, not a direct dependency of\n // the app, so a bare `'scheduler'` specifier fails to resolve from an isolated\n // install (`test/node_modules` built with `pnpm i --ignore-workspace`), where\n // it isn't hoisted to the top level. Path it through `react-dom` so the\n // optimizer resolves the exact copy the runtime loads.\n 'react-dom > scheduler',\n // `@payloadcms/ui` (in `optimizeDeps.exclude`) ships compiled output that the\n // React Compiler rewrote to `import { c } from 'react/compiler-runtime'`.\n // Because its parent is excluded, the optimizer never crawls in to discover\n // this entry, so Vite serves `react/compiler-runtime` raw. That file is\n // CommonJS (`module.exports = require(...)`), so the named `c` export can't be\n // statically extracted and every client component throws \"does not provide an\n // export named 'c'\". Pre-bundling it lets esbuild synthesize the named export.\n 'react/compiler-runtime',\n // Transitive deps that Vite otherwise discovers *after* the initial crawl\n // (react-select pulls in @floating-ui at runtime; react-is is reached via\n // react-transition-group/prop-types; the default date-fns locale is loaded\n // through a dynamic `date-fns/locale/${key}` import). A late discovery forces\n // a full dep re-optimization mid-session, which 404s every in-flight\n // `.vite/deps/*` chunk (\"Pre-transform error: file does not exist in the\n // optimize deps directory\") and breaks the admin UI in CI cold starts.\n // Pre-bundling them keeps the first optimization pass complete.\n '@payloadcms/ui > react-select > @floating-ui/dom',\n '@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',\n '@payloadcms/ui > react-select > prop-types > react-is',\n '@payloadcms/ui > date-fns/locale/en-US',\n // Further late discoveries observed re-optimizing mid-run in CI cold starts\n // (see CI logs: \"✨ new dependencies optimized: @dnd-kit/modifiers / ajv /\n // dequal/lite\"). The modular dashboard pulls in `@dnd-kit/modifiers` on first\n // render; form-state diffing reaches `dequal/lite` (a distinct entry point\n // from the already-listed `dequal`); client-side field validation reaches\n // `ajv` *through `payload`* — it is `ssrExternal` server-side but still\n // bundled into the client, and must be pathed via `payload` so the optimizer\n // pre-bundles the exact copy the runtime loads.\n '@payloadcms/ui > @dnd-kit/modifiers',\n '@payloadcms/ui > dequal/lite',\n 'payload > ajv',\n // The storage client-upload suites (esp. vercel-blob) crawl part of the\n // `payload` server runtime into the client bundle and discover these late,\n // triggering several \"optimized dependencies changed. reloading\" waves that\n // reload the page mid-test (the bulk-upload drawer's Create New button /\n // dropzone vanish and the direct-to-bucket PUT never fires). Pre-bundle the\n // whole observed set so the first pass is complete.\n 'payload > undici',\n 'payload > jose',\n 'payload > dataloader',\n 'payload > path-to-regexp',\n 'payload > console-table-printer',\n 'payload > ci-info',\n 'payload > image-size',\n 'payload > image-size/fromFile',\n 'payload > ipaddr.js',\n 'payload > range-parser',\n 'payload > sanitize-filename',\n]\n"],"names":["optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults"],"mappings":"AAAA;;;CAGC,GAED;;;;;CAKC,GACD,OAAO,MAAMA,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,kEAAkE;IAClE,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,6DAA6D;IAC7D;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,6EAA6E;IAC7E,+EAA+E;IAC/E,8EAA8E;IAC9E,wEAAwE;IACxE,uDAAuD;IACvD;IACA,8EAA8E;IAC9E,0EAA0E;IAC1E,4EAA4E;IAC5E,wEAAwE;IACxE,+EAA+E;IAC/E,8EAA8E;IAC9E,+EAA+E;IAC/E;IACA,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,8EAA8E;IAC9E,qEAAqE;IACrE,yEAAyE;IACzE,uEAAuE;IACvE,gEAAgE;IAChE;IACA;IACA;IACA;IACA,4EAA4E;IAC5E,0EAA0E;IAC1E,8EAA8E;IAC9E,2EAA2E;IAC3E,0EAA0E;IAC1E,wEAAwE;IACxE,6EAA6E;IAC7E,gDAAgD;IAChD;IACA;IACA;IACA,wEAAwE;IACxE,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,4EAA4E;IAC5E,oDAAoD;IACpD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * SCSS `@import`/`@use` importers applied for every Payload consumer.
3
+ *
4
+ * Resolves webpack-style `~@payloadcms/...` tilde specifiers (emitted by
5
+ * first-party Payload package styles, e.g. `@payloadcms/richtext-slate`) to the
6
+ * installed package via Node resolution. Because it goes through the package's
7
+ * `exports` map, it picks the workspace `src` scss in the monorepo and the
8
+ * published `dist` scss in a consumer install automatically — no per-app
9
+ * `findFileUrl` shim needed.
10
+ */
11
+ export declare const payloadScssImporters: {
12
+ findFileUrl(url: string): null | URL;
13
+ }[];
14
+ //# sourceMappingURL=scss.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scss.d.ts","sourceRoot":"","sources":["../../../src/vite/config/scss.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;qBAEZ,MAAM,GAAG,IAAI,GAAG,GAAG;GAWvC,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { createRequire } from 'node:module';
2
+ import { pathToFileURL } from 'node:url';
3
+ const require = createRequire(import.meta.url);
4
+ /**
5
+ * SCSS `@import`/`@use` importers applied for every Payload consumer.
6
+ *
7
+ * Resolves webpack-style `~@payloadcms/...` tilde specifiers (emitted by
8
+ * first-party Payload package styles, e.g. `@payloadcms/richtext-slate`) to the
9
+ * installed package via Node resolution. Because it goes through the package's
10
+ * `exports` map, it picks the workspace `src` scss in the monorepo and the
11
+ * published `dist` scss in a consumer install automatically — no per-app
12
+ * `findFileUrl` shim needed.
13
+ */ export const payloadScssImporters = [
14
+ {
15
+ findFileUrl (url) {
16
+ if (!url.startsWith('~@payloadcms/')) {
17
+ return null;
18
+ }
19
+ try {
20
+ return pathToFileURL(require.resolve(url.slice(1)));
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+ }
26
+ ];
27
+
28
+ //# sourceMappingURL=scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/vite/config/scss.ts"],"sourcesContent":["import { createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * SCSS `@import`/`@use` importers applied for every Payload consumer.\n *\n * Resolves webpack-style `~@payloadcms/...` tilde specifiers (emitted by\n * first-party Payload package styles, e.g. `@payloadcms/richtext-slate`) to the\n * installed package via Node resolution. Because it goes through the package's\n * `exports` map, it picks the workspace `src` scss in the monorepo and the\n * published `dist` scss in a consumer install automatically — no per-app\n * `findFileUrl` shim needed.\n */\nexport const payloadScssImporters = [\n {\n findFileUrl(url: string): null | URL {\n if (!url.startsWith('~@payloadcms/')) {\n return null\n }\n try {\n return pathToFileURL(require.resolve(url.slice(1)))\n } catch {\n return null\n }\n },\n },\n]\n"],"names":["createRequire","pathToFileURL","require","url","payloadScssImporters","findFileUrl","startsWith","resolve","slice"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAa;AAC3C,SAASC,aAAa,QAAQ,WAAU;AAExC,MAAMC,UAAUF,cAAc,YAAYG,GAAG;AAE7C;;;;;;;;;CASC,GACD,OAAO,MAAMC,uBAAuB;IAClC;QACEC,aAAYF,GAAW;YACrB,IAAI,CAACA,IAAIG,UAAU,CAAC,kBAAkB;gBACpC,OAAO;YACT;YACA,IAAI;gBACF,OAAOL,cAAcC,QAAQK,OAAO,CAACJ,IAAIK,KAAK,CAAC;YACjD,EAAE,OAAM;gBACN,OAAO;YACT;QACF;IACF;CACD,CAAA"}
@@ -0,0 +1,99 @@
1
+ import type { ConfigEnv, UserConfig, UserConfigFnObject } from 'vite';
2
+ import { tanstackStart } from '@tanstack/react-start/plugin/vite';
3
+ import viteReact from '@vitejs/plugin-react';
4
+ import rsc from '@vitejs/plugin-rsc';
5
+ export type WithPayloadOptions = {
6
+ /** Extra import-protection `ignoreImporters` patterns for the TanStack Start plugin. */
7
+ additionalIgnoreImporters?: RegExp[];
8
+ /** Route id of Payload's admin layout, eager-loaded instead of code-split. Defaults to `'/_payload'`. */
9
+ adminRouteId?: string;
10
+ /** Extra globs exempted from the `.client.*` SSR denial (beyond the default node_modules exemption). */
11
+ clientDenialExcludeFiles?: string[];
12
+ /** Path to the user's `payload.config.ts` (required) */
13
+ payloadConfigPath: string;
14
+ /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'` */
15
+ routesDirectory?: string;
16
+ /** Silence Vite warnings about third-party dependency sourcemaps. Defaults to `true`. */
17
+ silenceDependencyWarnings?: boolean;
18
+ /** TanStack source directory. Defaults to `'src'` */
19
+ srcDirectory?: string;
20
+ /** Extra Vite config deep-merged over the Payload defaults. Ignored in `build` mode. */
21
+ vite?: UserConfig;
22
+ };
23
+ /** The options Payload's admin requires for each third-party plugin. */
24
+ export type PayloadPluginOptions = {
25
+ react: NonNullable<Parameters<typeof viteReact>[0]>;
26
+ rsc: NonNullable<Parameters<typeof rsc>[0]>;
27
+ tanstackStart: NonNullable<Parameters<typeof tanstackStart>[0]>;
28
+ };
29
+ export type WithPayloadBuilderContext = {
30
+ env: ConfigEnv;
31
+ /** Options to pass to the `viteReact`/`rsc`/`tanstackStart` factories you import. */
32
+ pluginOptions: PayloadPluginOptions;
33
+ };
34
+ /**
35
+ * Returns the extra Vite config — the plugins you instantiate plus any overrides.
36
+ * `withPayload` deep-merges it onto Payload's base config, so you don't spread or
37
+ * merge the base yourself.
38
+ */
39
+ export type WithPayloadBuilder = (context: WithPayloadBuilderContext) => UserConfig;
40
+ /**
41
+ * Vite config helper for Payload + TanStack Start; the counterpart to Next.js'
42
+ * `withPayload`.
43
+ *
44
+ * Zero-config — Payload instantiates the RSC, React, and TanStack Start plugins:
45
+ *
46
+ * ```ts
47
+ * export default withPayload(undefined, { payloadConfigPath: './src/payload.config.ts' })
48
+ * ```
49
+ *
50
+ * Guest mode — pass a `build` callback to instantiate them yourself (one copy of
51
+ * each; `@vitejs/plugin-rsc` is a hard singleton). Return only your additions;
52
+ * `withPayload` deep-merges them onto Payload's base config:
53
+ *
54
+ * ```ts
55
+ * export default withPayload(
56
+ * ({ pluginOptions }) => ({
57
+ * plugins: [
58
+ * rsc(pluginOptions.rsc),
59
+ * tanstackStart(pluginOptions.tanstackStart),
60
+ * viteReact(pluginOptions.react),
61
+ * ],
62
+ * // ...other config options
63
+ * }),
64
+ * { payloadConfigPath: './src/payload.config.ts' },
65
+ * )
66
+ * ```
67
+ */
68
+ export declare function withPayload(build: undefined | WithPayloadBuilder, options: WithPayloadOptions): UserConfigFnObject;
69
+ /** `@vitejs/plugin-rsc` options for Payload: `serverHandler: false` (TanStack owns the handler). */
70
+ export declare function payloadRscOptions(): NonNullable<Parameters<typeof rsc>[0]>;
71
+ /** `@vitejs/plugin-react` options for Payload: transform every `.[jt]sx?` file. */
72
+ export declare function payloadReactOptions(): NonNullable<Parameters<typeof viteReact>[0]>;
73
+ export type PayloadTanstackStartOptionsArgs = {
74
+ /** Additional import-protection `ignoreImporters` patterns. */
75
+ additionalIgnoreImporters?: RegExp[];
76
+ /**
77
+ * Route id of Payload's admin layout route, eager-loaded (not code-split) so it
78
+ * hydrates on first paint. It and its children skip splitting; host routes keep
79
+ * TanStack's default. Defaults to `'/_payload'` (the `_payload.tsx` convention).
80
+ */
81
+ adminRouteId?: string;
82
+ /**
83
+ * Extra globs exempted from TanStack's `.client.*` SSR denial, on top of the
84
+ * default node_modules exemption. Needed only when Payload's own `.client.*`
85
+ * files resolve outside node_modules (e.g. the monorepo's `packages` sources).
86
+ */
87
+ clientDenialExcludeFiles?: string[];
88
+ /** TanStack router routes directory relative to `srcDirectory`. Defaults to `'app'`. */
89
+ routesDirectory?: string;
90
+ /** TanStack source directory. Defaults to `'src'`. */
91
+ srcDirectory?: string;
92
+ };
93
+ /**
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
96
+ * should merge these into its single `tanstackStart` call.
97
+ */
98
+ export declare function payloadTanstackStartOptions(args?: PayloadTanstackStartOptionsArgs): NonNullable<Parameters<typeof tanstackStart>[0]>;
99
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAwB,UAAU,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AAI3F,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AACjE,OAAO,SAAS,MAAM,sBAAsB,CAAA;AAC5C,OAAO,GAAG,MAAM,oBAAoB,CAAA;AA0DpC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,wFAAwF;IACxF,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAA;IACpC,yGAAyG;IACzG,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wGAAwG;IACxG,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,wDAAwD;IACxD,iBAAiB,EAAE,MAAM,CAAA;IACzB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yFAAyF;IACzF,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wFAAwF;IACxF,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED,wEAAwE;AACxE,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACnD,GAAG,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3C,aAAa,EAAE,WAAW,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;CAChE,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,SAAS,CAAA;IACd,qFAAqF;IACrF,aAAa,EAAE,oBAAoB,CAAA;CACpC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,yBAAyB,KAAK,UAAU,CAAA;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,GAAG,kBAAkB,EACrC,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,CAqGpB;AAED,oGAAoG;AACpG,wBAAgB,iBAAiB,IAAI,WAAW,CAAC,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAE1E;AAED,mFAAmF;AACnF,wBAAgB,mBAAmB,IAAI,WAAW,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAElF;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,+DAA+D;IAC/D,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAA;IACpC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,wFAAwF;IACxF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,GAAE,+BAAoC,GACzC,WAAW,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAwClD"}