@payloadcms/next 3.68.0-internal-debug.e9b66ee → 3.68.0-internal.10bf491

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 (398) 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 +41 -65
  8. package/dist/cjs/withPayload.cjs.map +1 -1
  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 +72 -26
  14. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
  15. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +54 -36
  16. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  17. package/dist/elements/DocumentHeader/Tabs/index.js +64 -42
  18. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  19. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +24 -8
  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 +29 -11
  24. package/dist/elements/DocumentHeader/index.js.map +1 -1
  25. package/dist/elements/FormHeader/index.js +17 -10
  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 +45 -8
  30. package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
  31. package/dist/elements/Nav/NavWrapper/index.js +55 -15
  32. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  33. package/dist/elements/Nav/SettingsMenuButton/index.js +40 -11
  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 +111 -42
  38. package/dist/elements/Nav/index.client.js.map +1 -1
  39. package/dist/elements/Nav/index.js +121 -90
  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 +21 -13
  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.js +104 -64
  64. package/dist/layouts/Root/index.js.map +1 -1
  65. package/dist/prod/styles.css +1 -5
  66. package/dist/routes/graphql/handler.js +122 -114
  67. package/dist/routes/graphql/handler.js.map +1 -1
  68. package/dist/routes/graphql/index.js +0 -1
  69. package/dist/routes/graphql/index.js.map +1 -1
  70. package/dist/routes/graphql/playground.js +23 -24
  71. package/dist/routes/graphql/playground.js.map +1 -1
  72. package/dist/routes/index.js +0 -1
  73. package/dist/routes/index.js.map +1 -1
  74. package/dist/routes/rest/index.js +19 -20
  75. package/dist/routes/rest/index.js.map +1 -1
  76. package/dist/routes/rest/og/image.js +72 -60
  77. package/dist/routes/rest/og/image.js.map +1 -1
  78. package/dist/routes/rest/og/index.js +55 -46
  79. package/dist/routes/rest/og/index.js.map +1 -1
  80. package/dist/templates/Default/NavHamburger/index.js +21 -4
  81. package/dist/templates/Default/NavHamburger/index.js.map +1 -1
  82. package/dist/templates/Default/Wrapper/index.js +45 -14
  83. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  84. package/dist/templates/Default/index.js +133 -115
  85. package/dist/templates/Default/index.js.map +1 -1
  86. package/dist/templates/Minimal/index.js +18 -12
  87. package/dist/templates/Minimal/index.js.map +1 -1
  88. package/dist/utilities/getExistingAuthToken.js +2 -3
  89. package/dist/utilities/getExistingAuthToken.js.map +1 -1
  90. package/dist/utilities/getNextRequestI18n.js +13 -12
  91. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  92. package/dist/utilities/getPayloadHMR.js +5 -5
  93. package/dist/utilities/getPayloadHMR.js.map +1 -1
  94. package/dist/utilities/getPreferences.js +22 -27
  95. package/dist/utilities/getPreferences.js.map +1 -1
  96. package/dist/utilities/getRequestLocale.js +14 -13
  97. package/dist/utilities/getRequestLocale.js.map +1 -1
  98. package/dist/utilities/getRequestTheme.js +19 -19
  99. package/dist/utilities/getRequestTheme.js.map +1 -1
  100. package/dist/utilities/getRouteWithoutAdmin.js +5 -3
  101. package/dist/utilities/getRouteWithoutAdmin.js.map +1 -1
  102. package/dist/utilities/getVisibleEntities.js +23 -12
  103. package/dist/utilities/getVisibleEntities.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 +39 -32
  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.js +26 -22
  111. package/dist/utilities/isCustomAdminView.js.map +1 -1
  112. package/dist/utilities/isPublicAdminRoute.js +20 -26
  113. package/dist/utilities/isPublicAdminRoute.js.map +1 -1
  114. package/dist/utilities/meta.js +63 -68
  115. package/dist/utilities/meta.js.map +1 -1
  116. package/dist/utilities/selectiveCache.js +26 -25
  117. package/dist/utilities/selectiveCache.js.map +1 -1
  118. package/dist/utilities/setPayloadAuthCookie.js +22 -19
  119. package/dist/utilities/setPayloadAuthCookie.js.map +1 -1
  120. package/dist/utilities/slugify.js +33 -24
  121. package/dist/utilities/slugify.js.map +1 -1
  122. package/dist/utilities/timestamp.js +6 -7
  123. package/dist/utilities/timestamp.js.map +1 -1
  124. package/dist/views/API/LocaleSelector/index.js +39 -7
  125. package/dist/views/API/LocaleSelector/index.js.map +1 -1
  126. package/dist/views/API/RenderJSON/index.js +119 -67
  127. package/dist/views/API/RenderJSON/index.js.map +1 -1
  128. package/dist/views/API/index.client.js +184 -132
  129. package/dist/views/API/index.client.js.map +1 -1
  130. package/dist/views/API/index.js +3 -2
  131. package/dist/views/API/index.js.map +1 -1
  132. package/dist/views/API/metadata.js +23 -18
  133. package/dist/views/API/metadata.js.map +1 -1
  134. package/dist/views/Account/ResetPreferences/index.js +91 -47
  135. package/dist/views/Account/ResetPreferences/index.js.map +1 -1
  136. package/dist/views/Account/Settings/LanguageSelector.js +48 -7
  137. package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
  138. package/dist/views/Account/Settings/index.js +29 -17
  139. package/dist/views/Account/Settings/index.js.map +1 -1
  140. package/dist/views/Account/ToggleTheme/index.js +56 -28
  141. package/dist/views/Account/ToggleTheme/index.js.map +1 -1
  142. package/dist/views/Account/index.client.js +32 -16
  143. package/dist/views/Account/index.client.js.map +1 -1
  144. package/dist/views/Account/index.js +156 -87
  145. package/dist/views/Account/index.js.map +1 -1
  146. package/dist/views/Account/metadata.js +12 -8
  147. package/dist/views/Account/metadata.js.map +1 -1
  148. package/dist/views/BrowseByFolder/buildView.js +159 -130
  149. package/dist/views/BrowseByFolder/buildView.js.map +1 -1
  150. package/dist/views/BrowseByFolder/index.js +16 -16
  151. package/dist/views/BrowseByFolder/index.js.map +1 -1
  152. package/dist/views/BrowseByFolder/metadata.js +15 -13
  153. package/dist/views/BrowseByFolder/metadata.js.map +1 -1
  154. package/dist/views/CollectionFolders/buildView.js +144 -114
  155. package/dist/views/CollectionFolders/buildView.js.map +1 -1
  156. package/dist/views/CollectionFolders/index.js +16 -16
  157. package/dist/views/CollectionFolders/index.js.map +1 -1
  158. package/dist/views/CollectionFolders/metadata.js +21 -18
  159. package/dist/views/CollectionFolders/metadata.js.map +1 -1
  160. package/dist/views/CollectionFolders/renderFolderViewSlots.js +61 -58
  161. package/dist/views/CollectionFolders/renderFolderViewSlots.js.map +1 -1
  162. package/dist/views/CollectionTrash/index.js +17 -17
  163. package/dist/views/CollectionTrash/index.js.map +1 -1
  164. package/dist/views/CollectionTrash/metadata.js +21 -18
  165. package/dist/views/CollectionTrash/metadata.js.map +1 -1
  166. package/dist/views/CreateFirstUser/index.client.js +98 -56
  167. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  168. package/dist/views/CreateFirstUser/index.js +82 -57
  169. package/dist/views/CreateFirstUser/index.js.map +1 -1
  170. package/dist/views/CreateFirstUser/metadata.js +12 -8
  171. package/dist/views/CreateFirstUser/metadata.js.map +1 -1
  172. package/dist/views/Dashboard/Default/index.js +128 -77
  173. package/dist/views/Dashboard/Default/index.js.map +1 -1
  174. package/dist/views/Dashboard/index.js +90 -78
  175. package/dist/views/Dashboard/index.js.map +1 -1
  176. package/dist/views/Dashboard/metadata.js +14 -10
  177. package/dist/views/Dashboard/metadata.js.map +1 -1
  178. package/dist/views/Document/getCustomDocumentViewByKey.js +2 -3
  179. package/dist/views/Document/getCustomDocumentViewByKey.js.map +1 -1
  180. package/dist/views/Document/getCustomViewByRoute.js +30 -27
  181. package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
  182. package/dist/views/Document/getDocPreferences.js +41 -40
  183. package/dist/views/Document/getDocPreferences.js.map +1 -1
  184. package/dist/views/Document/getDocumentData.js +55 -44
  185. package/dist/views/Document/getDocumentData.js.map +1 -1
  186. package/dist/views/Document/getDocumentPermissions.js +80 -77
  187. package/dist/views/Document/getDocumentPermissions.js.map +1 -1
  188. package/dist/views/Document/getDocumentView.js +283 -313
  189. package/dist/views/Document/getDocumentView.js.map +1 -1
  190. package/dist/views/Document/getIsLocked.js +66 -66
  191. package/dist/views/Document/getIsLocked.js.map +1 -1
  192. package/dist/views/Document/getMetaBySegment.js +136 -130
  193. package/dist/views/Document/getMetaBySegment.js.map +1 -1
  194. package/dist/views/Document/getVersions.js +194 -204
  195. package/dist/views/Document/getVersions.js.map +1 -1
  196. package/dist/views/Document/handleServerFunction.js +128 -103
  197. package/dist/views/Document/handleServerFunction.js.map +1 -1
  198. package/dist/views/Document/index.js +351 -250
  199. package/dist/views/Document/index.js.map +1 -1
  200. package/dist/views/Document/metadata.js +1 -2
  201. package/dist/views/Document/metadata.js.map +1 -1
  202. package/dist/views/Document/renderDocumentSlots.js +132 -121
  203. package/dist/views/Document/renderDocumentSlots.js.map +1 -1
  204. package/dist/views/Edit/index.js +7 -3
  205. package/dist/views/Edit/index.js.map +1 -1
  206. package/dist/views/Edit/metadata.js +46 -36
  207. package/dist/views/Edit/metadata.js.map +1 -1
  208. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +151 -70
  209. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  210. package/dist/views/ForgotPassword/index.js +61 -26
  211. package/dist/views/ForgotPassword/index.js.map +1 -1
  212. package/dist/views/ForgotPassword/metadata.js +12 -8
  213. package/dist/views/ForgotPassword/metadata.js.map +1 -1
  214. package/dist/views/List/createSerializableValue.js +11 -12
  215. package/dist/views/List/createSerializableValue.js.map +1 -1
  216. package/dist/views/List/enrichDocsWithVersionStatus.js +86 -86
  217. package/dist/views/List/enrichDocsWithVersionStatus.js.map +1 -1
  218. package/dist/views/List/extractRelationshipDisplayValue.js +14 -15
  219. package/dist/views/List/extractRelationshipDisplayValue.js.map +1 -1
  220. package/dist/views/List/extractValueOrRelationshipID.js +15 -16
  221. package/dist/views/List/extractValueOrRelationshipID.js.map +1 -1
  222. package/dist/views/List/handleGroupBy.js +150 -133
  223. package/dist/views/List/handleGroupBy.js.map +1 -1
  224. package/dist/views/List/handleServerFunction.js +119 -96
  225. package/dist/views/List/handleServerFunction.js.map +1 -1
  226. package/dist/views/List/index.js +324 -284
  227. package/dist/views/List/index.js.map +1 -1
  228. package/dist/views/List/metadata.js +20 -17
  229. package/dist/views/List/metadata.js.map +1 -1
  230. package/dist/views/List/renderListViewSlots.js +75 -70
  231. package/dist/views/List/renderListViewSlots.js.map +1 -1
  232. package/dist/views/List/resolveAllFilterOptions.js +45 -43
  233. package/dist/views/List/resolveAllFilterOptions.js.map +1 -1
  234. package/dist/views/List/transformColumnsToSelect.js +8 -9
  235. package/dist/views/List/transformColumnsToSelect.js.map +1 -1
  236. package/dist/views/Login/LoginField/index.js +90 -32
  237. package/dist/views/Login/LoginField/index.js.map +1 -1
  238. package/dist/views/Login/LoginForm/index.js +156 -55
  239. package/dist/views/Login/LoginForm/index.js.map +1 -1
  240. package/dist/views/Login/index.js +86 -50
  241. package/dist/views/Login/index.js.map +1 -1
  242. package/dist/views/Login/metadata.js +12 -8
  243. package/dist/views/Login/metadata.js.map +1 -1
  244. package/dist/views/Logout/LogoutClient.js +119 -54
  245. package/dist/views/Logout/LogoutClient.js.map +1 -1
  246. package/dist/views/Logout/index.js +30 -8
  247. package/dist/views/Logout/index.js.map +1 -1
  248. package/dist/views/Logout/metadata.js +11 -7
  249. package/dist/views/Logout/metadata.js.map +1 -1
  250. package/dist/views/NotFound/index.client.js +83 -32
  251. package/dist/views/NotFound/index.client.js.map +1 -1
  252. package/dist/views/NotFound/index.js +73 -44
  253. package/dist/views/NotFound/index.js.map +1 -1
  254. package/dist/views/NotFound/metadata.js +9 -7
  255. package/dist/views/NotFound/metadata.js.map +1 -1
  256. package/dist/views/ResetPassword/ResetPasswordForm/index.js +107 -49
  257. package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
  258. package/dist/views/ResetPassword/index.js +72 -29
  259. package/dist/views/ResetPassword/index.js.map +1 -1
  260. package/dist/views/ResetPassword/metadata.js +12 -8
  261. package/dist/views/ResetPassword/metadata.js.map +1 -1
  262. package/dist/views/Root/attachViewActions.js +23 -18
  263. package/dist/views/Root/attachViewActions.js.map +1 -1
  264. package/dist/views/Root/generateCustomViewMetadata.js +21 -19
  265. package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
  266. package/dist/views/Root/getCustomViewByKey.js +14 -12
  267. package/dist/views/Root/getCustomViewByKey.js.map +1 -1
  268. package/dist/views/Root/getCustomViewByRoute.js +42 -31
  269. package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
  270. package/dist/views/Root/getDocumentViewInfo.js +23 -24
  271. package/dist/views/Root/getDocumentViewInfo.js.map +1 -1
  272. package/dist/views/Root/getRouteData.js +325 -333
  273. package/dist/views/Root/getRouteData.js.map +1 -1
  274. package/dist/views/Root/index.js +265 -203
  275. package/dist/views/Root/index.js.map +1 -1
  276. package/dist/views/Root/isPathMatchingRoute.js +26 -21
  277. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  278. package/dist/views/Root/metadata.js +181 -176
  279. package/dist/views/Root/metadata.js.map +1 -1
  280. package/dist/views/Unauthorized/index.js +45 -18
  281. package/dist/views/Unauthorized/index.js.map +1 -1
  282. package/dist/views/Unauthorized/metadata.js +12 -8
  283. package/dist/views/Unauthorized/metadata.js.map +1 -1
  284. package/dist/views/Verify/index.client.js +43 -25
  285. package/dist/views/Verify/index.client.js.map +1 -1
  286. package/dist/views/Verify/index.js +62 -31
  287. package/dist/views/Verify/index.js.map +1 -1
  288. package/dist/views/Verify/metadata.js +12 -8
  289. package/dist/views/Verify/metadata.js.map +1 -1
  290. package/dist/views/Version/Default/SelectedLocalesContext.js +4 -4
  291. package/dist/views/Version/Default/SelectedLocalesContext.js.map +1 -1
  292. package/dist/views/Version/Default/SetStepNav.js +127 -86
  293. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  294. package/dist/views/Version/Default/index.js +236 -174
  295. package/dist/views/Version/Default/index.js.map +1 -1
  296. package/dist/views/Version/Default/types.js +1 -2
  297. package/dist/views/Version/Default/types.js.map +1 -1
  298. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +120 -54
  299. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
  300. package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +74 -37
  301. package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -1
  302. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +408 -363
  303. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
  304. package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +52 -12
  305. package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
  306. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +66 -21
  307. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +1 -1
  308. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +57 -15
  309. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
  310. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +118 -55
  311. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  312. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js +41 -36
  313. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js.map +1 -1
  314. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +179 -65
  315. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
  316. package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js +12 -5
  317. package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js.map +1 -1
  318. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +72 -34
  319. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  320. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +139 -57
  321. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
  322. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +80 -42
  323. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  324. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js +211 -103
  325. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js.map +1 -1
  326. package/dist/views/Version/RenderFieldsToDiff/fields/index.js +22 -23
  327. package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
  328. package/dist/views/Version/RenderFieldsToDiff/index.js +9 -4
  329. package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
  330. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +228 -213
  331. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
  332. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +826 -1005
  333. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +1 -1
  334. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js +1 -2
  335. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js.map +1 -1
  336. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +43 -44
  337. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +1 -1
  338. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js +22 -25
  339. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js.map +1 -1
  340. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +36 -32
  341. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
  342. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +129 -145
  343. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +1 -1
  344. package/dist/views/Version/Restore/index.js +92 -77
  345. package/dist/views/Version/Restore/index.js.map +1 -1
  346. package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js +50 -25
  347. package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js.map +1 -1
  348. package/dist/views/Version/SelectComparison/VersionDrawer/index.js +227 -140
  349. package/dist/views/Version/SelectComparison/VersionDrawer/index.js.map +1 -1
  350. package/dist/views/Version/SelectComparison/index.js +51 -44
  351. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  352. package/dist/views/Version/SelectComparison/types.js +1 -2
  353. package/dist/views/Version/SelectComparison/types.js.map +1 -1
  354. package/dist/views/Version/SelectLocales/index.js +30 -16
  355. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  356. package/dist/views/Version/VersionPillLabel/VersionPillLabel.js +95 -37
  357. package/dist/views/Version/VersionPillLabel/VersionPillLabel.js.map +1 -1
  358. package/dist/views/Version/VersionPillLabel/getVersionLabel.js +27 -23
  359. package/dist/views/Version/VersionPillLabel/getVersionLabel.js.map +1 -1
  360. package/dist/views/Version/fetchVersions.js +138 -113
  361. package/dist/views/Version/fetchVersions.js.map +1 -1
  362. package/dist/views/Version/index.js +323 -283
  363. package/dist/views/Version/index.js.map +1 -1
  364. package/dist/views/Version/metadata.js +50 -43
  365. package/dist/views/Version/metadata.js.map +1 -1
  366. package/dist/views/Versions/buildColumns.js +80 -47
  367. package/dist/views/Versions/buildColumns.js.map +1 -1
  368. package/dist/views/Versions/cells/AutosaveCell/index.js +39 -8
  369. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  370. package/dist/views/Versions/cells/CreatedAt/index.js +54 -25
  371. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  372. package/dist/views/Versions/cells/ID/index.js +9 -4
  373. package/dist/views/Versions/cells/ID/index.js.map +1 -1
  374. package/dist/views/Versions/index.client.js +83 -28
  375. package/dist/views/Versions/index.client.js.map +1 -1
  376. package/dist/views/Versions/index.js +140 -94
  377. package/dist/views/Versions/index.js.map +1 -1
  378. package/dist/views/Versions/metadata.js +44 -37
  379. package/dist/views/Versions/metadata.js.map +1 -1
  380. package/dist/views/Versions/types.js +1 -2
  381. package/dist/views/Versions/types.js.map +1 -1
  382. package/dist/withPayload.d.ts +8 -2
  383. package/dist/withPayload.d.ts.map +1 -1
  384. package/dist/withPayload.js +145 -219
  385. package/dist/withPayload.js.map +1 -1
  386. package/dist/withPayload.utils.d.ts +58 -0
  387. package/dist/withPayload.utils.d.ts.map +1 -0
  388. package/dist/withPayload.utils.js +101 -0
  389. package/dist/withPayload.utils.js.map +1 -0
  390. package/dist/withPayloadLegacy.d.ts +6 -0
  391. package/dist/withPayloadLegacy.d.ts.map +1 -0
  392. package/dist/withPayloadLegacy.js +44 -0
  393. package/dist/withPayloadLegacy.js.map +1 -0
  394. package/package.json +15 -17
  395. package/dist/esbuildEntry.d.ts +0 -5
  396. package/dist/esbuildEntry.d.ts.map +0 -1
  397. package/dist/esbuildEntry.js +0 -6
  398. package/dist/esbuildEntry.js.map +0 -1
