@payloadcms/next 3.81.0-internal-debug.1a0f4d0 → 3.81.0

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 (466) hide show
  1. package/dist/auth/login.js +58 -52
  2. package/dist/auth/login.js.map +1 -1
  3. package/dist/auth/logout.js +44 -39
  4. package/dist/auth/logout.js.map +1 -1
  5. package/dist/auth/refresh.js +47 -45
  6. package/dist/auth/refresh.js.map +1 -1
  7. package/dist/cjs/withPayload.cjs +27 -65
  8. package/dist/cjs/withPayload.cjs.map +3 -3
  9. package/dist/config.js +0 -1
  10. package/dist/config.js.map +1 -1
  11. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +15 -9
  12. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
  13. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +71 -40
  14. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
  15. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +59 -65
  16. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  17. package/dist/elements/DocumentHeader/Tabs/index.js +70 -80
  18. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  19. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +23 -16
  20. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
  21. package/dist/elements/DocumentHeader/Tabs/tabs/index.js +69 -61
  22. package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
  23. package/dist/elements/DocumentHeader/index.js +28 -48
  24. package/dist/elements/DocumentHeader/index.js.map +1 -1
  25. package/dist/elements/FormHeader/index.js +16 -30
  26. package/dist/elements/FormHeader/index.js.map +1 -1
  27. package/dist/elements/Logo/index.js +34 -19
  28. package/dist/elements/Logo/index.js.map +1 -1
  29. package/dist/elements/Nav/NavHamburger/index.js +44 -23
  30. package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
  31. package/dist/elements/Nav/NavWrapper/index.js +54 -28
  32. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  33. package/dist/elements/Nav/SettingsMenuButton/index.js +39 -33
  34. package/dist/elements/Nav/SettingsMenuButton/index.js.map +1 -1
  35. package/dist/elements/Nav/getNavPrefs.js +22 -27
  36. package/dist/elements/Nav/getNavPrefs.js.map +1 -1
  37. package/dist/elements/Nav/index.client.js +118 -97
  38. package/dist/elements/Nav/index.client.js.map +1 -1
  39. package/dist/elements/Nav/index.js +170 -191
  40. package/dist/elements/Nav/index.js.map +1 -1
  41. package/dist/exports/auth.js +0 -1
  42. package/dist/exports/auth.js.map +1 -1
  43. package/dist/exports/client.js +1 -1
  44. package/dist/exports/client.js.map +1 -1
  45. package/dist/exports/layouts.js +0 -1
  46. package/dist/exports/layouts.js.map +1 -1
  47. package/dist/exports/routes.js +0 -1
  48. package/dist/exports/routes.js.map +1 -1
  49. package/dist/exports/rsc.js +0 -1
  50. package/dist/exports/rsc.js.map +1 -1
  51. package/dist/exports/templates.js +0 -1
  52. package/dist/exports/templates.js.map +1 -1
  53. package/dist/exports/utilities.js +12 -7
  54. package/dist/exports/utilities.js.map +1 -1
  55. package/dist/exports/views.js +0 -1
  56. package/dist/exports/views.js.map +1 -1
  57. package/dist/index.js +0 -1
  58. package/dist/index.js.map +1 -1
  59. package/dist/layouts/Root/NestProviders.js +20 -21
  60. package/dist/layouts/Root/NestProviders.js.map +1 -1
  61. package/dist/layouts/Root/checkDependencies.js +41 -49
  62. package/dist/layouts/Root/checkDependencies.js.map +1 -1
  63. package/dist/layouts/Root/index.d.ts +4 -2
  64. package/dist/layouts/Root/index.d.ts.map +1 -1
  65. package/dist/layouts/Root/index.js +125 -128
  66. package/dist/layouts/Root/index.js.map +1 -1
  67. package/dist/prod/styles.css +1 -5
  68. package/dist/routes/graphql/handler.js +122 -114
  69. package/dist/routes/graphql/handler.js.map +1 -1
  70. package/dist/routes/graphql/index.js +0 -1
  71. package/dist/routes/graphql/index.js.map +1 -1
  72. package/dist/routes/graphql/playground.js +27 -28
  73. package/dist/routes/graphql/playground.js.map +1 -1
  74. package/dist/routes/index.js +0 -1
  75. package/dist/routes/index.js.map +1 -1
  76. package/dist/routes/rest/index.js +22 -23
  77. package/dist/routes/rest/index.js.map +1 -1
  78. package/dist/routes/rest/og/image.js +79 -103
  79. package/dist/routes/rest/og/image.js.map +1 -1
  80. package/dist/routes/rest/og/index.js +54 -59
  81. package/dist/routes/rest/og/index.js.map +1 -1
  82. package/dist/templates/Default/NavHamburger/index.js +20 -12
  83. package/dist/templates/Default/NavHamburger/index.js.map +1 -1
  84. package/dist/templates/Default/Wrapper/index.js +44 -20
  85. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  86. package/dist/templates/Default/index.js +116 -147
  87. package/dist/templates/Default/index.js.map +1 -1
  88. package/dist/templates/Minimal/index.js +17 -26
  89. package/dist/templates/Minimal/index.js.map +1 -1
  90. package/dist/utilities/getExistingAuthToken.js +2 -3
  91. package/dist/utilities/getExistingAuthToken.js.map +1 -1
  92. package/dist/utilities/getNextRequestI18n.js +13 -12
  93. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  94. package/dist/utilities/getPayloadHMR.js +5 -5
  95. package/dist/utilities/getPayloadHMR.js.map +1 -1
  96. package/dist/utilities/getPreferences.js +22 -27
  97. package/dist/utilities/getPreferences.js.map +1 -1
  98. package/dist/utilities/getRequestLocale.js +14 -13
  99. package/dist/utilities/getRequestLocale.js.map +1 -1
  100. package/dist/utilities/getRequestTheme.js +19 -19
  101. package/dist/utilities/getRequestTheme.js.map +1 -1
  102. package/dist/utilities/getRouteWithoutAdmin.js +5 -3
  103. package/dist/utilities/getRouteWithoutAdmin.js.map +1 -1
  104. package/dist/utilities/handleAuthRedirect.js +36 -22
  105. package/dist/utilities/handleAuthRedirect.js.map +1 -1
  106. package/dist/utilities/handleServerFunctions.js +43 -33
  107. package/dist/utilities/handleServerFunctions.js.map +1 -1
  108. package/dist/utilities/initReq.js +96 -78
  109. package/dist/utilities/initReq.js.map +1 -1
  110. package/dist/utilities/isCustomAdminView.d.ts.map +1 -1
  111. package/dist/utilities/isCustomAdminView.js +26 -22
  112. package/dist/utilities/isCustomAdminView.js.map +1 -1
  113. package/dist/utilities/isCustomAdminView.spec.js +90 -0
  114. package/dist/utilities/isCustomAdminView.spec.js.map +1 -0
  115. package/dist/utilities/isPublicAdminRoute.js +20 -26
  116. package/dist/utilities/isPublicAdminRoute.js.map +1 -1
  117. package/dist/utilities/meta.js +63 -68
  118. package/dist/utilities/meta.js.map +1 -1
  119. package/dist/utilities/selectiveCache.js +26 -25
  120. package/dist/utilities/selectiveCache.js.map +1 -1
  121. package/dist/utilities/setPayloadAuthCookie.js +22 -19
  122. package/dist/utilities/setPayloadAuthCookie.js.map +1 -1
  123. package/dist/utilities/slugify.js +33 -24
  124. package/dist/utilities/slugify.js.map +1 -1
  125. package/dist/utilities/timestamp.js +6 -7
  126. package/dist/utilities/timestamp.js.map +1 -1
  127. package/dist/views/API/LocaleSelector/index.js +39 -17
  128. package/dist/views/API/LocaleSelector/index.js.map +1 -1
  129. package/dist/views/API/RenderJSON/index.js +126 -171
  130. package/dist/views/API/RenderJSON/index.js.map +1 -1
  131. package/dist/views/API/index.client.d.ts.map +1 -1
  132. package/dist/views/API/index.client.js +205 -290
  133. package/dist/views/API/index.client.js.map +1 -1
  134. package/dist/views/API/index.js +2 -7
  135. package/dist/views/API/index.js.map +1 -1
  136. package/dist/views/API/metadata.js +23 -18
  137. package/dist/views/API/metadata.js.map +1 -1
  138. package/dist/views/Account/ResetPreferences/index.js +100 -76
  139. package/dist/views/Account/ResetPreferences/index.js.map +1 -1
  140. package/dist/views/Account/Settings/LanguageSelector.js +47 -18
  141. package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
  142. package/dist/views/Account/Settings/index.js +25 -60
  143. package/dist/views/Account/Settings/index.js.map +1 -1
  144. package/dist/views/Account/ToggleTheme/index.js +55 -38
  145. package/dist/views/Account/ToggleTheme/index.js.map +1 -1
  146. package/dist/views/Account/index.client.js +32 -16
  147. package/dist/views/Account/index.client.js.map +1 -1
  148. package/dist/views/Account/index.js +162 -149
  149. package/dist/views/Account/index.js.map +1 -1
  150. package/dist/views/Account/metadata.js +12 -8
  151. package/dist/views/Account/metadata.js.map +1 -1
  152. package/dist/views/BrowseByFolder/buildView.js +157 -138
  153. package/dist/views/BrowseByFolder/buildView.js.map +1 -1
  154. package/dist/views/BrowseByFolder/index.js +16 -16
  155. package/dist/views/BrowseByFolder/index.js.map +1 -1
  156. package/dist/views/BrowseByFolder/metadata.js +15 -13
  157. package/dist/views/BrowseByFolder/metadata.js.map +1 -1
  158. package/dist/views/CollectionFolders/buildView.js +142 -122
  159. package/dist/views/CollectionFolders/buildView.js.map +1 -1
  160. package/dist/views/CollectionFolders/index.js +16 -16
  161. package/dist/views/CollectionFolders/index.js.map +1 -1
  162. package/dist/views/CollectionFolders/metadata.js +21 -18
  163. package/dist/views/CollectionFolders/metadata.js.map +1 -1
  164. package/dist/views/CollectionFolders/renderFolderViewSlots.js +61 -58
  165. package/dist/views/CollectionFolders/renderFolderViewSlots.js.map +1 -1
  166. package/dist/views/CollectionTrash/index.js +17 -17
  167. package/dist/views/CollectionTrash/index.js.map +1 -1
  168. package/dist/views/CollectionTrash/metadata.js +21 -18
  169. package/dist/views/CollectionTrash/metadata.js.map +1 -1
  170. package/dist/views/CreateFirstUser/index.client.js +103 -117
  171. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  172. package/dist/views/CreateFirstUser/index.js +81 -87
  173. package/dist/views/CreateFirstUser/index.js.map +1 -1
  174. package/dist/views/CreateFirstUser/metadata.js +12 -8
  175. package/dist/views/CreateFirstUser/metadata.js.map +1 -1
  176. package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js +170 -145
  177. package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js.map +1 -1
  178. package/dist/views/Dashboard/Default/ModularDashboard/WidgetConfigDrawer.js +118 -144
  179. package/dist/views/Dashboard/Default/ModularDashboard/WidgetConfigDrawer.js.map +1 -1
  180. package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.js +72 -59
  181. package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.js.map +1 -1
  182. package/dist/views/Dashboard/Default/ModularDashboard/index.client.js +414 -435
  183. package/dist/views/Dashboard/Default/ModularDashboard/index.client.js.map +1 -1
  184. package/dist/views/Dashboard/Default/ModularDashboard/index.js +63 -54
  185. package/dist/views/Dashboard/Default/ModularDashboard/index.js.map +1 -1
  186. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js +96 -65
  187. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/RenderWidget.js.map +1 -1
  188. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js +54 -44
  189. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js.map +1 -1
  190. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +72 -65
  191. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
  192. package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.js +175 -193
  193. package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.js.map +1 -1
  194. package/dist/views/Dashboard/Default/ModularDashboard/utils/collisionDetection.js +30 -31
  195. package/dist/views/Dashboard/Default/ModularDashboard/utils/collisionDetection.js.map +1 -1
  196. package/dist/views/Dashboard/Default/ModularDashboard/utils/getItemsFromConfig.js +17 -18
  197. package/dist/views/Dashboard/Default/ModularDashboard/utils/getItemsFromConfig.js.map +1 -1
  198. package/dist/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.js +5 -6
  199. package/dist/views/Dashboard/Default/ModularDashboard/utils/getItemsFromPreferences.js.map +1 -1
  200. package/dist/views/Dashboard/Default/ModularDashboard/utils/localeUtils.js +74 -69
  201. package/dist/views/Dashboard/Default/ModularDashboard/utils/localeUtils.js.map +1 -1
  202. package/dist/views/Dashboard/Default/ModularDashboard/utils/sensors.js +234 -228
  203. package/dist/views/Dashboard/Default/ModularDashboard/utils/sensors.js.map +1 -1
  204. package/dist/views/Dashboard/Default/index.js +45 -59
  205. package/dist/views/Dashboard/Default/index.js.map +1 -1
  206. package/dist/views/Dashboard/index.js +42 -46
  207. package/dist/views/Dashboard/index.js.map +1 -1
  208. package/dist/views/Dashboard/metadata.js +14 -10
  209. package/dist/views/Dashboard/metadata.js.map +1 -1
  210. package/dist/views/Document/getCustomDocumentViewByKey.js +2 -3
  211. package/dist/views/Document/getCustomDocumentViewByKey.js.map +1 -1
  212. package/dist/views/Document/getCustomViewByRoute.js +30 -27
  213. package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
  214. package/dist/views/Document/getDocPreferences.js +41 -40
  215. package/dist/views/Document/getDocPreferences.js.map +1 -1
  216. package/dist/views/Document/getDocumentData.js +55 -44
  217. package/dist/views/Document/getDocumentData.js.map +1 -1
  218. package/dist/views/Document/getDocumentPermissions.js +117 -114
  219. package/dist/views/Document/getDocumentPermissions.js.map +1 -1
  220. package/dist/views/Document/getDocumentView.js +283 -313
  221. package/dist/views/Document/getDocumentView.js.map +1 -1
  222. package/dist/views/Document/getIsLocked.js +73 -73
  223. package/dist/views/Document/getIsLocked.js.map +1 -1
  224. package/dist/views/Document/getMetaBySegment.js +136 -130
  225. package/dist/views/Document/getMetaBySegment.js.map +1 -1
  226. package/dist/views/Document/getVersions.js +213 -220
  227. package/dist/views/Document/getVersions.js.map +1 -1
  228. package/dist/views/Document/handleServerFunction.js +127 -100
  229. package/dist/views/Document/handleServerFunction.js.map +1 -1
  230. package/dist/views/Document/index.js +359 -319
  231. package/dist/views/Document/index.js.map +1 -1
  232. package/dist/views/Document/metadata.js +1 -2
  233. package/dist/views/Document/metadata.js.map +1 -1
  234. package/dist/views/Document/renderDocumentSlots.js +155 -141
  235. package/dist/views/Document/renderDocumentSlots.js.map +1 -1
  236. package/dist/views/Edit/index.js +6 -10
  237. package/dist/views/Edit/index.js.map +1 -1
  238. package/dist/views/Edit/metadata.js +46 -36
  239. package/dist/views/Edit/metadata.js.map +1 -1
  240. package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
  241. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +169 -132
  242. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  243. package/dist/views/ForgotPassword/index.js +62 -79
  244. package/dist/views/ForgotPassword/index.js.map +1 -1
  245. package/dist/views/ForgotPassword/metadata.js +12 -8
  246. package/dist/views/ForgotPassword/metadata.js.map +1 -1
  247. package/dist/views/List/createSerializableValue.js +11 -12
  248. package/dist/views/List/createSerializableValue.js.map +1 -1
  249. package/dist/views/List/enrichDocsWithVersionStatus.js +86 -86
  250. package/dist/views/List/enrichDocsWithVersionStatus.js.map +1 -1
  251. package/dist/views/List/extractRelationshipDisplayValue.js +14 -15
  252. package/dist/views/List/extractRelationshipDisplayValue.js.map +1 -1
  253. package/dist/views/List/extractValueOrRelationshipID.js +15 -16
  254. package/dist/views/List/extractValueOrRelationshipID.js.map +1 -1
  255. package/dist/views/List/handleGroupBy.js +150 -133
  256. package/dist/views/List/handleGroupBy.js.map +1 -1
  257. package/dist/views/List/handleServerFunction.js +122 -96
  258. package/dist/views/List/handleServerFunction.js.map +1 -1
  259. package/dist/views/List/index.js +325 -306
  260. package/dist/views/List/index.js.map +1 -1
  261. package/dist/views/List/metadata.js +20 -17
  262. package/dist/views/List/metadata.js.map +1 -1
  263. package/dist/views/List/renderListViewSlots.js +75 -82
  264. package/dist/views/List/renderListViewSlots.js.map +1 -1
  265. package/dist/views/List/resolveAllFilterOptions.js +45 -43
  266. package/dist/views/List/resolveAllFilterOptions.js.map +1 -1
  267. package/dist/views/List/transformColumnsToSelect.js +8 -9
  268. package/dist/views/List/transformColumnsToSelect.js.map +1 -1
  269. package/dist/views/Login/LoginField/index.js +89 -57
  270. package/dist/views/Login/LoginField/index.js.map +1 -1
  271. package/dist/views/Login/LoginForm/index.js +160 -107
  272. package/dist/views/Login/LoginForm/index.js.map +1 -1
  273. package/dist/views/Login/index.js +85 -82
  274. package/dist/views/Login/index.js.map +1 -1
  275. package/dist/views/Login/metadata.js +12 -8
  276. package/dist/views/Login/metadata.js.map +1 -1
  277. package/dist/views/Logout/LogoutClient.js +120 -84
  278. package/dist/views/Logout/LogoutClient.js.map +1 -1
  279. package/dist/views/Logout/index.js +29 -29
  280. package/dist/views/Logout/index.js.map +1 -1
  281. package/dist/views/Logout/metadata.js +11 -7
  282. package/dist/views/Logout/metadata.js.map +1 -1
  283. package/dist/views/NotFound/index.client.js +82 -71
  284. package/dist/views/NotFound/index.client.js.map +1 -1
  285. package/dist/views/NotFound/index.js +73 -72
  286. package/dist/views/NotFound/index.js.map +1 -1
  287. package/dist/views/NotFound/metadata.js +9 -7
  288. package/dist/views/NotFound/metadata.js.map +1 -1
  289. package/dist/views/ResetPassword/ResetPasswordForm/index.js +108 -97
  290. package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
  291. package/dist/views/ResetPassword/index.js +73 -93
  292. package/dist/views/ResetPassword/index.js.map +1 -1
  293. package/dist/views/ResetPassword/metadata.js +12 -8
  294. package/dist/views/ResetPassword/metadata.js.map +1 -1
  295. package/dist/views/Root/attachViewActions.js +23 -18
  296. package/dist/views/Root/attachViewActions.js.map +1 -1
  297. package/dist/views/Root/generateCustomViewMetadata.js +21 -19
  298. package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
  299. package/dist/views/Root/getCustomViewByKey.js +14 -12
  300. package/dist/views/Root/getCustomViewByKey.js.map +1 -1
  301. package/dist/views/Root/getCustomViewByRoute.js +42 -31
  302. package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
  303. package/dist/views/Root/getDocumentViewInfo.js +23 -24
  304. package/dist/views/Root/getDocumentViewInfo.js.map +1 -1
  305. package/dist/views/Root/getRouteData.js +325 -333
  306. package/dist/views/Root/getRouteData.js.map +1 -1
  307. package/dist/views/Root/index.js +270 -248
  308. package/dist/views/Root/index.js.map +1 -1
  309. package/dist/views/Root/isPathMatchingRoute.js +26 -21
  310. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  311. package/dist/views/Root/metadata.js +181 -176
  312. package/dist/views/Root/metadata.js.map +1 -1
  313. package/dist/views/Unauthorized/index.js +46 -54
  314. package/dist/views/Unauthorized/index.js.map +1 -1
  315. package/dist/views/Unauthorized/metadata.js +12 -8
  316. package/dist/views/Unauthorized/metadata.js.map +1 -1
  317. package/dist/views/Verify/index.client.js +43 -25
  318. package/dist/views/Verify/index.client.js.map +1 -1
  319. package/dist/views/Verify/index.js +64 -69
  320. package/dist/views/Verify/index.js.map +1 -1
  321. package/dist/views/Verify/metadata.js +12 -8
  322. package/dist/views/Verify/metadata.js.map +1 -1
  323. package/dist/views/Version/Default/SelectedLocalesContext.js +4 -4
  324. package/dist/views/Version/Default/SelectedLocalesContext.js.map +1 -1
  325. package/dist/views/Version/Default/SetStepNav.js +127 -86
  326. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  327. package/dist/views/Version/Default/index.js +236 -380
  328. package/dist/views/Version/Default/index.js.map +1 -1
  329. package/dist/views/Version/Default/types.js +1 -2
  330. package/dist/views/Version/Default/types.js.map +1 -1
  331. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +119 -102
  332. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
  333. package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +73 -78
  334. package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -1
  335. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +408 -363
  336. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
  337. package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +51 -40
  338. package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
  339. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +70 -38
  340. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +1 -1
  341. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +56 -59
  342. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
  343. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +117 -139
  344. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  345. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js +61 -56
  346. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js.map +1 -1
  347. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +206 -224
  348. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
  349. package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js +11 -17
  350. package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js.map +1 -1
  351. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +74 -49
  352. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  353. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +146 -135
  354. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
  355. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +82 -57
  356. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  357. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js +211 -252
  358. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js.map +1 -1
  359. package/dist/views/Version/RenderFieldsToDiff/fields/index.js +22 -23
  360. package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
  361. package/dist/views/Version/RenderFieldsToDiff/index.js +9 -12
  362. package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
  363. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +228 -213
  364. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
  365. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +826 -1005
  366. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +1 -1
  367. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js +1 -2
  368. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js.map +1 -1
  369. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +43 -44
  370. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +1 -1
  371. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +36 -32
  372. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
  373. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +129 -145
  374. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +1 -1
  375. package/dist/views/Version/Restore/index.js +92 -117
  376. package/dist/views/Version/Restore/index.js.map +1 -1
  377. package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js +50 -33
  378. package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js.map +1 -1
  379. package/dist/views/Version/SelectComparison/VersionDrawer/index.js +226 -170
  380. package/dist/views/Version/SelectComparison/VersionDrawer/index.js.map +1 -1
  381. package/dist/views/Version/SelectComparison/index.js +50 -73
  382. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  383. package/dist/views/Version/SelectComparison/types.js +1 -2
  384. package/dist/views/Version/SelectComparison/types.js.map +1 -1
  385. package/dist/views/Version/SelectLocales/index.js +32 -34
  386. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  387. package/dist/views/Version/VersionPillLabel/VersionPillLabel.js +100 -106
  388. package/dist/views/Version/VersionPillLabel/VersionPillLabel.js.map +1 -1
  389. package/dist/views/Version/VersionPillLabel/getVersionLabel.js +35 -30
  390. package/dist/views/Version/VersionPillLabel/getVersionLabel.js.map +1 -1
  391. package/dist/views/Version/fetchVersions.js +138 -113
  392. package/dist/views/Version/fetchVersions.js.map +1 -1
  393. package/dist/views/Version/index.js +326 -328
  394. package/dist/views/Version/index.js.map +1 -1
  395. package/dist/views/Version/metadata.js +50 -43
  396. package/dist/views/Version/metadata.js.map +1 -1
  397. package/dist/views/Versions/buildColumns.js +79 -95
  398. package/dist/views/Versions/buildColumns.js.map +1 -1
  399. package/dist/views/Versions/cells/AutosaveCell/index.js +38 -34
  400. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  401. package/dist/views/Versions/cells/CreatedAt/index.js +53 -32
  402. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  403. package/dist/views/Versions/cells/ID/index.js +8 -10
  404. package/dist/views/Versions/cells/ID/index.js.map +1 -1
  405. package/dist/views/Versions/index.client.js +83 -106
  406. package/dist/views/Versions/index.client.js.map +1 -1
  407. package/dist/views/Versions/index.js +164 -164
  408. package/dist/views/Versions/index.js.map +1 -1
  409. package/dist/views/Versions/metadata.js +44 -37
  410. package/dist/views/Versions/metadata.js.map +1 -1
  411. package/dist/views/Versions/types.js +1 -2
  412. package/dist/views/Versions/types.js.map +1 -1
  413. package/dist/withPayload/withPayload.d.ts.map +1 -1
  414. package/dist/withPayload/withPayload.js +180 -236
  415. package/dist/withPayload/withPayload.js.map +1 -1
  416. package/dist/withPayload/withPayload.spec.js +35 -36
  417. package/dist/withPayload/withPayload.spec.js.map +1 -1
  418. package/dist/withPayload/withPayload.utils.js +73 -65
  419. package/dist/withPayload/withPayload.utils.js.map +1 -1
  420. package/dist/withPayload/withPayloadLegacy.js +40 -41
  421. package/dist/withPayload/withPayloadLegacy.js.map +1 -1
  422. package/package.json +8 -8
  423. package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +0 -38
  424. package/dist/elements/DocumentHeader/Tabs/index.scss +0 -54
  425. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.scss +0 -10
  426. package/dist/elements/DocumentHeader/index.scss +0 -64
  427. package/dist/elements/FormHeader/index.scss +0 -8
  428. package/dist/elements/Nav/NavWrapper/index.scss +0 -27
  429. package/dist/elements/Nav/SettingsMenuButton/index.scss +0 -11
  430. package/dist/elements/Nav/index.scss +0 -173
  431. package/dist/esbuildEntry.d.ts +0 -5
  432. package/dist/esbuildEntry.d.ts.map +0 -1
  433. package/dist/esbuildEntry.js +0 -6
  434. package/dist/esbuildEntry.js.map +0 -1
  435. package/dist/templates/Default/Wrapper/index.scss +0 -58
  436. package/dist/templates/Default/index.scss +0 -79
  437. package/dist/templates/Minimal/index.scss +0 -30
  438. package/dist/views/API/RenderJSON/index.scss +0 -129
  439. package/dist/views/API/index.scss +0 -119
  440. package/dist/views/Account/Settings/index.scss +0 -48
  441. package/dist/views/CreateFirstUser/index.scss +0 -21
  442. package/dist/views/Dashboard/Default/ModularDashboard/index.scss +0 -318
  443. package/dist/views/Login/LoginForm/index.scss +0 -10
  444. package/dist/views/Login/index.scss +0 -10
  445. package/dist/views/Logout/index.scss +0 -25
  446. package/dist/views/NotFound/index.scss +0 -57
  447. package/dist/views/ResetPassword/index.scss +0 -11
  448. package/dist/views/Unauthorized/index.scss +0 -14
  449. package/dist/views/Verify/index.scss +0 -16
  450. package/dist/views/Version/Default/index.scss +0 -170
  451. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.scss +0 -81
  452. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.scss +0 -12
  453. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.scss +0 -9
  454. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +0 -59
  455. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +0 -91
  456. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +0 -4
  457. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.scss +0 -9
  458. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +0 -4
  459. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.scss +0 -121
  460. package/dist/views/Version/RenderFieldsToDiff/index.scss +0 -24
  461. package/dist/views/Version/Restore/index.scss +0 -84
  462. package/dist/views/Version/SelectComparison/VersionDrawer/index.scss +0 -18
  463. package/dist/views/Version/SelectComparison/index.scss +0 -9
  464. package/dist/views/Version/VersionPillLabel/index.scss +0 -26
  465. package/dist/views/Versions/cells/AutosaveCell/index.scss +0 -9
  466. package/dist/views/Versions/index.scss +0 -110
