@payloadcms/next 3.63.0-canary.5 → 3.63.0-internal.0bf4b7f

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.
@@ -28,17 +28,6 @@ const withPayload = (nextConfig = {}, options = {})=>{
28
28
  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.');
29
29
  env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
30
30
  }
31
- if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {
32
- 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';
33
- const consoleWarn = console.warn;
34
- console.warn = (...args)=>{
35
- // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
36
- if (typeof args[1] === 'string' && args[1].includes(turbopackWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackWarningText)) {
37
- return;
38
- }
39
- consoleWarn(...args);
40
- };
41
- }
42
31
  const poweredByHeader = {
43
32
  key: 'X-Powered-By',
44
33
  value: 'Next.js, Payload'
@@ -98,24 +87,31 @@ const withPayload = (nextConfig = {}, options = {})=>{
98
87
  },
99
88
  serverExternalPackages: [
100
89
  ...nextConfig.serverExternalPackages || [],
101
- 'drizzle-kit',
102
- 'drizzle-kit/api',
103
- 'pino',
104
- 'libsql',
105
- 'pino-pretty',
106
- 'graphql',
107
- // Do not bundle server-only packages during dev to improve compile speed
90
+ // These packages always need to be external, both during dev and production. This is because they install dependencies
91
+ // that will error when trying to bundle them (e.g. drizzle-kit, libsql, esbuild etc.).
92
+ // We cannot externalize those problem-packages directly. We can only externalize packages that are manually installed
93
+ // by the end user. Otherwise, the require('externalPackage') calls generated by the bundler would fail during runtime,
94
+ // as you cannot import dependencies of dependencies in a lot of package managers like pnpm. We'd have to force users
95
+ // to install the dependencies directly.
96
+ // Thus, we externalize the "entry-point" = the package that is installed by the end user, which would be our db adapters.
97
+ //
98
+ //
99
+ // External because it installs mongoose (part of default serverExternalPackages: https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json => would throw warning if we don't exclude the entry-point package):
100
+ '@payloadcms/db-mongodb',
101
+ // External because they install dependencies like drizzle, libsql, esbuild etc.:
102
+ '@payloadcms/db-postgres',
103
+ '@payloadcms/db-sqlite',
104
+ '@payloadcms/db-vercel-postgres',
105
+ '@payloadcms/drizzle',
106
+ // External because they install @aws-sdk/client-s3:
107
+ '@payloadcms/payload-cloud',
108
+ // TODO: We need to externalize @payloadcms/storage-s3 as well, once Next.js has the ability to exclude @payloadcms/storage-s3/client from being externalized.
109
+ // Do not bundle additional server-only packages during dev to improve compilation speed
108
110
  ...process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false ? [
109
111
  'payload',
110
- '@payloadcms/db-mongodb',
111
- '@payloadcms/db-postgres',
112
- '@payloadcms/db-sqlite',
113
- '@payloadcms/db-vercel-postgres',
114
- '@payloadcms/drizzle',
115
112
  '@payloadcms/email-nodemailer',
116
113
  '@payloadcms/email-resend',
117
114
  '@payloadcms/graphql',
118
- '@payloadcms/payload-cloud',
119
115
  '@payloadcms/plugin-redirects'
120
116
  ] : []
121
117
  ],
@@ -125,51 +121,15 @@ const withPayload = (nextConfig = {}, options = {})=>{
125
121
  ...incomingWebpackConfig,
126
122
  externals: [
127
123
  ...incomingWebpackConfig?.externals || [],
128
- 'drizzle-kit',
129
- 'drizzle-kit/api',
130
- 'sharp',
131
- 'libsql',
132
124
  'require-in-the-middle'
133
125
  ],
134
- ignoreWarnings: [
135
- ...incomingWebpackConfig?.ignoreWarnings || [],
136
- {
137
- module: /node_modules\/mongodb\/lib\/utils\.js/
138
- },
139
- {
140
- file: /node_modules\/mongodb\/lib\/utils\.js/
141
- },
142
- {
143
- module: /node_modules\/mongodb\/lib\/bson\.js/
144
- },
145
- {
146
- file: /node_modules\/mongodb\/lib\/bson\.js/
147
- }
148
- ],
149
126
  plugins: [
150
127
  ...incomingWebpackConfig?.plugins || [],
151
128
  // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
152
129
  new webpackOptions.webpack.IgnorePlugin({
153
130
  resourceRegExp: /^pg-native$|^cloudflare:sockets$/
154
131
  })
155
- ],
156
- resolve: {
157
- ...incomingWebpackConfig?.resolve || {},
158
- alias: {
159
- ...incomingWebpackConfig?.resolve?.alias || {}
160
- },
161
- fallback: {
162
- ...incomingWebpackConfig?.resolve?.fallback || {},
163
- '@aws-sdk/credential-providers': false,
164
- '@mongodb-js/zstd': false,
165
- aws4: false,
166
- kerberos: false,
167
- 'mongodb-client-encryption': false,
168
- snappy: false,
169
- 'supports-color': false,
170
- 'yocto-queue': false
171
- }
172
- }
132
+ ]
173
133
  };
