@payloadcms/next 3.68.0-internal.35482da → 3.68.0-internal.a53e749

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 (65) hide show
  1. package/dist/cjs/withPayload.cjs +0 -237
  2. package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +38 -0
  3. package/dist/elements/DocumentHeader/Tabs/index.scss +54 -0
  4. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.scss +9 -0
  5. package/dist/elements/DocumentHeader/index.scss +64 -0
  6. package/dist/elements/FormHeader/index.scss +8 -0
  7. package/dist/elements/Nav/NavWrapper/index.scss +27 -0
  8. package/dist/elements/Nav/SettingsMenuButton/index.scss +11 -0
  9. package/dist/elements/Nav/index.scss +173 -0
  10. package/dist/templates/Default/Wrapper/index.scss +58 -0
  11. package/dist/templates/Default/index.scss +79 -0
  12. package/dist/templates/Minimal/index.scss +30 -0
  13. package/dist/views/API/RenderJSON/index.scss +129 -0
  14. package/dist/views/API/index.client.js +2 -4
  15. package/dist/views/API/index.client.js.map +1 -1
  16. package/dist/views/API/index.scss +119 -0
  17. package/dist/views/Account/Settings/index.scss +48 -0
  18. package/dist/views/BrowseByFolder/index.js +1 -2
  19. package/dist/views/BrowseByFolder/index.js.map +1 -1
  20. package/dist/views/CollectionFolders/index.js +1 -2
  21. package/dist/views/CollectionFolders/index.js.map +1 -1
  22. package/dist/views/CollectionTrash/index.js +1 -2
  23. package/dist/views/CollectionTrash/index.js.map +1 -1
  24. package/dist/views/CreateFirstUser/index.scss +21 -0
  25. package/dist/views/Dashboard/Default/index.scss +69 -0
  26. package/dist/views/List/index.js +1 -2
  27. package/dist/views/List/index.js.map +1 -1
  28. package/dist/views/Login/LoginForm/index.scss +10 -0
  29. package/dist/views/Login/index.scss +10 -0
  30. package/dist/views/Logout/index.scss +25 -0
  31. package/dist/views/NotFound/index.scss +57 -0
  32. package/dist/views/ResetPassword/index.scss +11 -0
  33. package/dist/views/Unauthorized/index.scss +14 -0
  34. package/dist/views/Verify/index.scss +16 -0
  35. package/dist/views/Version/Default/index.scss +170 -0
  36. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.scss +81 -0
  37. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.scss +12 -0
  38. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.scss +9 -0
  39. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +59 -0
  40. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +91 -0
  41. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +4 -0
  42. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.scss +9 -0
  43. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +4 -0
  44. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.scss +121 -0
  45. package/dist/views/Version/RenderFieldsToDiff/index.scss +24 -0
  46. package/dist/views/Version/Restore/index.scss +84 -0
  47. package/dist/views/Version/SelectComparison/VersionDrawer/index.scss +18 -0
  48. package/dist/views/Version/SelectComparison/index.scss +9 -0
  49. package/dist/views/Version/VersionPillLabel/index.scss +26 -0
  50. package/dist/views/Versions/cells/AutosaveCell/index.scss +9 -0
  51. package/dist/views/Versions/index.scss +110 -0
  52. package/dist/withPayload.d.ts +8 -2
  53. package/dist/withPayload.d.ts.map +1 -1
  54. package/dist/withPayload.js +34 -61
  55. package/dist/withPayload.js.map +1 -1
  56. package/dist/withPayload.utils.d.ts +58 -0
  57. package/dist/withPayload.utils.d.ts.map +1 -0
  58. package/dist/withPayload.utils.js +101 -0
  59. package/dist/withPayload.utils.js.map +1 -0
  60. package/dist/withPayloadLegacy.d.ts +6 -0
  61. package/dist/withPayloadLegacy.d.ts.map +1 -0
  62. package/dist/withPayloadLegacy.js +44 -0
  63. package/dist/withPayloadLegacy.js.map +1 -0
  64. package/package.json +14 -16
  65. package/dist/cjs/withPayload.cjs.map +0 -1