@@ -3,252 +3,196 @@
3
3
  * imported directly in next.config.mjs files. Since next.config files run before the build process,
4
4
  * TypeScript compilation is not available. This ensures compatibility with all templates and
5
5
  * user projects regardless of their TypeScript setup.
6
- */ import { getNextjsVersion, supportsTurbopackExternalizeTransitiveDependencies } from './withPayload.utils.js';
6
+ */import { getNextjsVersion, supportsTurbopackExternalizeTransitiveDependencies } from './withPayload.utils.js';
7
7
  import { withPayloadLegacy } from './withPayloadLegacy.js';
8
8
  const poweredByHeader = {
9
- key: 'X-Powered-By',
10
- value: 'Next.js, Payload'
9
+ key: 'X-Powered-By',
10
+ value: 'Next.js, Payload'
11
11
  };
12
12
  /**
13
13
  * @param {import('next').NextConfig} nextConfig
14
14
  * @param {Object} [options] - Optional configuration options
15
15
  * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false
16
- * */ export const withPayload = (nextConfig = {}, options = {})=>{
17
- const nextjsVersion = getNextjsVersion();
18
- const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion);
19
- const env = nextConfig.env || {};
20
- if (nextConfig.experimental?.staleTimes?.dynamic) {
21
- console.warn('Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.');
22
- env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
16
+ * */
17
+ export const withPayload = (nextConfig = {}, options = {}) => {
18
+ const nextjsVersion = getNextjsVersion();
19
+ const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion);
20
+ const env = nextConfig.env || {};
21
+ if (nextConfig.experimental?.staleTimes?.dynamic) {
22
+ console.warn('Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.');
23
+ env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
24
+ }
25
+ if (nextConfig.cacheComponents) {
26
+ env.PAYLOAD_CACHE_COMPONENTS_ENABLED = 'true';
27
+ }
28
+ const consoleWarn = console.warn;
29
+ const sassWarningTexts = [
30
+ // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings
31
+ 'Future import deprecation is not yet active, so silencing it is unnecessary',
32
+ // Sometimes happens despite silenceDeprecations
33
+ 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0'];
34
+ console.warn = (...args) => {
35
+ if (typeof args[1] === 'string' && sassWarningTexts.some(text => args[1].includes(text)) || typeof args[0] === 'string' && sassWarningTexts.some(text => args[0].includes(text))) {
36
+ return;
23
37
  }
24
- const consoleWarn = console.warn;
25
- const sassWarningTexts = [
26
- // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings
27
- 'Future import deprecation is not yet active, so silencing it is unnecessary',
28
- // Sometimes happens despite silenceDeprecations
29
- 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0'
30
- ];
31
- console.warn = (...args)=>{
32
- if (typeof args[1] === 'string' && sassWarningTexts.some((text)=>args[1].includes(text)) || typeof args[0] === 'string' && sassWarningTexts.some((text)=>args[0].includes(text))) {
33
- return;
38
+ consoleWarn(...args);
39
+ };
40
+ /** @type {import('next').NextConfig} */
41
+ const baseConfig = {
42
+ ...nextConfig,
43
+ env,
44
+ sassOptions: {
45
+ ...(nextConfig.sassOptions || {}),
46
+ /**
47
+ * This prevents scss warning spam during pnpm dev that looks like this:
48
+ * ⚠ ./test/admin/components/views/CustomMinimal/index.scss
49
+ * Issue while running loader
50
+ * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:
51
+ * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
52
+ *
53
+ * More info and automated migrator: https://sass-lang.com/d/import
54
+ *
55
+ * 8 | @import 'queries';
56
+ *
57
+ *
58
+ * packages/ui/src/scss/styles.scss 9:9 @import
59
+ * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet
60
+ *
61
+ * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.
62
+ */
63
+ silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import']
64
+ },
65
+ outputFileTracingExcludes: {
66
+ ...(nextConfig.outputFileTracingExcludes || {}),
67
+ '**/*': [...(nextConfig.outputFileTracingExcludes?.['**/*'] || []), 'drizzle-kit', 'drizzle-kit/api']
68
+ },
69
+ outputFileTracingIncludes: {
70
+ ...(nextConfig.outputFileTracingIncludes || {}),
71
+ '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client']
72
+ },
73
+ turbopack: {
74
+ ...(nextConfig.turbopack || {})
75
+ },
76
+ // We disable the poweredByHeader here because we add it manually in the headers function below
77
+ ...(nextConfig.poweredByHeader !== false ? {
78
+ poweredByHeader: false
79
+ } : {}),
80
+ headers: async () => {
81
+ const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : [];
82
+ return [...(headersFromConfig || []), {
83
+ headers: [{
84
+ key: 'Accept-CH',
85
+ value: 'Sec-CH-Prefers-Color-Scheme'
86
+ }, {
87
+ key: 'Vary',
88
+ value: 'Sec-CH-Prefers-Color-Scheme'
89
+ }, {
90
+ key: 'Critical-CH',
91
+ value: 'Sec-CH-Prefers-Color-Scheme'
92
+ }, ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : [])],
93
+ source: '/:path*'
94
+ }];
95
+ },
96
+ serverExternalPackages: [...(nextConfig.serverExternalPackages || []),
97
+ // WHY: without externalizing graphql, a graphql version error will be thrown
98
+ // during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
99
+ 'graphql', ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true ?
100
+ /**
101
+ * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we
102
+ * do not bundle server-only packages during dev for two reasons:
103
+ *
104
+ * 1. Performance: Fewer files to compile means faster compilation speeds.
105
+ * 2. Turbopack support: Webpack's externals are not supported by Turbopack.
106
+ *
107
+ * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to
108
+ * externalized packages that are not resolvable from the project root. So including a package like
109
+ * "drizzle-kit" in here would do nothing - Next.js will ignore the rule and still bundle the package -
110
+ * because it detects that the package is not resolvable from the project root (= not directly installed
111
+ * by the user in their own package.json).
112
+ *
113
+ * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly
114
+ * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).
115
+ *
116
+ *
117
+ *
118
+ * We should only do this during development, not build, because externalizing these packages can hurt
119
+ * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the
120
+ * same package.
121
+ *
122
+ * Example:
123
+ * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)
124
+ * - payload (not in bundle, external) -> installs qs-esm (external because of importer)
125
+ * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.
126
+ *
127
+ * During development, these bundle size difference do not matter much, and development speed /
128
+ * turbopack support are more important.
129
+ */
130
+ ['payload', '@payloadcms/db-mongodb', '@payloadcms/db-postgres', '@payloadcms/db-sqlite', '@payloadcms/db-vercel-postgres', '@payloadcms/db-d1-sqlite', '@payloadcms/drizzle', '@payloadcms/email-nodemailer', '@payloadcms/email-resend', '@payloadcms/graphql', '@payloadcms/payload-cloud', '@payloadcms/plugin-redirects'] : [])],
131
+ webpack: (webpackConfig, webpackOptions) => {
132
+ const incomingWebpackConfig = typeof nextConfig.webpack === 'function' ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
133
+ return {
134
+ ...incomingWebpackConfig,
135
+ externals: [...(incomingWebpackConfig?.externals || []),
136
+ /**
137
+ * See the explanation in the serverExternalPackages section above.
138
+ * We need to force Webpack to emit require() calls for these packages, even though they are not
139
+ * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.
140
+ *
141
+ * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the
142
+ * entry point packages, as explained in the serverExternalPackages section above.
143
+ */
144
+ 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle', 'json-schema-to-typescript'],
145
+ plugins: [...(incomingWebpackConfig?.plugins || []),
146
+ // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
147
+ new webpackOptions.webpack.IgnorePlugin({
148
+ resourceRegExp: /^pg-native$|^cloudflare:sockets$/
149
+ })],
150
+ resolve: {
151
+ ...(incomingWebpackConfig?.resolve || {}),
152
+ alias: {
153
+ ...(incomingWebpackConfig?.resolve?.alias || {})
154
+ },
155
+ fallback: {
156
+ ...(incomingWebpackConfig?.resolve?.fallback || {}),
157
+ /*
158
+ * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):
159
+ *
160
+ * ⚠ Compiled with warnings in 8.7s
161
+ *
162
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
163
+ * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'
164
+ *
165
+ * Import trace for requested module:
166
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
167
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js
168
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js
169
+ * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js
170
+ * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js
171
+ * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js
172
+ * ./src/payload.config.ts
173
+ * ./src/app/my-route/route.ts
174
+ *
175
+ **/
176
+ aws4: false
177
+ }
34
178
  }
35
- consoleWarn(...args);
36
- };
37
- /** @type {import('next').NextConfig} */ const baseConfig = {
38
- ...nextConfig,
39
- env,
40
- sassOptions: {
41
- ...nextConfig.sassOptions || {},
42
- /**
43
- * This prevents scss warning spam during pnpm dev that looks like this:
44
- * ⚠ ./test/admin/components/views/CustomMinimal/index.scss
45
- * Issue while running loader
46
- * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:
47
- * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
48
- *
49
- * More info and automated migrator: https://sass-lang.com/d/import
50
- *
51
- * 8 | @import 'queries';
52
- *
53
- *
54
- * packages/ui/src/scss/styles.scss 9:9 @import
55
- * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet
56
- *
57
- * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.
58
- */ silenceDeprecations: [
59
- ...nextConfig.sassOptions?.silenceDeprecations || [],
60
- 'import'
61
- ]
62
- },
63
- outputFileTracingExcludes: {
64
- ...nextConfig.outputFileTracingExcludes || {},
65
- '**/*': [
66
- ...nextConfig.outputFileTracingExcludes?.['**/*'] || [],
67
- 'drizzle-kit',
68
- 'drizzle-kit/api'
69
- ]
70
- },
71
- outputFileTracingIncludes: {
72
- ...nextConfig.outputFileTracingIncludes || {},
73
- '**/*': [
74
- ...nextConfig.outputFileTracingIncludes?.['**/*'] || [],
75
- '@libsql/client'
76
- ]
77
- },
78
- turbopack: {
79
- ...nextConfig.turbopack || {}
80
- },
81
- // We disable the poweredByHeader here because we add it manually in the headers function below
82
- ...nextConfig.poweredByHeader !== false ? {
83
- poweredByHeader: false
84
- } : {},
85
- headers: async ()=>{
86
- const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : [];
87
- return [
88
- ...headersFromConfig || [],
89
- {
90
- headers: [
91
- {
92
- key: 'Accept-CH',
93
- value: 'Sec-CH-Prefers-Color-Scheme'
94
- },
95
- {
96
- key: 'Vary',
97
- value: 'Sec-CH-Prefers-Color-Scheme'
98
- },
99
- {
100
- key: 'Critical-CH',
101
- value: 'Sec-CH-Prefers-Color-Scheme'
102
- },
103
- ...nextConfig.poweredByHeader !== false ? [
104
- poweredByHeader
105
- ] : []
106
- ],
107
- source: '/:path*'
108
- }
109
- ];
110
- },
111
- serverExternalPackages: [
112
- ...nextConfig.serverExternalPackages || [],
113
- // WHY: without externalizing graphql, a graphql version error will be thrown
114
- // during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
115
- 'graphql',
116
- ...process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true ? /**
117
- * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we
118
- * do not bundle server-only packages during dev for two reasons:
119
- *
120
- * 1. Performance: Fewer files to compile means faster compilation speeds.
121
- * 2. Turbopack support: Webpack's externals are not supported by Turbopack.
122
- *
123
- * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to
124
- * externalized packages that are not resolvable from the project root. So including a package like
125
- * "drizzle-kit" in here would do nothing - Next.js will ignore the rule and still bundle the package -
126
- * because it detects that the package is not resolvable from the project root (= not directly installed
127
- * by the user in their own package.json).
128
- *
129
- * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly
130
- * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).
131
- *
132
- *
133
- *
134
- * We should only do this during development, not build, because externalizing these packages can hurt
135
- * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the
136
- * same package.
137
- *
138
- * Example:
139
- * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)
140
- * - payload (not in bundle, external) -> installs qs-esm (external because of importer)
141
- * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.
142
- *
143
- * During development, these bundle size difference do not matter much, and development speed /
144
- * turbopack support are more important.
145
- */ [
146
- 'payload',
147
- '@payloadcms/db-mongodb',
148
- '@payloadcms/db-postgres',
149
- '@payloadcms/db-sqlite',
150
- '@payloadcms/db-vercel-postgres',
151
- '@payloadcms/db-d1-sqlite',
152
- '@payloadcms/drizzle',
153
- '@payloadcms/email-nodemailer',
154
- '@payloadcms/email-resend',
155
- '@payloadcms/graphql',
156
- '@payloadcms/payload-cloud',
157
- '@payloadcms/plugin-redirects'
158
- ] : // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it
159
- // see: https://github.com/vercel/next.js/discussions/76991
160
- //'@payloadcms/plugin-cloud-storage',
161
- //'@payloadcms/plugin-sentry',
162
- //'@payloadcms/plugin-stripe',
163
- // @payloadcms/richtext-lexical
164
- //'@payloadcms/storage-azure',
165
- //'@payloadcms/storage-gcs',
166
- //'@payloadcms/storage-s3',
167
- //'@payloadcms/storage-uploadthing',
168
- //'@payloadcms/storage-vercel-blob',
169
- []
170
- ],
171
- webpack: (webpackConfig, webpackOptions)=>{
172
- const incomingWebpackConfig = typeof nextConfig.webpack === 'function' ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
173
- return {
174
- ...incomingWebpackConfig,
175
- externals: [
176
- ...incomingWebpackConfig?.externals || [],
177
- /**
178
- * See the explanation in the serverExternalPackages section above.
179
- * We need to force Webpack to emit require() calls for these packages, even though they are not
180
- * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.
181
- *
182
- * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the
183
- * entry point packages, as explained in the serverExternalPackages section above.
184
- */ 'drizzle-kit',
185
- 'drizzle-kit/api',
186
- 'sharp',
187
- 'libsql',
188
- 'require-in-the-middle',
189
- 'json-schema-to-typescript'
190
- ],
191
- plugins: [
192
- ...incomingWebpackConfig?.plugins || [],
193
- // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
194
- new webpackOptions.webpack.IgnorePlugin({
195
- resourceRegExp: /^pg-native$|^cloudflare:sockets$/
196
- })
197
- ],
198
- resolve: {
199
- ...incomingWebpackConfig?.resolve || {},
200
- alias: {
201
- ...incomingWebpackConfig?.resolve?.alias || {}
202
- },
203
- fallback: {
204
- ...incomingWebpackConfig?.resolve?.fallback || {},
205
- /*
206
- * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):
207
- *
208
- * ⚠ Compiled with warnings in 8.7s
209
- *
210
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
211
- * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'
212
- *
213
- * Import trace for requested module:
214
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
215
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js
216
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js
217
- * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js
218
- * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js
219
- * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js
220
- * ./src/payload.config.ts
221
- * ./src/app/my-route/route.ts
222
- *
223
- **/ aws4: false
224
- }
225
- }
226
- };
227
- }
228
- };
229
- if (nextConfig.basePath) {
230
- process.env.NEXT_BASE_PATH = nextConfig.basePath;
231
- baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath;
232
- }
233
- if (!supportsTurbopackBuild) {
234
- return withPayloadLegacy(baseConfig);
235
- } else {
236
- return {
237
- ...baseConfig,
238
- serverExternalPackages: [
239
- ...baseConfig.serverExternalPackages || [],
240
- 'drizzle-kit',
241
- 'drizzle-kit/api',
242
- 'sharp',
243
- 'libsql',
244
- 'require-in-the-middle',
245
- 'json-schema-to-typescript',
246
- // Prevents turbopack build errors by the thread-stream package which is installed by pino
247
- 'pino'
248
- ]
249
- };
179
+ };
250
180
  }
181
+ };
182
+ if (nextConfig.basePath) {
183
+ process.env.NEXT_BASE_PATH = nextConfig.basePath;
184
+ baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath;
185
+ }
186
+ if (!supportsTurbopackBuild) {
187
+ return withPayloadLegacy(baseConfig);
188
+ } else {
189
+ return {
190
+ ...baseConfig,
191
+ serverExternalPackages: [...(baseConfig.serverExternalPackages || []), 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle', 'json-schema-to-typescript',
192
+ // Prevents turbopack build errors by the thread-stream package which is installed by pino
193
+ 'pino']
194
+ };
195
+ }
251
196
  };
252
197
  export default withPayload;
253
-
254
198
  //# sourceMappingURL=withPayload.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/withPayload/withPayload.js"],"sourcesContent":["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const consoleWarn = console.warn\n\n const sassWarningTexts = [\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n 'Future import deprecation is not yet active, so silencing it is unnecessary',\n // Sometimes happens despite silenceDeprecations\n 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0',\n ]\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && sassWarningTexts.some((text) => args[1].includes(text))) ||\n (typeof args[0] === 'string' && sassWarningTexts.some((text) => args[0].includes(text)))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n"],"names":["getNextjsVersion","supportsTurbopackExternalizeTransitiveDependencies","withPayloadLegacy","poweredByHeader","key","value","withPayload","nextConfig","options","nextjsVersion","supportsTurbopackBuild","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","consoleWarn","sassWarningTexts","args","some","text","includes","baseConfig","sassOptions","silenceDeprecations","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"mappings":"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"}
1
+ {"version":3,"file":"withPayload.js","names":["getNextjsVersion","supportsTurbopackExternalizeTransitiveDependencies","withPayloadLegacy","poweredByHeader","key","value","withPayload","nextConfig","options","nextjsVersion","supportsTurbopackBuild","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","cacheComponents","PAYLOAD_CACHE_COMPONENTS_ENABLED","consoleWarn","sassWarningTexts","args","some","text","includes","baseConfig","sassOptions","silenceDeprecations","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"sources":["../../src/withPayload/withPayload.js"],"sourcesContent":["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (nextConfig.cacheComponents) {\n env.PAYLOAD_CACHE_COMPONENTS_ENABLED = 'true'\n }\n\n const consoleWarn = console.warn\n\n const sassWarningTexts = [\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n 'Future import deprecation is not yet active, so silencing it is unnecessary',\n // Sometimes happens despite silenceDeprecations\n 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0',\n ]\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && sassWarningTexts.some((text) => args[1].includes(text))) ||\n (typeof args[0] === 'string' && sassWarningTexts.some((text) => args[0].includes(text)))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n"],"mappings":"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","ignoreList":[]}
@@ -1,41 +1,40 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
  import { withPayload } from './withPayload.js';
3
- describe('withPayload', ()=>{
4
- it('should set process.env.NEXT_BASE_PATH when nextConfig.basePath is provided', ()=>{
5
- const originalBasePath = process.env.NEXT_BASE_PATH;
3
+ describe('withPayload', () => {
4
+ it('should set process.env.NEXT_BASE_PATH when nextConfig.basePath is provided', () => {
5
+ const originalBasePath = process.env.NEXT_BASE_PATH;
6
+ delete process.env.NEXT_BASE_PATH;
7
+ try {
8
+ const mockNextConfig = {
9
+ basePath: '/test/basepath'
10
+ };
11
+ withPayload(mockNextConfig);
12
+ // Verify it set the env var so formatAdminURL can read it
13
+ expect(process.env.NEXT_BASE_PATH).toBe('/test/basepath');
14
+ } finally {
15
+ // Restore original value
16
+ if (originalBasePath === undefined) {
6
17
  delete process.env.NEXT_BASE_PATH;
7
- try {
8
- const mockNextConfig = {
9
- basePath: '/test/basepath'
10
- };
11
- withPayload(mockNextConfig);
12
- // Verify it set the env var so formatAdminURL can read it
13
- expect(process.env.NEXT_BASE_PATH).toBe('/test/basepath');
14
- } finally{
15
- // Restore original value
16
- if (originalBasePath === undefined) {
17
- delete process.env.NEXT_BASE_PATH;
18
- } else {
19
- process.env.NEXT_BASE_PATH = originalBasePath;
20
- }
21
- }
22
- });
23
- it('should not modify process.env.NEXT_BASE_PATH when basePath is not provided', ()=>{
24
- const originalBasePath = process.env.NEXT_BASE_PATH;
25
- try {
26
- const mockNextConfig = {};
27
- withPayload(mockNextConfig);
28
- // Verify it didn't set the env var
29
- expect(process.env.NEXT_BASE_PATH).toBe(originalBasePath);
30
- } finally{
31
- // Restore original value
32
- if (originalBasePath === undefined) {
33
- delete process.env.NEXT_BASE_PATH;
34
- } else {
35
- process.env.NEXT_BASE_PATH = originalBasePath;
36
- }
37
- }
38
- });
18
+ } else {
19
+ process.env.NEXT_BASE_PATH = originalBasePath;
20
+ }
21
+ }
22
+ });
23
+ it('should not modify process.env.NEXT_BASE_PATH when basePath is not provided', () => {
24
+ const originalBasePath = process.env.NEXT_BASE_PATH;
25
+ try {
26
+ const mockNextConfig = {};
27
+ withPayload(mockNextConfig);
28
+ // Verify it didn't set the env var
29
+ expect(process.env.NEXT_BASE_PATH).toBe(originalBasePath);
30
+ } finally {
31
+ // Restore original value
32
+ if (originalBasePath === undefined) {
33
+ delete process.env.NEXT_BASE_PATH;
34
+ } else {
35
+ process.env.NEXT_BASE_PATH = originalBasePath;
36
+ }
37
+ }
38
+ });
39
39
  });
40
-
41
40
  //# sourceMappingURL=withPayload.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/withPayload/withPayload.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { withPayload } from './withPayload.js'\n\ndescribe('withPayload', () => {\n it('should set process.env.NEXT_BASE_PATH when nextConfig.basePath is provided', () => {\n const originalBasePath = process.env.NEXT_BASE_PATH\n delete process.env.NEXT_BASE_PATH\n\n try {\n const mockNextConfig = {\n basePath: '/test/basepath',\n }\n\n withPayload(mockNextConfig)\n\n // Verify it set the env var so formatAdminURL can read it\n expect(process.env.NEXT_BASE_PATH).toBe('/test/basepath')\n } finally {\n // Restore original value\n if (originalBasePath === undefined) {\n delete process.env.NEXT_BASE_PATH\n } else {\n process.env.NEXT_BASE_PATH = originalBasePath\n }\n }\n })\n\n it('should not modify process.env.NEXT_BASE_PATH when basePath is not provided', () => {\n const originalBasePath = process.env.NEXT_BASE_PATH\n\n try {\n const mockNextConfig = {}\n\n withPayload(mockNextConfig)\n\n // Verify it didn't set the env var\n expect(process.env.NEXT_BASE_PATH).toBe(originalBasePath)\n } finally {\n // Restore original value\n if (originalBasePath === undefined) {\n delete process.env.NEXT_BASE_PATH\n } else {\n process.env.NEXT_BASE_PATH = originalBasePath\n }\n }\n })\n})\n"],"names":["describe","expect","it","withPayload","originalBasePath","process","env","NEXT_BASE_PATH","mockNextConfig","basePath","toBe","undefined"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,WAAW,QAAQ,mBAAkB;AAE9CH,SAAS,eAAe;IACtBE,GAAG,8EAA8E;QAC/E,MAAME,mBAAmBC,QAAQC,GAAG,CAACC,cAAc;QACnD,OAAOF,QAAQC,GAAG,CAACC,cAAc;QAEjC,IAAI;YACF,MAAMC,iBAAiB;gBACrBC,UAAU;YACZ;YAEAN,YAAYK;YAEZ,0DAA0D;YAC1DP,OAAOI,QAAQC,GAAG,CAACC,cAAc,EAAEG,IAAI,CAAC;QAC1C,SAAU;YACR,yBAAyB;YACzB,IAAIN,qBAAqBO,WAAW;gBAClC,OAAON,QAAQC,GAAG,CAACC,cAAc;YACnC,OAAO;gBACLF,QAAQC,GAAG,CAACC,cAAc,GAAGH;YAC/B;QACF;IACF;IAEAF,GAAG,8EAA8E;QAC/E,MAAME,mBAAmBC,QAAQC,GAAG,CAACC,cAAc;QAEnD,IAAI;YACF,MAAMC,iBAAiB,CAAC;YAExBL,YAAYK;YAEZ,mCAAmC;YACnCP,OAAOI,QAAQC,GAAG,CAACC,cAAc,EAAEG,IAAI,CAACN;QAC1C,SAAU;YACR,yBAAyB;YACzB,IAAIA,qBAAqBO,WAAW;gBAClC,OAAON,QAAQC,GAAG,CAACC,cAAc;YACnC,OAAO;gBACLF,QAAQC,GAAG,CAACC,cAAc,GAAGH;YAC/B;QACF;IACF;AACF"}
1
+ {"version":3,"file":"withPayload.spec.js","names":["describe","expect","it","withPayload","originalBasePath","process","env","NEXT_BASE_PATH","mockNextConfig","basePath","toBe","undefined"],"sources":["../../src/withPayload/withPayload.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { withPayload } from './withPayload.js'\n\ndescribe('withPayload', () => {\n it('should set process.env.NEXT_BASE_PATH when nextConfig.basePath is provided', () => {\n const originalBasePath = process.env.NEXT_BASE_PATH\n delete process.env.NEXT_BASE_PATH\n\n try {\n const mockNextConfig = {\n basePath: '/test/basepath',\n }\n\n withPayload(mockNextConfig)\n\n // Verify it set the env var so formatAdminURL can read it\n expect(process.env.NEXT_BASE_PATH).toBe('/test/basepath')\n } finally {\n // Restore original value\n if (originalBasePath === undefined) {\n delete process.env.NEXT_BASE_PATH\n } else {\n process.env.NEXT_BASE_PATH = originalBasePath\n }\n }\n })\n\n it('should not modify process.env.NEXT_BASE_PATH when basePath is not provided', () => {\n const originalBasePath = process.env.NEXT_BASE_PATH\n\n try {\n const mockNextConfig = {}\n\n withPayload(mockNextConfig)\n\n // Verify it didn't set the env var\n expect(process.env.NEXT_BASE_PATH).toBe(originalBasePath)\n } finally {\n // Restore original value\n if (originalBasePath === undefined) {\n delete process.env.NEXT_BASE_PATH\n } else {\n process.env.NEXT_BASE_PATH = originalBasePath\n }\n }\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,WAAW,QAAQ;AAE5BH,QAAA,CAAS,eAAe;EACtBE,EAAA,CAAG,8EAA8E;IAC/E,MAAME,gBAAA,GAAmBC,OAAA,CAAQC,GAAG,CAACC,cAAc;IACnD,OAAOF,OAAA,CAAQC,GAAG,CAACC,cAAc;IAEjC,IAAI;MACF,MAAMC,cAAA,GAAiB;QACrBC,QAAA,EAAU;MACZ;MAEAN,WAAA,CAAYK,cAAA;MAEZ;MACAP,MAAA,CAAOI,OAAA,CAAQC,GAAG,CAACC,cAAc,EAAEG,IAAI,CAAC;IAC1C,UAAU;MACR;MACA,IAAIN,gBAAA,KAAqBO,SAAA,EAAW;QAClC,OAAON,OAAA,CAAQC,GAAG,CAACC,cAAc;MACnC,OAAO;QACLF,OAAA,CAAQC,GAAG,CAACC,cAAc,GAAGH,gBAAA;MAC/B;IACF;EACF;EAEAF,EAAA,CAAG,8EAA8E;IAC/E,MAAME,gBAAA,GAAmBC,OAAA,CAAQC,GAAG,CAACC,cAAc;IAEnD,IAAI;MACF,MAAMC,cAAA,GAAiB,CAAC;MAExBL,WAAA,CAAYK,cAAA;MAEZ;MACAP,MAAA,CAAOI,OAAA,CAAQC,GAAG,CAACC,cAAc,EAAEG,IAAI,CAACN,gBAAA;IAC1C,UAAU;MACR;MACA,IAAIA,gBAAA,KAAqBO,SAAA,EAAW;QAClC,OAAON,OAAA,CAAQC,GAAG,CAACC,cAAc;MACnC,OAAO;QACLF,OAAA,CAAQC,GAAG,CAACC,cAAc,GAAGH,gBAAA;MAC/B;IACF;EACF;AACF","ignoreList":[]}