174
134
  }
175
135
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/withPayload.js"],"names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","process","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","consoleWarn","args","includes","poweredByHeader","key","value","toReturn","turbopack","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","ignoreWarnings","module","file","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","kerberos","snappy","basePath","NEXT_BASE_PATH"],"mappings":"AAAA;;;;;;GAMG;;;;;;;;;;;QA+KH;eAAA;;QA9KaA;eAAAA;;;AAAN,MAAMA,cAAc,CAACC,aAAa,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC;IACvD,MAAMC,MAAMF,WAAWE,GAAG,IAAI,CAAC;IAE/B,IAAIF,WAAWG,YAAY,EAAEC,YAAYC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AAQ;wBACR,kBAAkB;wBAClB,eAAe;oBACjB;gBACF;YACF;QACF;IACF;IAEA,IAAI5C,WAAW6C,QAAQ,EAAE;QACvB3B,SAAShB,GAAG,CAAC4C,cAAc,GAAG9C,WAAW6C,QAAQ;IACnD;IAEA,OAAO3B;AACT;MAEA,WAAenB","file":"withPayload.cjs","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 true\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 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 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 consoleWarn(...args)\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 ...(nextConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'pino',\n 'libsql',\n 'pino-pretty',\n 'graphql',\n // Do not bundle server-only packages during dev to improve compile speed\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\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 //'@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 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n ignoreWarnings: [\n ...(incomingWebpackConfig?.ignoreWarnings || []),\n { module: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { module: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\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 '@aws-sdk/credential-providers': false,\n '@mongodb-js/zstd': false,\n aws4: false,\n kerberos: false,\n 'mongodb-client-encryption': false,\n snappy: false,\n 'supports-color': false,\n 'yocto-queue': false,\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"]}
1
+ {"version":3,"sources":["../../src/withPayload.js"],"names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","poweredByHeader","key","value","toReturn","turbopack","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlug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D;QACH;QACAU,wBAAwB;eAClBnB,WAAWmB,sBAAsB,IAAI,EAAE;YAC3C,uHAAuH;YACvH,uFAAuF;YACvF,sHAAsH;YACtH,uHAAuH;YACvH,qHAAqH;YACrH,wCAAwC;YACxC,0HAA0H;YAC1H,EAAE;YACF,EAAE;YACF,wPAAwP;YACxP;YACA,iFAAiF;YACjF;YACA;YACA;YACA;YACA,oDAAoD;YACpD;YACA,8JAA8J;YAC9J,wFAAwF;eACpFC,QAAQlB,GAAG,CAACmB,QAAQ,KAAK,iBAAiBpB,QAAQqB,uBAAuB,KAAK,QAC9E;gBACE;gBACA;gBACA;gBACA;gBACA;aAWD,GACD,EAAE;SACP;QACDC,SAAS,CAACC,eAAeC;YACvB,MAAMC,wBACJ,OAAO1B,WAAWuB,OAAO,KAAK,aAC1BvB,WAAWuB,OAAO,CAACC,eAAeC,kBAClCD;YAEN,OAAO;gBACL,GAAGE,qBAAqB;gBACxBC,WAAW;uBAAKD,uBAAuBC,aAAa,EAAE;oBAAG;iBAAwB;gBACjFC,SAAS;uBACHF,uBAAuBE,WAAW,EAAE;oBACxC,oFAAoF;oBACpF,IAAIH,eAAeF,OAAO,CAACM,YAAY,CAAC;wBACtCC,gBAAgB;oBAClB;iBACD;YACH;QACF;IACF;IAEA,IAAI9B,WAAW+B,QAAQ,EAAE;QACvBnB,SAASV,GAAG,CAAC8B,cAAc,GAAGhC,WAAW+B,QAAQ;IACnD;IAEA,OAAOnB;AACT;MAEA,WAAeb","file":"withPayload.cjs","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 true\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 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 ...(nextConfig.serverExternalPackages || []),\n // These packages always need to be external, both during dev and production. This is because they install dependencies\n // that will error when trying to bundle them (e.g. drizzle-kit, libsql, esbuild etc.).\n // We cannot externalize those problem-packages directly. We can only externalize packages that are manually installed\n // by the end user. Otherwise, the require('externalPackage') calls generated by the bundler would fail during runtime,\n // as you cannot import dependencies of dependencies in a lot of package managers like pnpm. We'd have to force users\n // to install the dependencies directly.\n // Thus, we externalize the \"entry-point\" = the package that is installed by the end user, which would be our db adapters.\n //\n //\n // External because it installs mongoose (part of default serverExternalPackages: https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json => would throw warning if we don't exclude the entry-point package):\n '@payloadcms/db-mongodb',\n // External because they install dependencies like drizzle, libsql, esbuild etc.:\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n // External because they install @aws-sdk/client-s3:\n '@payloadcms/payload-cloud',\n // TODO: We need to externalize @payloadcms/storage-s3 as well, once Next.js has the ability to exclude @payloadcms/storage-s3/client from being externalized.\n // Do not bundle additional server-only packages during dev to improve compilation speed\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\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: [...(incomingWebpackConfig?.externals || []), 'require-in-the-middle'],\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"]}
@@ -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,CA8KrC"}
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,CAoIrC"}
@@ -10,17 +10,6 @@
10
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
11
  env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