@@ -0,0 +1,91 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .relationship-diff-container .field-diff-content {
5
+ padding: 0;
6
+ background: unset;
7
+ }
8
+
9
+ .relationship-diff-container--hasOne {
10
+ .relationship-diff {
11
+ min-width: 100%;
12
+ max-width: fit-content;
13
+ }
14
+ }
15
+
16
+ .relationship-diff-container--hasMany .field-diff-content {
17
+ background: var(--theme-elevation-50);
18
+ padding: 10px;
19
+
20
+ .html-diff {
21
+ display: flex;
22
+ min-width: 0;
23
+ max-width: max-content;
24
+ flex-wrap: wrap;
25
+ gap: calc(var(--base) * 0.5);
26
+ }
27
+
28
+ .relationship-diff {
29
+ padding: calc(var(--base) * 0.15) calc(var(--base) * 0.3);
30
+ }
31
+ }
32
+
33
+ .relationship-diff {
34
+ @extend %body;
35
+ display: flex;
36
+ align-items: center;
37
+ border-radius: $style-radius-s;
38
+ border: 1px solid var(--theme-elevation-150);
39
+ position: relative;
40
+ font-family: var(--font-body);
41
+ max-height: calc(var(--base) * 3);
42
+ padding: calc(var(--base) * 0.35);
43
+
44
+ &[data-match-type='create'] {
45
+ border-color: var(--diff-create-pill-border);
46
+ color: var(--diff-create-parent-color);
47
+
48
+ * {
49
+ color: var(--diff-create-parent-color);
50
+ }
51
+ }
52
+
53
+ &[data-match-type='delete'] {
54
+ border-color: var(--diff-delete-pill-border);
55
+ color: var(--diff-delete-parent-color);
56
+ background-color: var(--diff-delete-pill-bg);
57
+ text-decoration-line: none !important;
58
+
59
+ * {
60
+ color: var(--diff-delete-parent-color);
61
+ text-decoration-line: none;
62
+ }
63
+
64
+ .relationship-diff__info {
65
+ text-decoration-line: line-through;
66
+ }
67
+ }
68
+
69
+ &__info {
70
+ font-weight: 500;
71
+ }
72
+
73
+ &__pill {
74
+ border-radius: $style-radius-s;
75
+ margin: 0 calc(var(--base) * 0.4) 0 calc(var(--base) * 0.2);
76
+ padding: 0 calc(var(--base) * 0.1);
77
+ background-color: var(--theme-elevation-150);
78
+ color: var(--theme-elevation-750);
79
+ }
80
+
81
+ &[data-match-type='create'] .relationship-diff__pill {
82
+ background-color: var(--diff-create-parent-bg);
83
+ color: var(--diff-create-pill-color);
84
+ }
85
+
86
+ &[data-match-type='delete'] .relationship-diff__pill {
87
+ background-color: var(--diff-delete-parent-bg);
88
+ color: var(--diff-delete-pill-color);
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,4 @@
1
+ @layer payload-default {
2
+ .select-diff {
3
+ }
4
+ }
@@ -0,0 +1,9 @@
1
+ @layer payload-default {
2
+ .tabs-diff {
3
+ // Space between each tab or tab locale
4
+ &__tab:not(:first-of-type),
5
+ &__tab-locale:not(:first-of-type) {
6
+ margin-top: var(--base);
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,4 @@
1
+ @layer payload-default {
2
+ .text-diff {
3
+ }
4
+ }
@@ -0,0 +1,121 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .upload-diff-container .field-diff-content {
5
+ padding: 0;
6
+ background: unset;
7
+ }
8
+
9
+ .upload-diff-hasMany {
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: calc(var(--base) * 0.4);
13
+ }
14
+
15
+ .upload-diff {
16
+ @extend %body;
17
+ min-width: 100%;
18
+ max-width: fit-content;
19
+ display: flex;
20
+ align-items: center;
21
+ background-color: var(--theme-elevation-50);
22
+ border-radius: $style-radius-s;
23
+ border: 1px solid var(--theme-elevation-150);
24
+ position: relative;
25
+ font-family: var(--font-body);
26
+ max-height: calc(var(--base) * 3);
27
+ padding: calc(var(--base) * 0.1);
28
+
29
+ &[data-match-type='create'] {
30
+ border-color: var(--diff-create-pill-border);
31
+ color: var(--diff-create-parent-color);
32
+
33
+ * {
34
+ color: var(--diff-create-parent-color);
35
+ }
36
+
37
+ .upload-diff__thumbnail {
38
+ border-radius: 0px;
39
+ border-color: var(--diff-create-pill-border);
40
+ background-color: none;
41
+ }
42
+ }
43
+
44
+ &[data-match-type='delete'] {
45
+ border-color: var(--diff-delete-pill-border);
46
+ text-decoration-line: none;
47
+ color: var(--diff-delete-parent-color);
48
+ background-color: var(--diff-delete-pill-bg);
49
+
50
+ * {
51
+ text-decoration-line: none;
52
+ color: var(--diff-delete-parent-color);
53
+ }
54
+
55
+ .upload-diff__thumbnail {
56
+ border-radius: 0px;
57
+ border-color: var(--diff-delete-pill-border);
58
+ background-color: none;
59
+ }
60
+ }
61
+
62
+ &__card {
63
+ display: flex;
64
+ flex-direction: row;
65
+ align-items: center;
66
+ width: 100%;
67
+ }
68
+
69
+ &__thumbnail {
70
+ width: calc(var(--base) * 3 - base(0.8) * 2);
71
+ height: calc(var(--base) * 3 - base(0.8) * 2);
72
+ position: relative;
73
+ overflow: hidden;
74
+ flex-shrink: 0;
75
+ border-radius: 0px;
76
+ border: 1px solid var(--theme-elevation-100);
77
+
78
+ img,
79
+ svg {
80
+ position: absolute;
81
+ object-fit: cover;
82
+ width: 100%;
83
+ height: 100%;
84
+ border-radius: 0px;
85
+ }
86
+ }
87
+
88
+ &__info {
89
+ flex-grow: 1;
90
+ display: flex;
91
+ align-items: flex-start;
92
+ flex-direction: column;
93
+ padding: calc(var(--base) * 0.25) calc(var(--base) * 0.6);
94
+ justify-content: space-between;
95
+ font-weight: 400;
96
+
97
+ strong {
98
+ font-weight: 500;
99
+ }
100
+ }
101
+
102
+ &__pill {
103
+ border-radius: $style-radius-s;
104
+ margin-left: calc(var(--base) * 0.6);
105
+ padding: 0 calc(var(--base) * 0.1);
106
+
107
+ background-color: var(--theme-elevation-150);
108
+ color: var(--theme-elevation-750);
109
+ }
110
+
111
+ &[data-match-type='create'] .upload-diff__pill {
112
+ background-color: var(--diff-create-parent-bg);
113
+ color: var(--diff-create-pill-color);
114
+ }
115
+
116
+ &[data-match-type='delete'] .upload-diff__pill {
117
+ background-color: var(--diff-delete-parent-bg);
118
+ color: var(--diff-delete-pill-color);
119
+ }
120
+ }
121
+ }
@@ -0,0 +1,24 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .render-field-diffs {
5
+ display: flex;
6
+ flex-direction: column;
7
+ gap: var(--base);
8
+
9
+ [role='banner'] {
10
+ display: none !important;
11
+ }
12
+
13
+ &__field {
14
+ overflow-wrap: anywhere;
15
+ display: flex;
16
+ flex-direction: column;
17
+ gap: var(--base);
18
+ }
19
+
20
+ @include small-break {
21
+ gap: calc(var(--base) / 2);
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,84 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .restore-version {
5
+ cursor: pointer;
6
+ display: flex;
7
+ min-width: max-content;
8
+
9
+ .popup-button {
10
+ display: flex;
11
+ }
12
+
13
+ &__chevron {
14
+ background-color: var(--theme-elevation-150);
15
+ border-top-left-radius: 0;
16
+ border-bottom-left-radius: 0;
17
+ cursor: pointer;
18
+
19
+ .stroke {
20
+ stroke-width: 1px;
21
+ }
22
+
23
+ &:hover {
24
+ background: var(--theme-elevation-100);
25
+ }
26
+ }
27
+
28
+ .btn {
29
+ margin-block: 0;
30
+ }
31
+
32
+ &__restore-as-draft-button {
33
+ border-top-right-radius: 0px;
34
+ border-bottom-right-radius: 0px;
35
+ margin-right: 2px;
36
+
37
+ &:focus {
38
+ border-radius: 0;
39
+ outline-offset: 0;
40
+ }
41
+ }
42
+
43
+ &__modal {
44
+ @include blur-bg;
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ height: 100%;
49
+
50
+ &__toggle {
51
+ @extend %btn-reset;
52
+ }
53
+ }
54
+
55
+ &__wrapper {
56
+ z-index: 1;
57
+ position: relative;
58
+ display: flex;
59
+ flex-direction: column;
60
+ gap: base(0.8);
61
+ padding: base(2);
62
+ max-width: base(36);
63
+ }
64
+
65
+ &__content {
66
+ display: flex;
67
+ flex-direction: column;
68
+ gap: base(0.4);
69
+
70
+ > * {
71
+ margin: 0;
72
+ }
73
+ }
74
+
75
+ &__controls {
76
+ display: flex;
77
+ gap: base(0.4);
78
+
79
+ .btn {
80
+ margin: 0;
81
+ }
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,18 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .version-drawer {
5
+ .table {
6
+ width: 100%;
7
+ }
8
+
9
+ .created-at-cell {
10
+ // Button reset, + underline
11
+ background: none;
12
+ border: none;
13
+ cursor: pointer;
14
+ padding: 0;
15
+ text-decoration: underline;
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .compare-version {
5
+ &-moreVersions {
6
+ color: var(--theme-elevation-500);
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,26 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .version-pill-label {
5
+ display: flex;
6
+ align-items: center;
7
+ gap: calc(var(--base) / 2);
8
+
9
+ &-text {
10
+ font-weight: 500;
11
+ }
12
+
13
+ &-date {
14
+ color: var(--theme-elevation-500);
15
+ }
16
+ }
17
+
18
+ @include small-break {
19
+ .version-pill-label {
20
+ // Column
21
+ flex-direction: column;
22
+ align-items: flex-start;
23
+ gap: 0;
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,9 @@
1
+ @layer payload-default {
2
+ .autosave-cell {
3
+ &__items {
4
+ display: flex;
5
+ align-items: center;
6
+ gap: calc(var(--base) * 0.5);
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,110 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .versions {
5
+ width: 100%;
6
+ margin-bottom: calc(var(--base) * 2);
7
+
8
+ &__wrap {
9
+ padding-top: 0;
10
+ padding-bottom: var(--spacing-view-bottom);
11
+ margin-top: calc(var(--base) * 0.75);
12
+ }
13
+
14
+ &__header {
15
+ margin-bottom: var(--base);
16
+ }
17
+
18
+ &__no-versions {
19
+ margin-top: calc(var(--base) * 1.5);
20
+ }
21
+
22
+ &__parent-doc {
23
+ .banner__content {
24
+ display: flex;
25
+ }
26
+ }
27
+
28
+ &__parent-doc-pills {
29
+ [dir='ltr'] & {
30
+ margin-left: auto;
31
+ }
32
+
33
+ [dir='rtl'] & {
34
+ margin-right: auto;
35
+ }
36
+ }
37
+
38
+ .table {
39
+ table {
40
+ width: 100%;
41
+ overflow: auto;
42
+ }
43
+ }
44
+
45
+ &__page-controls {
46
+ width: 100%;
47
+ display: flex;
48
+ align-items: center;
49
+ }
50
+
51
+ .paginator {
52
+ margin-bottom: 0;
53
+ }
54
+
55
+ &__page-info {
56
+ [dir='ltr'] & {
57
+ margin-right: var(--base);
58
+ margin-left: auto;
59
+ }
60
+
61
+ [dir='rtl'] & {
62
+ margin-left: var(--base);
63
+ margin-right: auto;
64
+ }
65
+ }
66
+
67
+ @include mid-break {
68
+ &__wrap {
69
+ padding-top: 0;
70
+ margin-top: 0;
71
+ }
72
+
73
+ // on mobile, extend the table all the way to the viewport edges
74
+ // this is to visually indicate overflowing content
75
+ .table {
76
+ display: flex;
77
+ width: calc(100% + calc(var(--gutter-h) * 2));
78
+ max-width: unset;
79
+ left: calc(var(--gutter-h) * -1);
80
+ position: relative;
81
+ padding-left: var(--gutter-h);
82
+
83
+ &::after {
84
+ content: '';
85
+ height: 1px;
86
+ padding-right: var(--gutter-h);
87
+ }
88
+ }
89
+
90
+ &__page-controls {
91
+ flex-wrap: wrap;
92
+ }
93
+
94
+ &__page-info {
95
+ [dir='ltr'] & {
96
+ margin-left: 0;
97
+ }
98
+
99
+ [dir='rtl'] & {
100
+ margin-right: 0;
101
+ }
102
+ }
103
+
104
+ .paginator {
105
+ width: 100%;
106
+ margin-bottom: var(--base);
107
+ }
108
+ }
109
+ }
110
+ }
@@ -1,5 +1,11 @@
1
- export function withPayload(nextConfig?: import("next").NextConfig, options?: {
1
+ import type { NextConfig } from 'next';
2
+ /**
3
+ * @param {import('next').NextConfig} nextConfig
4
+ * @param {Object} [options] - Optional configuration options
5
+ * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false
6
+ * */
7
+ export declare const withPayload: (nextConfig?: NextConfig, options?: {
2
8
  devBundleServerPackages?: boolean;
3
- }): import("next").NextConfig;
9
+ }) => NextConfig;
4
10
  export default withPayload;
5
11
  //# sourceMappingURL=withPayload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../src/withPayload.js"],"names":[],"mappings":"AAOO,yCANI,OAAO,MAAM,EAAE,UAAU,YAEjC;IAA0B,uBAAuB,GAAzC,OAAO;CAA6F,GAElG,OAAO,MAAM,EAAE,UAAU,CA0PrC"}
1
+ {"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../src/withPayload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAatC;;;;KAIK;AACL,eAAO,MAAM,WAAW,gBACV,UAAU,YACb;IAAE,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAAE,KAC7C,UA8MF,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -1,57 +1,25 @@
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 = {}) => {
11
+ * */
12
+ export const withPayload = (nextConfig = {}, options = {}) => {
13
+ const nextjsVersion = getNextjsVersion();
14
+ const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion);
8
15
  const env = nextConfig.env || {};
9
16
  if (nextConfig.experimental?.staleTimes?.dynamic) {
10
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.');
11
18
  env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
12
19
  }
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
- };
46
- /**
47
- * @type {import('next').NextConfig}
48
- */
49
- const toReturn = {
20
+ const baseConfig = {
50
21
  ...nextConfig,
51
22
  env,
52
- turbopack: {
53
- ...(nextConfig.turbopack || {})
54
- },
55
23
  outputFileTracingExcludes: {
56
24
  ...(nextConfig.outputFileTracingExcludes || {}),
57
25
  '**/*': [...(nextConfig.outputFileTracingExcludes?.['**/*'] || []), 'drizzle-kit', 'drizzle-kit/api']
@@ -60,6 +28,9 @@
60
28
  ...(nextConfig.outputFileTracingIncludes || {}),
61
29
  '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client']
62
30
  },
31
+ turbopack: {
32
+ ...(nextConfig.turbopack || {})
33
+ },
63
34
  // We disable the poweredByHeader here because we add it manually in the headers function below
64
35
  ...(nextConfig.poweredByHeader !== false ? {
65
36
  poweredByHeader: false
@@ -67,7 +38,6 @@
67
38
  headers: async () => {
68
39
  const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : [];
69
40
  return [...(headersFromConfig || []), {
70
- source: '/:path*',
71
41
  headers: [{
72
42
  key: 'Accept-CH',
73
43
  value: 'Sec-CH-Prefers-Color-Scheme'
@@ -77,20 +47,14 @@
77
47
  }, {
78
48
  key: 'Critical-CH',
79
49
  value: 'Sec-CH-Prefers-Color-Scheme'
80
- }, ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : [])]
50
+ }, ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : [])],
51
+ source: '/:path*'
81
52
  }];
82
53
  },
83
54
  serverExternalPackages: [
84
- // serverExternalPackages = webpack.externals, but with turbopack support and an additional check
85
- // for whether the package is resolvable from the project root
86
- ...(nextConfig.serverExternalPackages || []),
87
- // 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.
88
- //
89
55
  // WHY: without externalizing graphql, a graphql version error will be thrown
90
56
  // during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
91
- 'graphql',
92
- // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.
93
- '@sentry/nextjs', ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true ?
57
+ 'graphql', ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true ?
94
58
  /**
95
59
  * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we
96
60
  * do not bundle server-only packages during dev for two reasons:
@@ -136,6 +100,11 @@
136
100
  * entry point packages, as explained in the serverExternalPackages section above.
137
101
  */
138
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
+ })],
139
108
  resolve: {
140
109
  ...(incomingWebpackConfig?.resolve || {}),
141
110
  alias: {
@@ -164,19 +133,23 @@
164
133
  **/
165
134
  aws4: false
166
135
  }
167
- },
168
- plugins: [...(incomingWebpackConfig?.plugins || []),
169
- // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
170
- new webpackOptions.webpack.IgnorePlugin({
171
- resourceRegExp: /^pg-native$|^cloudflare:sockets$/
172
- })]
136
+ }
173
137
  };
174
138
  }
175
139
  };
176
140
  if (nextConfig.basePath) {
177
- toReturn.env.NEXT_BASE_PATH = 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
+ };
178
152
  }
179
- return toReturn;
180
153
  };
181
154
  export default withPayload;
182
155
  //# sourceMappingURL=withPayload.js.map