@@ -1,229 +1,155 @@
1
+ /* eslint-disable no-console */ /* eslint-disable no-restricted-exports */import { getNextjsVersion, supportsTurbopackExternalizeTransitiveDependencies } from './withPayload.utils.js';
2
+ import { withPayloadLegacy } from './withPayloadLegacy.js';
3
+ const poweredByHeader = {
4
+ key: 'X-Powered-By',
5
+ value: 'Next.js, Payload'
6
+ };
1
7
  /**
2
8
  * @param {import('next').NextConfig} nextConfig
3
9
  * @param {Object} [options] - Optional configuration options
4
10
  * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false
5
- *
6
- * @returns {import('next').NextConfig}
7
- * */ export const withPayload = (nextConfig = {}, options = {})=>{
8
- const env = nextConfig.env || {};
9
- if (nextConfig.experimental?.staleTimes?.dynamic) {
10
- 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.');
11
- env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
12
- }
13
- if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {
14
- // TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.
15
- // We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991
16
- const turbopackWarningText = 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\nTry to install it into the project directory by running';
17
- // TODO 4.0: Remove this once we drop support for Next.js 15.2.x
18
- const turbopackConfigWarningText = "Unrecognized key(s) in object: 'turbopack'";
19
- const consoleWarn = console.warn;
20
- console.warn = (...args)=>{
21
- // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
22
- if (typeof args[1] === 'string' && args[1].includes(turbopackWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackWarningText)) {
23
- return;
24
- }
25
- // Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.
26
- // TODO 4.0: Remove this once we drop support for Next.js 15.2.x
27
- const hasTurbopackConfigWarning = typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText);
28
- if (hasTurbopackConfigWarning) {
29
- consoleWarn(...args);
30
- consoleWarn('Payload: You can safely ignore the "Invalid next.config" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to Next.js 15.4.7 to resolve this warning.');
31
- return;
32
- }
33
- consoleWarn(...args);
34
- };
35
- }
36
- const isBuild = process.env.NODE_ENV === 'production';
37
- const isTurbopackNextjs15 = process.env.TURBOPACK === '1';
38
- const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto';
39
- if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {
40
- throw new Error('Payload does not support using Turbopack for production builds. If you are using Next.js 16, please use `next build --webpack` instead.');
41
- }
42
- const poweredByHeader = {
43
- key: 'X-Powered-By',
44
- value: 'Next.js, Payload'
45
- };
11
+ * */
12
+ export const withPayload = (nextConfig = {}, options = {}) => {
13
+ const nextjsVersion = getNextjsVersion();
14
+ const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion);
15
+ const env = nextConfig.env || {};
16
+ if (nextConfig.experimental?.staleTimes?.dynamic) {
17
+ 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.');
18
+ env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
19
+ }
20
+ const baseConfig = {
21
+ ...nextConfig,
22
+ env,
23
+ outputFileTracingExcludes: {
24
+ ...(nextConfig.outputFileTracingExcludes || {}),
25
+ '**/*': [...(nextConfig.outputFileTracingExcludes?.['**/*'] || []), 'drizzle-kit', 'drizzle-kit/api']
26
+ },
27
+ outputFileTracingIncludes: {
28
+ ...(nextConfig.outputFileTracingIncludes || {}),
29
+ '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client']
30
+ },
31
+ turbopack: {
32
+ ...(nextConfig.turbopack || {})
33
+ },
34
+ // We disable the poweredByHeader here because we add it manually in the headers function below
35
+ ...(nextConfig.poweredByHeader !== false ? {
36
+ poweredByHeader: false
37
+ } : {}),
38
+ headers: async () => {
39
+ const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : [];
40
+ return [...(headersFromConfig || []), {
41
+ headers: [{
42
+ key: 'Accept-CH',
43
+ value: 'Sec-CH-Prefers-Color-Scheme'
44
+ }, {
45
+ key: 'Vary',
46
+ value: 'Sec-CH-Prefers-Color-Scheme'
47
+ }, {
48
+ key: 'Critical-CH',
49
+ value: 'Sec-CH-Prefers-Color-Scheme'
50
+ }, ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : [])],
51
+ source: '/:path*'
52
+ }];
53
+ },
54
+ serverExternalPackages: [
55
+ // WHY: without externalizing graphql, a graphql version error will be thrown
56
+ // during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
57
+ 'graphql', ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true ?
46
58
  /**
47
- * @type {import('next').NextConfig}
48
- */ const toReturn = {
49
- ...nextConfig,
50
- env,
51
- turbopack: {
52
- ...nextConfig.turbopack || {}
53
- },
54
- outputFileTracingExcludes: {
55
- ...nextConfig.outputFileTracingExcludes || {},
56
- '**/*': [
57
- ...nextConfig.outputFileTracingExcludes?.['**/*'] || [],
58
- 'drizzle-kit',
59
- 'drizzle-kit/api'
60
- ]
61
- },
62
- outputFileTracingIncludes: {
63
- ...nextConfig.outputFileTracingIncludes || {},
64
- '**/*': [
65
- ...nextConfig.outputFileTracingIncludes?.['**/*'] || [],
66
- '@libsql/client'
67
- ]
68
- },
69
- // We disable the poweredByHeader here because we add it manually in the headers function below
70
- ...nextConfig.poweredByHeader !== false ? {
71
- poweredByHeader: false
72
- } : {},
73
- headers: async ()=>{
74
- const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : [];
75
- return [
76
- ...headersFromConfig || [],
77
- {
78
- source: '/:path*',
79
- headers: [
80
- {
81
- key: 'Accept-CH',
82
- value: 'Sec-CH-Prefers-Color-Scheme'
83
- },
84
- {
85
- key: 'Vary',
86
- value: 'Sec-CH-Prefers-Color-Scheme'
87
- },
88
- {
89
- key: 'Critical-CH',
90
- value: 'Sec-CH-Prefers-Color-Scheme'
91
- },
92
- ...nextConfig.poweredByHeader !== false ? [
93
- poweredByHeader
94
- ] : []
95
- ]
96
- }
97
- ];
98
- },
99
- serverExternalPackages: [
100
- // serverExternalPackages = webpack.externals, but with turbopack support and an additional check
101
- // for whether the package is resolvable from the project root
102
- ...nextConfig.serverExternalPackages || [],
103
- // Can be externalized, because we require users to install graphql themselves - we only rely on it as a peer dependency => resolvable from the project root.
104
- //
105
- // WHY: without externalizing graphql, a graphql version error will be thrown
106
- // during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
107
- 'graphql',
108
- // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.
109
- '@sentry/nextjs',
110
- ...process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true ? /**
111
- * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we
112
- * do not bundle server-only packages during dev for two reasons:
113
- *
114
- * 1. Performance: Fewer files to compile means faster compilation speeds.
115
- * 2. Turbopack support: Webpack's externals are not supported by Turbopack.
116
- *
117
- * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to
118
- * externalized packages that are not resolvable from the project root. So including a package like
119
- * "drizzle-kit" in here would do nothing - Next.js will ignore the rule and still bundle the package -
120
- * because it detects that the package is not resolvable from the project root (= not directly installed
121
- * by the user in their own package.json).
122
- *
123
- * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly
124
- * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).
125
- *
126
- *
127
- *
128
- * We should only do this during development, not build, because externalizing these packages can hurt
129
- * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the
130
- * same package.
131
- *
132
- * Example:
133
- * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)
134
- * - payload (not in bundle, external) -> installs qs-esm (external because of importer)
135
- * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.
136
- *
137
- * During development, these bundle size difference do not matter much, and development speed /
138
- * turbopack support are more important.
139
- */ [
140
- 'payload',
141
- '@payloadcms/db-mongodb',
142
- '@payloadcms/db-postgres',
143
- '@payloadcms/db-sqlite',
144
- '@payloadcms/db-vercel-postgres',
145
- '@payloadcms/db-d1-sqlite',
146
- '@payloadcms/drizzle',
147
- '@payloadcms/email-nodemailer',
148
- '@payloadcms/email-resend',
149
- '@payloadcms/graphql',
150
- '@payloadcms/payload-cloud',
151
- '@payloadcms/plugin-redirects'
152
- ] : // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it
153
- // see: https://github.com/vercel/next.js/discussions/76991
154
- //'@payloadcms/plugin-cloud-storage',
155
- //'@payloadcms/plugin-sentry',
156
- //'@payloadcms/plugin-stripe',
157
- // @payloadcms/richtext-lexical
158
- //'@payloadcms/storage-azure',
159
- //'@payloadcms/storage-gcs',
160
- //'@payloadcms/storage-s3',
161
- //'@payloadcms/storage-uploadthing',
162
- //'@payloadcms/storage-vercel-blob',
163
- []
164
- ],
165
- webpack: (webpackConfig, webpackOptions)=>{
166
- const incomingWebpackConfig = typeof nextConfig.webpack === 'function' ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
167
- return {
168
- ...incomingWebpackConfig,
169
- externals: [
170
- ...incomingWebpackConfig?.externals || [],
171
- /**
172
- * See the explanation in the serverExternalPackages section above.
173
- * We need to force Webpack to emit require() calls for these packages, even though they are not
174
- * 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.
175
- *
176
- * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the
177
- * entry point packages, as explained in the serverExternalPackages section above.
178
- */ 'drizzle-kit',
179
- 'drizzle-kit/api',
180
- 'sharp',
181
- 'libsql',
182
- 'require-in-the-middle'
183
- ],
184
- resolve: {
185
- ...incomingWebpackConfig?.resolve || {},
186
- alias: {
187
- ...incomingWebpackConfig?.resolve?.alias || {}
188
- },
189
- fallback: {
190
- ...incomingWebpackConfig?.resolve?.fallback || {},
191
- /*
192
- * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):
193
- *
194
- * ⚠ Compiled with warnings in 8.7s
195
- *
196
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
197
- * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'
198
- *
199
- * Import trace for requested module:
200
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
201
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js
202
- * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js
203
- * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js
204
- * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js
205
- * ./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
206
- * ./src/payload.config.ts
207
- * ./src/app/my-route/route.ts
208
- *
209
- **/ aws4: false
210
- }
211
- },
212
- plugins: [
213
- ...incomingWebpackConfig?.plugins || [],
214
- // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
215
- new webpackOptions.webpack.IgnorePlugin({
216
- resourceRegExp: /^pg-native$|^cloudflare:sockets$/
217
- })
218
- ]
219
- };
59
+ * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we
60
+ * do not bundle server-only packages during dev for two reasons:
61
+ *
62
+ * 1. Performance: Fewer files to compile means faster compilation speeds.
63
+ * 2. Turbopack support: Webpack's externals are not supported by Turbopack.
64
+ *
65
+ * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to
66
+ * externalized packages that are not resolvable from the project root. So including a package like
67
+ * "drizzle-kit" in here would do nothing - Next.js will ignore the rule and still bundle the package -
68
+ * because it detects that the package is not resolvable from the project root (= not directly installed
69
+ * by the user in their own package.json).
70
+ *
71
+ * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly
72
+ * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).
73
+ *
74
+ *
75
+ *
76
+ * We should only do this during development, not build, because externalizing these packages can hurt
77
+ * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the
78
+ * same package.
79
+ *
80
+ * Example:
81
+ * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)
82
+ * - payload (not in bundle, external) -> installs qs-esm (external because of importer)
83
+ * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.
84
+ *
85
+ * During development, these bundle size difference do not matter much, and development speed /
86
+ * turbopack support are more important.
87
+ */
88
+ ['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'] : [])],
89
+ webpack: (webpackConfig, webpackOptions) => {
90
+ const incomingWebpackConfig = typeof nextConfig.webpack === 'function' ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
91
+ return {
92
+ ...incomingWebpackConfig,
93
+ externals: [...(incomingWebpackConfig?.externals || []),
94
+ /**
95
+ * See the explanation in the serverExternalPackages section above.
96
+ * We need to force Webpack to emit require() calls for these packages, even though they are not
97
+ * 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.
98
+ *
99
+ * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the
100
+ * entry point packages, as explained in the serverExternalPackages section above.
101
+ */
102
+ 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle'],
103
+ plugins: [...(incomingWebpackConfig?.plugins || []),
104
+ // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
105
+ new webpackOptions.webpack.IgnorePlugin({
106
+ resourceRegExp: /^pg-native$|^cloudflare:sockets$/
107
+ })],
108
+ resolve: {
109
+ ...(incomingWebpackConfig?.resolve || {}),
110
+ alias: {
111
+ ...(incomingWebpackConfig?.resolve?.alias || {})
112
+ },
113
+ fallback: {
114
+ ...(incomingWebpackConfig?.resolve?.fallback || {}),
115
+ /*
116
+ * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):
117
+ *
118
+ * Compiled with warnings in 8.7s
119
+ *
120
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
121
+ * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'
122
+ *
123
+ * Import trace for requested module:
124
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js
125
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js
126
+ * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js
127
+ * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js
128
+ * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js
129
+ * ./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
130
+ * ./src/payload.config.ts
131
+ * ./src/app/my-route/route.ts
132
+ *
133
+ **/
134
+ aws4: false
135
+ }
220
136
  }
221
- };
222
- if (nextConfig.basePath) {
223
- toReturn.env.NEXT_BASE_PATH = nextConfig.basePath;
137
+ };
224
138
  }
225
- return toReturn;
139
+ };
140
+ if (nextConfig.basePath) {
141
+ baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath;
142
+ }
143
+ if (!supportsTurbopackBuild) {
144
+ return withPayloadLegacy(baseConfig);
145
+ } else {
146
+ return {
147
+ ...baseConfig,
148
+ serverExternalPackages: [...(baseConfig.serverExternalPackages || []), 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle',
149
+ // Prevents turbopack build errors by the thread-stream package which is installed by pino
150
+ 'pino']
151
+ };
152
+ }
226
153
  };