12
12
  }
13
- if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {
14
- 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';
15
- const consoleWarn = console.warn;
16
- console.warn = (...args) => {
17
- // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
18
- if (typeof args[1] === 'string' && args[1].includes(turbopackWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackWarningText)) {
19
- return;
20
- }
21
- consoleWarn(...args);
22
- };
23
- }
24
13
  const poweredByHeader = {
25
14
  key: 'X-Powered-By',
26
15
  value: 'Next.js, Payload'
@@ -62,45 +51,35 @@
62
51
  }, ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : [])]
63
52
  }];
64
53
  },
65
- serverExternalPackages: [...(nextConfig.serverExternalPackages || []), 'drizzle-kit', 'drizzle-kit/api', 'pino', 'libsql', 'pino-pretty', 'graphql',
66
- // Do not bundle server-only packages during dev to improve compile speed
67
- ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false ? ['payload', '@payloadcms/db-mongodb', '@payloadcms/db-postgres', '@payloadcms/db-sqlite', '@payloadcms/db-vercel-postgres', '@payloadcms/drizzle', '@payloadcms/email-nodemailer', '@payloadcms/email-resend', '@payloadcms/graphql', '@payloadcms/payload-cloud', '@payloadcms/plugin-redirects'] : [])],
54
+ serverExternalPackages: [...(nextConfig.serverExternalPackages || []),
55
+ // These packages always need to be external, both during dev and production. This is because they install dependencies
56
+ // that will error when trying to bundle them (e.g. drizzle-kit, libsql, esbuild etc.).
57
+ // We cannot externalize those problem-packages directly. We can only externalize packages that are manually installed
58
+ // by the end user. Otherwise, the require('externalPackage') calls generated by the bundler would fail during runtime,
59
+ // as you cannot import dependencies of dependencies in a lot of package managers like pnpm. We'd have to force users
60
+ // to install the dependencies directly.
61
+ // Thus, we externalize the "entry-point" = the package that is installed by the end user, which would be our db adapters.
62
+ //
63
+ //
64
+ // External because it installs mongoose (part of default serverExternalPackages: https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json => would throw warning if we don't exclude the entry-point package):
65
+ '@payloadcms/db-mongodb',
66
+ // External because they install dependencies like drizzle, libsql, esbuild etc.:
67
+ '@payloadcms/db-postgres', '@payloadcms/db-sqlite', '@payloadcms/db-vercel-postgres', '@payloadcms/drizzle',
68
+ // External because they install @aws-sdk/client-s3:
69
+ '@payloadcms/payload-cloud',
70
+ // TODO: We need to externalize @payloadcms/storage-s3 as well, once Next.js has the ability to exclude @payloadcms/storage-s3/client from being externalized.
71
+ // Do not bundle additional server-only packages during dev to improve compilation speed
72
+ ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false ? ['payload', '@payloadcms/email-nodemailer', '@payloadcms/email-resend', '@payloadcms/graphql', '@payloadcms/plugin-redirects'] : [])],
68
73
  webpack: (webpackConfig, webpackOptions) => {
69
74
  const incomingWebpackConfig = typeof nextConfig.webpack === 'function' ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
70
75
  return {
71
76
  ...incomingWebpackConfig,
72
- externals: [...(incomingWebpackConfig?.externals || []), 'drizzle-kit', 'drizzle-kit/api', 'sharp', 'libsql', 'require-in-the-middle'],
73
- ignoreWarnings: [...(incomingWebpackConfig?.ignoreWarnings || []), {
74
- module: /node_modules\/mongodb\/lib\/utils\.js/
75
- }, {
76
- file: /node_modules\/mongodb\/lib\/utils\.js/
77
- }, {
78
- module: /node_modules\/mongodb\/lib\/bson\.js/
79
- }, {
80
- file: /node_modules\/mongodb\/lib\/bson\.js/
81
- }],
77
+ externals: [...(incomingWebpackConfig?.externals || []), 'require-in-the-middle'],
82
78
  plugins: [...(incomingWebpackConfig?.plugins || []),
83
79
  // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
84
80
  new webpackOptions.webpack.IgnorePlugin({
85
81
  resourceRegExp: /^pg-native$|^cloudflare:sockets$/
86
- })],
87
- resolve: {
88
- ...(incomingWebpackConfig?.resolve || {}),
89
- alias: {
90
- ...(incomingWebpackConfig?.resolve?.alias || {})
91
- },
92
- fallback: {
93
- ...(incomingWebpackConfig?.resolve?.fallback || {}),
94
- '@aws-sdk/credential-providers': false,
95
- '@mongodb-js/zstd': false,
96
- aws4: false,
97
- kerberos: false,
98
- 'mongodb-client-encryption': false,
99
- snappy: false,
100
- 'supports-color': false,
101
- 'yocto-queue': false
102
- }
103
- }
82
+ })]
104
83
  };