227
154
  export default withPayload;
228
-
229
155
  //# sourceMappingURL=withPayload.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/withPayload.js"],"sourcesContent":["/**\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 *\n * @returns {import('next').NextConfig}\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\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 (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n // TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.\n // We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991\n const turbopackWarningText =\n 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\\nTry to install it into the project directory by running'\n\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const turbopackConfigWarningText = \"Unrecognized key(s) in object: 'turbopack'\"\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n // Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const hasTurbopackConfigWarning =\n (typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText))\n\n if (hasTurbopackConfigWarning) {\n consoleWarn(...args)\n consoleWarn(\n 'Payload: You can safely ignore the \"Invalid next.config\" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to Next.js 15.4.7 to resolve this warning.',\n )\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const isBuild = process.env.NODE_ENV === 'production'\n const isTurbopackNextjs15 = process.env.TURBOPACK === '1'\n const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto'\n\n if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {\n throw new Error(\n 'Payload does not support using Turbopack for production builds. If you are using Next.js 16, please use `next build --webpack` instead.',\n )\n }\n\n const poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n }\n\n /**\n * @type {import('next').NextConfig}\n */\n const toReturn = {\n ...nextConfig,\n env,\n turbopack: {\n ...(nextConfig.turbopack || {}),\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 // 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 source: '/:path*',\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 },\n ]\n },\n serverExternalPackages: [\n // serverExternalPackages = webpack.externals, but with turbopack support and an additional check\n // for whether the package is resolvable from the project root\n ...(nextConfig.serverExternalPackages || []),\n // Can be externalized, because we require users to install graphql themselves - we only rely on it as a peer dependency => resolvable from the project root.\n //\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 // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.\n '@sentry/nextjs',\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 ],\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 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 }\n },\n }\n\n if (nextConfig.basePath) {\n toReturn.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n return toReturn\n}\n\nexport default withPayload\n"],"names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","process","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","turbopackConfigWarningText","consoleWarn","args","includes","hasTurbopackConfigWarning","isBuild","NODE_ENV","isTurbopackNextjs15","TURBOPACK","isTurbopackNextjs16","Error","poweredByHeader","key","value","toReturn","turbopack","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","resolve","alias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AK,OAC9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA6BC,GACD;gBACE;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aAYD,GAXC,sGAAsG;YACtG,2DAA2D;YAC3D,qCAAqC;YACrC,8BAA8B;YAC9B,8BAA8B;YAC9B,+BAA+B;YAC/B,8BAA8B;YAC9B,4BAA4B;YAC5B,2BAA2B;YAC3B,oCAAoC;YACpC,oCAAoC;YAEtC,EAAE;SACP;QACDC,SAAS,CAACC,eAAeC;YACvB,MAAMC,wBACJ,OAAOtC,WAAWmC,OAAO,KAAK,aAC1BnC,WAAWmC,OAAO,CAACC,eAAeC,kBAClCD;YAEN,OAAO;gBACL,GAAGE,qBAAqB;gBACxBC,WAAW;uBACLD,uBAAuBC,aAAa,EAAE;oBAC1C;;;;;;;WAOC,GACD;oBACA;oBACA;oBACA;oBACA;iBACD;gBACDC,SAAS;oBACP,GAAIF,uBAAuBE,WAAW,CAAC,CAAC;oBACxCC,OAAO;wBACL,GAAIH,uBAAuBE,SAASC,SAAS,CAAC,CAAC;oBACjD;oBACAC,UAAU;wBACR,GAAIJ,uBAAuBE,SAASE,YAAY,CAAC,CAAC;wBAClD;;;;;;;;;;;;;;;;;;cAkBE,GACFC,MAAM;oBACR;gBACF;gBACAC,SAAS;uBACHN,uBAAuBM,WAAW,EAAE;oBACxC,oFAAoF;oBACpF,IAAIP,eAAeF,OAAO,CAACU,YAAY,CAAC;wBACtCC,gBAAgB;oBAClB;iBACD;YACH;QACF;IACF;IAEA,IAAI9C,WAAW+C,QAAQ,EAAE;QACvBrB,SAASxB,GAAG,CAAC8C,cAAc,GAAGhD,WAAW+C,QAAQ;IACnD;IAEA,OAAOrB;AACT,EAAC;AAED,eAAe3B,YAAW"}
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","baseConfig","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.ts"],"sourcesContent":["/* eslint-disable no-console */\n/* eslint-disable no-restricted-exports */\nimport type { NextConfig } from 'next'\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 = (\n nextConfig: NextConfig = {},\n options: { devBundleServerPackages?: boolean } = {},\n): NextConfig => {\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 baseConfig: NextConfig = {\n ...nextConfig,\n env,\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 // 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 ],\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 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 // 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":"A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AASE,QAAA,IAAY,CAAC,CAAC;YAClD;;;;;;;;;;;;;;;;;;;YAmBAC,IAAA,EAAM;UACR;QACF;MACF;IACF;EACF;EAEA,IAAIjC,UAAA,CAAWkC,QAAQ,EAAE;IACvBvB,UAAA,CAAWP,GAAG,CAAC+B,cAAc,GAAGnC,UAAA,CAAWkC,QAAQ;EACrD;EAEA,IAAI,CAAC/B,sBAAA,EAAwB;IAC3B,OAAOR,iBAAA,CAAkBgB,UAAA;EAC3B,OAAO;IACL,OAAO;MACL,GAAGA,UAAU;MACbO,sBAAA,EAAwB,C,IAClBP,UAAA,CAAWO,sBAAsB,IAAI,EAAE,GAC3C,eACA,mBACA,SACA,UACA;MACA;MACA;IAEJ;EACF;AACF;AAEA,eAAenB,WAAA","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * This was taken and modified from https://github.com/getsentry/sentry-javascript/blob/15256034ee8150a5b7dcb97d23eca1a5486f0cae/packages/nextjs/src/config/util.ts
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2012 Functional Software, Inc. dba Sentry
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
9
+ * this software and associated documentation files (the "Software"), to deal in
10
+ * the Software without restriction, including without limitation the rights to
11
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12
+ * of the Software, and to permit persons to whom the Software is furnished to do
13
+ * so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+ /**
27
+ * Represents Semantic Versioning object
28
+ */
29
+ type SemVer = {
30
+ buildmetadata?: string;
31
+ /**
32
+ * undefined if not a canary version
33
+ */
34
+ canaryVersion?: number;
35
+ major?: number;
36
+ minor?: number;
37
+ patch?: number;
38
+ prerelease?: string;
39
+ };
40
+ /**
41
+ * Parses input into a SemVer interface
42
+ * @param input string representation of a semver version
43
+ */
44
+ export declare function parseSemver(input: string): SemVer;
45
+ /**
46
+ * Returns the version of Next.js installed in the project, or undefined if it cannot be determined.
47
+ */
48
+ export declare function getNextjsVersion(): SemVer | undefined;
49
+ /**
50
+ * Checks if the current Next.js version supports native debug ids for turbopack.
51
+ * This feature was first introduced in Next.js v15.6.0-canary.36 and marked stable in Next.js v16
52
+ *
53
+ * @param version - version string to check.
54
+ * @returns true if Next.js version supports native debug ids for turbopack builds
55
+ */
56
+ export declare function supportsTurbopackExternalizeTransitiveDependencies(version: SemVer | undefined): boolean;
57
+ export {};
58
+ //# sourceMappingURL=withPayload.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withPayload.utils.d.ts","sourceRoot":"","sources":["../src/withPayload.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAQH;;GAEG;AACH,KAAK,MAAM,GAAG;IACZ,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAMD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAmBjD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAQrD;AAED;;;;;;GAMG;AACH,wBAAgB,kDAAkD,CAChE,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,OAAO,CA+BT"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * This was taken and modified from https://github.com/getsentry/sentry-javascript/blob/15256034ee8150a5b7dcb97d23eca1a5486f0cae/packages/nextjs/src/config/util.ts
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2012 Functional Software, Inc. dba Sentry
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
9
+ * this software and associated documentation files (the "Software"), to deal in
10
+ * the Software without restriction, including without limitation the rights to
11
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12
+ * of the Software, and to permit persons to whom the Software is furnished to do
13
+ * so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */import { readFileSync } from 'fs';
26
+ function _parseInt(input) {
27
+ return parseInt(input || '', 10);
28
+ }
29
+ // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
30
+ const SEMVER_REGEXP = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i;
31
+ /**
32
+ * Parses input into a SemVer interface
33
+ * @param input string representation of a semver version
34
+ */
35
+ export function parseSemver(input) {
36
+ const match = input.match(SEMVER_REGEXP) || [];
37
+ const major = _parseInt(match[1]);
38
+ const minor = _parseInt(match[2]);
39
+ const patch = _parseInt(match[3]);
40
+ const prerelease = match[4];
41
+ const canaryVersion = prerelease?.startsWith('canary.') ? parseInt(prerelease.split('.')[1] || '0', 10) : undefined;
42
+ return {
43
+ buildmetadata: match[5],
44
+ canaryVersion,
45
+ major: isNaN(major) ? undefined : major,
46
+ minor: isNaN(minor) ? undefined : minor,
47
+ patch: isNaN(patch) ? undefined : patch,
48
+ prerelease: match[4]
49
+ };
50
+ }
51
+ /**
52
+ * Returns the version of Next.js installed in the project, or undefined if it cannot be determined.
53
+ */
54
+ export function getNextjsVersion() {
55
+ try {
56
+ const pkgUrl = import.meta.resolve('next/package.json');
57
+ const pkgJson = JSON.parse(readFileSync(new URL(pkgUrl), 'utf8'));
58
+ return parseSemver(pkgJson.version);
59
+ } catch {
60
+ return undefined;
61
+ }
62
+ }
63
+ /**
64
+ * Checks if the current Next.js version supports native debug ids for turbopack.
65
+ * This feature was first introduced in Next.js v15.6.0-canary.36 and marked stable in Next.js v16
66
+ *
67
+ * @param version - version string to check.
68
+ * @returns true if Next.js version supports native debug ids for turbopack builds
69
+ */
70
+ export function supportsTurbopackExternalizeTransitiveDependencies(version) {
71
+ if (!version) {
72
+ return false;
73
+ }
74
+ const {
75
+ canaryVersion,
76
+ major,
77
+ minor
78
+ } = version;
79
+ if (major === undefined || minor === undefined) {
80
+ return false;
81
+ }
82
+ if (major > 16) {
83
+ return true;
84
+ }
85
+ if (major === 16) {
86
+ if (minor > 1) {
87
+ return true;
88
+ }
89
+ if (minor === 1) {
90
+ if (canaryVersion !== undefined) {
91
+ // 16.1.0-canary.15+
92
+ return canaryVersion >= 15;
93
+ } else {
94
+ // Assume that Next.js 16.1 inherits support for this feature from the canary release
95
+ return true;
96
+ }
97
+ }
98
+ }
99
+ return false;
100
+ }
101
+ //# sourceMappingURL=withPayload.utils.js.map