105
84
  }
106
85
  };
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.js","names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","process","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","consoleWarn","args","includes","poweredByHeader","key","value","toReturn","turbopack","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","ignoreWarnings","module","file","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","kerberos","snappy","basePath","NEXT_BASE_PATH"],"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 true\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 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 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 consoleWarn(...args)\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 ...(nextConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'pino',\n 'libsql',\n 'pino-pretty',\n 'graphql',\n // Do not bundle server-only packages during dev to improve compile speed\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\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 //'@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 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n ignoreWarnings: [\n ...(incomingWebpackConfig?.ignoreWarnings || []),\n { module: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/utils\\.js/ },\n { module: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\n { file: /node_modules\\/mongodb\\/lib\\/bson\\.js/ },\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 '@aws-sdk/credential-providers': false,\n '@mongodb-js/zstd': false,\n aws4: false,\n kerberos: false,\n 'mongodb-client-encryption': false,\n snappy: false,\n 'supports-color': false,\n 'yocto-queue': false,\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"],"mappings":"AAAA;;;;;;KAOA,OAAO,MAAMA,WAAA,GAAcA,CAACC,UAAA,GAAa,CAAC,CAAC,EAAEC,OAAA,GAAU,CAAC,CAAC;EACvD,MAAMC,GAAA,GAAMF,UAAA,CAAWE,GAAG,IAAI,CAAC;EAE/B,IAAIF,UAAA,CAAWG,YAAY,EAAEC,UAAA,EAAYC,OAAA,EAAS;IAChDC,OAAA,CAAQC,IAAI,CACV;IAEFL,GAAA,CAAIM,uCAAuC,GAAG;EAChD;EAEA,IAAIC,OAAA,C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AC;UACxCC,KAAA,EAAO;YACL,IAAIT,qBAAA,EAAuBQ,OAAA,EAASC,KAAA,IAAS,CAAC,CAAC;UACjD;UACAC,QAAA,EAAU;YACR,IAAIV,qBAAA,EAAuBQ,OAAA,EAASE,QAAA,IAAY,CAAC,CAAC;YAClD,iCAAiC;YACjC,oBAAoB;YACpBC,IAAA,EAAM;YACNC,QAAA,EAAU;YACV,6BAA6B;YAC7BC,MAAA,EAAQ;YACR,kBAAkB;YAClB,eAAe;UACjB;QACF;MACF;IACF;EACF;EAEA,IAAI5C,UAAA,CAAW6C,QAAQ,EAAE;IACvB3B,QAAA,CAAShB,GAAG,CAAC4C,cAAc,GAAG9C,UAAA,CAAW6C,QAAQ;EACnD;EAEA,OAAO3B,QAAA;AACT;AAEA,eAAenB,WAAA","ignoreList":[]}
1
+ {"version":3,"file":"withPayload.js","names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","poweredByHeader","key","value","toReturn","turbopack","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","basePath","NEXT_BASE_PATH"],"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 true\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 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 ...(nextConfig.serverExternalPackages || []),\n // These packages always need to be external, both during dev and production. This is because they install dependencies\n // that will error when trying to bundle them (e.g. drizzle-kit, libsql, esbuild etc.).\n // We cannot externalize those problem-packages directly. We can only externalize packages that are manually installed\n // by the end user. Otherwise, the require('externalPackage') calls generated by the bundler would fail during runtime,\n // as you cannot import dependencies of dependencies in a lot of package managers like pnpm. We'd have to force users\n // to install the dependencies directly.\n // Thus, we externalize the \"entry-point\" = the package that is installed by the end user, which would be our db adapters.\n //\n //\n // External because it installs mongoose (part of default serverExternalPackages: https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json => would throw warning if we don't exclude the entry-point package):\n '@payloadcms/db-mongodb',\n // External because they install dependencies like drizzle, libsql, esbuild etc.:\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/drizzle',\n // External because they install @aws-sdk/client-s3:\n '@payloadcms/payload-cloud',\n // TODO: We need to externalize @payloadcms/storage-s3 as well, once Next.js has the ability to exclude @payloadcms/storage-s3/client from being externalized.\n // Do not bundle additional server-only packages during dev to improve compilation speed\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages === false\n ? [\n 'payload',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\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: [...(incomingWebpackConfig?.externals || []), 'require-in-the-middle'],\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"],"mappings":"AAAA;;;;;;KAOA,OAAO,MAAMA,WAAA,GAAcA,CAACC,UAAA,GAAa,CAA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CAACA,eAAA,CAAgB,GAAG,EAAE;MAErE,EACD;IACH;IACAU,sBAAA,EAAwB,C,IAClBnB,UAAA,CAAWmB,sBAAsB,IAAI,EAAE;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,2BACA,yBACA,kCACA;IACA;IACA;IACA;IACA;QACIC,OAAA,CAAQlB,GAAG,CAACmB,QAAQ,KAAK,iBAAiBpB,OAAA,CAAQqB,uBAAuB,KAAK,QAC9E,CACE,WACA,gCACA,4BACA,uBACA,+BAWD,GACD,EAAE,EACP;IACDC,OAAA,EAASA,CAACC,aAAA,EAAeC,cAAA;MACvB,MAAMC,qBAAA,GACJ,OAAO1B,UAAA,CAAWuB,OAAO,KAAK,aAC1BvB,UAAA,CAAWuB,OAAO,CAACC,aAAA,EAAeC,cAAA,IAClCD,aAAA;MAEN,OAAO;QACL,GAAGE,qBAAqB;QACxBC,SAAA,EAAW,C,IAAKD,qBAAA,EAAuBC,SAAA,IAAa,EAAE,GAAG,wBAAwB;QACjFC,OAAA,EAAS,C,IACHF,qBAAA,EAAuBE,OAAA,IAAW,EAAE;QACxC;QACA,IAAIH,cAAA,CAAeF,OAAO,CAACM,YAAY,CAAC;UACtCC,cAAA,EAAgB;QAClB;MAEJ;IACF;EACF;EAEA,IAAI9B,UAAA,CAAW+B,QAAQ,EAAE;IACvBnB,QAAA,CAASV,GAAG,CAAC8B,cAAc,GAAGhC,UAAA,CAAW+B,QAAQ;EACnD;EAEA,OAAOnB,QAAA;AACT;AAEA,eAAeb,WAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/next",
3
- "version": "3.63.0-canary.5",
3
+ "version": "3.63.0-internal.0bf4b7f",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -97,9 +97,9 @@
97
97
  "qs-esm": "7.0.2",
98
98
  "sass": "1.77.4",
99
99
  "uuid": "10.0.0",
100
- "@payloadcms/translations": "3.63.0-canary.5",
101
- "@payloadcms/ui": "3.63.0-canary.5",
102
- "@payloadcms/graphql": "3.63.0-canary.5"
100
+ "@payloadcms/ui": "3.63.0-internal.0bf4b7f",
101
+ "@payloadcms/graphql": "3.63.0-internal.0bf4b7f",
102
+ "@payloadcms/translations": "3.63.0-internal.0bf4b7f"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@babel/cli": "7.27.2",
@@ -117,12 +117,12 @@
117
117
  "esbuild-sass-plugin": "3.3.1",
118
118
  "swc-plugin-transform-remove-imports": "4.0.4",
119
119
  "@payloadcms/eslint-config": "3.28.0",
120
- "payload": "3.63.0-canary.5"
120
+ "payload": "3.63.0-internal.0bf4b7f"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "graphql": "^16.8.1",
124
124
  "next": "^15.2.3",
125
- "payload": "3.63.0-canary.5"
125
+ "payload": "3.63.0-internal.0bf4b7f"
126
126
  },
127
127
  "engines": {
128
128
  "node": "^18.20.2 || >=20.9.0"