@payloadcms/next 4.0.0-internal.5d5a2b2 → 4.0.0-internal.63f8536

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.
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/routes/graphql/handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,SAAS,CAAA;AAqEjF,eAAO,MAAM,UAAU,GAAU,QAAQ,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,iBAyBlF,CAAA;AAED,eAAO,MAAM,IAAI,GACd,QAAQ,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,MAAY,SAAS,OAAO,sBAuD9E,CAAA"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/routes/graphql/handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,SAAS,CAAA;AAqEjF,eAAO,MAAM,UAAU,GAAU,QAAQ,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,iBAyBlF,CAAA;AAED,eAAO,MAAM,IAAI,GACd,QAAQ,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,MAAY,SAAS,OAAO,sBA6D9E,CAAA"}
@@ -82,15 +82,20 @@ export const POST = config => async request => {
82
82
  config,
83
83
  request
84
84
  });
85
+ const {
86
+ payload
87
+ } = req;
88
+ if (payload.config.graphQL?.disable) {
89
+ return new Response(null, {
90
+ status: 404
91
+ });
92
+ }
85
93
  await addDataAndFileToRequest(req);
86
94
  addLocalesToRequestFromData(req);
87
95
  const {
88
96
  schema,
89
97
  validationRules
90
98
  } = await getGraphql(config);
91
- const {
92
- payload
93
- } = req;
94
99
  const headers = {};
95
100
  const apiResponse = await createHandler({
96
101
  context: {
@@ -1 +1 @@
1
- {"version":3,"file":"handler.js","names":["configToSchema","createHandler","status","httpStatus","addDataAndFileToRequest","addLocalesToRequestFromData","createPayloadRequest","headersWithCors","logError","mergeHeaders","handleError","err","payload","req","originalError","INTERNAL_SERVER_ERROR","errorMessage","message","config","debug","response","extensions","name","undefined","data","stack","statusCode","locations","path","hooks","afterError","reduce","promise","hook","result","context","error","graphqlResult","Promise","resolve","cached","global","_payload_graphql","graphql","getGraphql","process","env","NODE_ENV","resolvedConfig","schema","e","POST","request","originalRequest","clone","canSetHeaders","validationRules","headers","apiResponse","onOperation","args","errors","all","map","_","defaultRules","concat","resHeaders","Headers","key","append","Response","body","responseHeaders"],"sources":["../../../src/routes/graphql/handler.ts"],"sourcesContent":["import type { GraphQLError, GraphQLFormattedError } from 'graphql'\nimport type { APIError, Payload, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport { configToSchema } from '@payloadcms/graphql'\nimport { createHandler } from 'graphql-http/lib/use/fetch'\nimport { status as httpStatus } from 'http-status'\nimport {\n addDataAndFileToRequest,\n addLocalesToRequestFromData,\n createPayloadRequest,\n headersWithCors,\n logError,\n mergeHeaders,\n} from 'payload'\n\nconst handleError = async ({\n err,\n payload,\n req,\n}: {\n err: GraphQLError\n payload: Payload\n req: PayloadRequest\n}): Promise<GraphQLFormattedError> => {\n const status = (err.originalError as APIError).status || httpStatus.INTERNAL_SERVER_ERROR\n let errorMessage = err.message\n logError({ err, payload })\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!payload.config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n errorMessage = 'Something went wrong.'\n }\n\n let response: GraphQLFormattedError = {\n extensions: {\n name: err?.originalError?.name || undefined,\n data: (err && err.originalError && (err.originalError as APIError).data) || undefined,\n stack: payload.config.debug ? err.stack : undefined,\n statusCode: status,\n },\n locations: err.locations,\n message: errorMessage,\n path: err.path,\n }\n\n await payload.config.hooks.afterError?.reduce(async (promise, hook) => {\n await promise\n\n const result = await hook({\n context: req.context,\n error: err,\n graphqlResult: response,\n req,\n })\n\n if (result) {\n response = result.graphqlResult || response\n }\n }, Promise.resolve())\n\n return response\n}\n\nlet cached = global._payload_graphql\n\nif (!cached) {\n cached = global._payload_graphql = { graphql: null, promise: null }\n}\n\nexport const getGraphql = async (config: Promise<SanitizedConfig> | SanitizedConfig) => {\n if (process.env.NODE_ENV === 'development') {\n cached = global._payload_graphql = { graphql: null, promise: null }\n }\n\n if (cached.graphql) {\n return cached.graphql\n }\n\n if (!cached.promise) {\n const resolvedConfig = await config\n cached.promise = new Promise((resolve) => {\n const schema = configToSchema(resolvedConfig)\n resolve(cached.graphql || schema)\n })\n }\n\n try {\n cached.graphql = await cached.promise\n } catch (e) {\n cached.promise = null\n throw e\n }\n\n return cached.graphql\n}\n\nexport const POST =\n (config: Promise<SanitizedConfig> | SanitizedConfig) => async (request: Request) => {\n const originalRequest = request.clone()\n const req = await createPayloadRequest({\n canSetHeaders: true,\n config,\n request,\n })\n\n await addDataAndFileToRequest(req)\n addLocalesToRequestFromData(req)\n\n const { schema, validationRules } = await getGraphql(config)\n\n const { payload } = req\n\n const headers = {}\n const apiResponse = await createHandler({\n context: { headers, req },\n onOperation: async (request, args, result) => {\n const response =\n typeof payload.extensions === 'function'\n ? await payload.extensions({\n args,\n req: request,\n result,\n })\n : result\n if (response.errors) {\n const errors = (await Promise.all(\n result.errors.map((error) => {\n return handleError({ err: error, payload, req })\n }),\n )) as GraphQLError[]\n // errors type should be FormattedGraphQLError[] but onOperation has a return type of ExecutionResult instead of FormattedExecutionResult\n return { ...response, errors }\n }\n return response\n },\n schema,\n validationRules: (_, args, defaultRules) => defaultRules.concat(validationRules(args)),\n })(originalRequest)\n\n const resHeaders = headersWithCors({\n headers: new Headers(apiResponse.headers),\n req,\n })\n\n for (const key in headers) {\n resHeaders.append(key, headers[key])\n }\n\n return new Response(apiResponse.body, {\n headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, resHeaders) : resHeaders,\n status: apiResponse.status,\n })\n }\n"],"mappings":"AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,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AAA,EAAS;IACzBU,UAAA,CAAWG,MAAM,CAACD,GAAA,EAAKZ,OAAO,CAACY,GAAA,CAAI;EACrC;EAEA,OAAO,IAAIE,QAAA,CAASb,WAAA,CAAYc,IAAI,EAAE;IACpCf,OAAA,EAAS5C,GAAA,CAAI4D,eAAe,GAAGhE,YAAA,CAAaI,GAAA,CAAI4D,eAAe,EAAEN,UAAA,IAAcA,UAAA;IAC/EjE,MAAA,EAAQwD,WAAA,CAAYxD;EACtB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"handler.js","names":["configToSchema","createHandler","status","httpStatus","addDataAndFileToRequest","addLocalesToRequestFromData","createPayloadRequest","headersWithCors","logError","mergeHeaders","handleError","err","payload","req","originalError","INTERNAL_SERVER_ERROR","errorMessage","message","config","debug","response","extensions","name","undefined","data","stack","statusCode","locations","path","hooks","afterError","reduce","promise","hook","result","context","error","graphqlResult","Promise","resolve","cached","global","_payload_graphql","graphql","getGraphql","process","env","NODE_ENV","resolvedConfig","schema","e","POST","request","originalRequest","clone","canSetHeaders","graphQL","disable","Response","validationRules","headers","apiResponse","onOperation","args","errors","all","map","_","defaultRules","concat","resHeaders","Headers","key","append","body","responseHeaders"],"sources":["../../../src/routes/graphql/handler.ts"],"sourcesContent":["import type { GraphQLError, GraphQLFormattedError } from 'graphql'\nimport type { APIError, Payload, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport { configToSchema } from '@payloadcms/graphql'\nimport { createHandler } from 'graphql-http/lib/use/fetch'\nimport { status as httpStatus } from 'http-status'\nimport {\n addDataAndFileToRequest,\n addLocalesToRequestFromData,\n createPayloadRequest,\n headersWithCors,\n logError,\n mergeHeaders,\n} from 'payload'\n\nconst handleError = async ({\n err,\n payload,\n req,\n}: {\n err: GraphQLError\n payload: Payload\n req: PayloadRequest\n}): Promise<GraphQLFormattedError> => {\n const status = (err.originalError as APIError).status || httpStatus.INTERNAL_SERVER_ERROR\n let errorMessage = err.message\n logError({ err, payload })\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!payload.config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n errorMessage = 'Something went wrong.'\n }\n\n let response: GraphQLFormattedError = {\n extensions: {\n name: err?.originalError?.name || undefined,\n data: (err && err.originalError && (err.originalError as APIError).data) || undefined,\n stack: payload.config.debug ? err.stack : undefined,\n statusCode: status,\n },\n locations: err.locations,\n message: errorMessage,\n path: err.path,\n }\n\n await payload.config.hooks.afterError?.reduce(async (promise, hook) => {\n await promise\n\n const result = await hook({\n context: req.context,\n error: err,\n graphqlResult: response,\n req,\n })\n\n if (result) {\n response = result.graphqlResult || response\n }\n }, Promise.resolve())\n\n return response\n}\n\nlet cached = global._payload_graphql\n\nif (!cached) {\n cached = global._payload_graphql = { graphql: null, promise: null }\n}\n\nexport const getGraphql = async (config: Promise<SanitizedConfig> | SanitizedConfig) => {\n if (process.env.NODE_ENV === 'development') {\n cached = global._payload_graphql = { graphql: null, promise: null }\n }\n\n if (cached.graphql) {\n return cached.graphql\n }\n\n if (!cached.promise) {\n const resolvedConfig = await config\n cached.promise = new Promise((resolve) => {\n const schema = configToSchema(resolvedConfig)\n resolve(cached.graphql || schema)\n })\n }\n\n try {\n cached.graphql = await cached.promise\n } catch (e) {\n cached.promise = null\n throw e\n }\n\n return cached.graphql\n}\n\nexport const POST =\n (config: Promise<SanitizedConfig> | SanitizedConfig) => async (request: Request) => {\n const originalRequest = request.clone()\n const req = await createPayloadRequest({\n canSetHeaders: true,\n config,\n request,\n })\n\n const { payload } = req\n\n if (payload.config.graphQL?.disable) {\n return new Response(null, {\n status: 404,\n })\n }\n\n await addDataAndFileToRequest(req)\n addLocalesToRequestFromData(req)\n\n const { schema, validationRules } = await getGraphql(config)\n\n const headers = {}\n const apiResponse = await createHandler({\n context: { headers, req },\n onOperation: async (request, args, result) => {\n const response =\n typeof payload.extensions === 'function'\n ? await payload.extensions({\n args,\n req: request,\n result,\n })\n : result\n if (response.errors) {\n const errors = (await Promise.all(\n result.errors.map((error) => {\n return handleError({ err: error, payload, req })\n }),\n )) as GraphQLError[]\n // errors type should be FormattedGraphQLError[] but onOperation has a return type of ExecutionResult instead of FormattedExecutionResult\n return { ...response, errors }\n }\n return response\n },\n schema,\n validationRules: (_, args, defaultRules) => defaultRules.concat(validationRules(args)),\n })(originalRequest)\n\n const resHeaders = headersWithCors({\n headers: new Headers(apiResponse.headers),\n req,\n })\n\n for (const key in headers) {\n resHeaders.append(key, headers[key])\n }\n\n return new Response(apiResponse.body, {\n headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, resHeaders) : resHeaders,\n status: apiResponse.status,\n })\n }\n"],"mappings":"AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,SAASC,MAAA,IAAUC,UAAU,QAAQ;AACrC,SACEC,uBAAuB,EACvBC,2BAA2B,EAC3BC,oBAAoB,EACpBC,eAAe,EACfC,QAAQ,EACRC,YAAY,QACP;AAEP,MAAMC,WAAA,GAAc,MAAAA,CAAO;EACzBC,GAAG;EACHC,OAAO;EACPC;AAAG,CAKJ;EACC,MAAMX,MAAA,GAASS,GAAC,CAAIG,aAAa,CAAcZ,MAAM,IAAIC,UAAA,CAAWY,qBAAqB;EACzF,IAAIC,YAAA,GAAeL,GAAA,CAAIM,OAAO;EAC9BT,QAAA,CAAS;IAAEG,GAAA;IAAKC;EAAQ;EAExB;EACA;EACA,IAAI,CAACA,OAAA,CAAQM,MAAM,CAACC,KAAK,IAAIjB,MAAA,KAAWC,UAAA,CAAWY,qBAAqB,EAAE;IACxEC,YAAA,GAAe;EACjB;EAEA,IAAII,QAAA,GAAkC;IACpCC,UAAA,EAAY;MACVC,IAAA,EAAMX,GAAA,EAAKG,aAAA,EAAeQ,IAAA,IAAQC,SAAA;MAClCC,IAAA,EAAMb,GAAC,IAAOA,GAAA,CAAIG,aAAa,IAAIH,GAAC,CAAIG,aAAa,CAAcU,IAAI,IAAKD,SAAA;MAC5EE,KA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M,EAAE;QACnB,MAAMA,MAAA,GAAU,MAAM1B,OAAA,CAAQ2B,GAAG,CAC/B/B,MAAA,CAAO8B,MAAM,CAACE,GAAG,CAAE9B,KAAA;UACjB,OAAO1B,WAAA,CAAY;YAAEC,GAAA,EAAKyB,KAAA;YAAOxB,OAAA;YAASC;UAAI;QAChD;QAEF;QACA,OAAO;UAAE,GAAGO,QAAQ;UAAE4C;QAAO;MAC/B;MACA,OAAO5C,QAAA;IACT;IACA6B,MAAA;IACAU,eAAA,EAAiBA,CAACQ,CAAA,EAAGJ,IAAA,EAAMK,YAAA,KAAiBA,YAAA,CAAaC,MAAM,CAACV,eAAA,CAAgBI,IAAA;EAClF,GAAGV,eAAA;EAEH,MAAMiB,UAAA,GAAa/D,eAAA,CAAgB;IACjCqD,OAAA,EAAS,IAAIW,OAAA,CAAQV,WAAA,CAAYD,OAAO;IACxC/C;EACF;EAEA,KAAK,MAAM2D,GAAA,IAAOZ,OAAA,EAAS;IACzBU,UAAA,CAAWG,MAAM,CAACD,GAAA,EAAKZ,OAAO,CAACY,GAAA,CAAI;EACrC;EAEA,OAAO,IAAId,QAAA,CAASG,WAAA,CAAYa,IAAI,EAAE;IACpCd,OAAA,EAAS/C,GAAA,CAAI8D,eAAe,GAAGlE,YAAA,CAAaI,GAAA,CAAI8D,eAAe,EAAEL,UAAA,IAAcA,UAAA;IAC/EpE,MAAA,EAAQ2D,WAAA,CAAY3D;EACtB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayload.js"],"names":[],"mappings":"AAiBO,yCAJI,OAAO,MAAM,EAAE,UAAU,YAEjC;IAA0B,uBAAuB,GAAzC,OAAO;CAA6F,6BA4P9G"}
1
+ {"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayload.js"],"names":[],"mappings":"AAiBO,yCAJI,OAAO,MAAM,EAAE,UAAU,YAEjC;IAA0B,uBAAuB,GAAzC,OAAO;CAA6F,6BA6P9G"}
@@ -36,6 +36,7 @@ export const withPayload = (nextConfig = {}, options = {}) => {
36
36
  /** @type {import('next').NextConfig} */
37
37
  const baseConfig = {
38
38
  ...nextConfig,
39
+ devIndicators: nextConfig.devIndicators !== undefined ? nextConfig.devIndicators : false,
39
40
  env,
40
41
  experimental: {
41
42
  ...(nextConfig.experimental || {}),
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.js","names":["poweredByHeader","key","value","withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","cacheComponents","PAYLOAD_CACHE_COMPONENTS_ENABLED","consoleWarn","sassWarningTexts","args","some","text","includes","baseConfig","turbopackServerFastRefresh","sassOptions","silenceDeprecations","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"sources":["../../src/withPayload/withPayload.js"],"sourcesContent":["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload: detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (nextConfig.cacheComponents) {\n env.PAYLOAD_CACHE_COMPONENTS_ENABLED = 'true'\n }\n\n const consoleWarn = console.warn\n\n const sassWarningTexts = [\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n 'Future import deprecation is not yet active, so silencing it is unnecessary',\n // Sometimes happens despite silenceDeprecations\n 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0',\n ]\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && sassWarningTexts.some((text) => args[1].includes(text))) ||\n (typeof args[0] === 'string' && sassWarningTexts.some((text) => args[0].includes(text)))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n experimental: {\n ...(nextConfig.experimental || {}),\n // Server fast refresh breaks HMR\n turbopackServerFastRefresh: false,\n },\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n // file-type v22 uses `import(specifier)` with a non-literal specifier, which Turbopack rejects\n // with \"Cannot find module as expression is too dynamic\"\n 'file-type',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.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[]}
1
+ {"version":3,"file":"withPayload.js","names":["poweredByHeader","key","value","withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","cacheComponents","PAYLOAD_CACHE_COMPONENTS_ENABLED","consoleWarn","sassWarningTexts","args","some","text","includes","baseConfig","devIndicators","undefined","turbopackServerFastRefresh","sassOptions","silenceDeprecations","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"sources":["../../src/withPayload/withPayload.js"],"sourcesContent":["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload: detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (nextConfig.cacheComponents) {\n env.PAYLOAD_CACHE_COMPONENTS_ENABLED = 'true'\n }\n\n const consoleWarn = console.warn\n\n const sassWarningTexts = [\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n 'Future import deprecation is not yet active, so silencing it is unnecessary',\n // Sometimes happens despite silenceDeprecations\n 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0',\n ]\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && sassWarningTexts.some((text) => args[1].includes(text))) ||\n (typeof args[0] === 'string' && sassWarningTexts.some((text) => args[0].includes(text)))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n devIndicators: nextConfig.devIndicators !== undefined ? nextConfig.devIndicators : false,\n env,\n experimental: {\n ...(nextConfig.experimental || {}),\n // Server fast refresh breaks HMR\n turbopackServerFastRefresh: false,\n },\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n // file-type v22 uses `import(specifier)` with a non-literal specifier, which Turbopack rejects\n // with \"Cannot find module as expression is too dynamic\"\n 'file-type',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n return baseConfig\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;GAOA,MAAMA,eAAA,GAAkB;EACtBC,GAAA,EAAK;EACLC,KAAA,EAAO;AACT;AAEA;;;;;AAKA,OAAO,M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;;;;;;;;;;IA8BA,CACE,WACA,0BACA,2BACA,yBACA,kCACA,4BACA,uBACA,gCACA,4BACA,uBACA,6BACA,+BAYD,GACD,EAAE,EACP;IACDC,OAAA,EAASA,CAACC,aAAA,EAAeC,cAAA;MACvB,MAAMC,qBAAA,GACJ,OAAOpC,UAAA,CAAWiC,OAAO,KAAK,aAC1BjC,UAAA,CAAWiC,OAAO,CAACC,aAAA,EAAeC,cAAA,IAClCD,aAAA;MAEN,OAAO;QACL,GAAGE,qBAAqB;QACxBC,SAAA,EAAW,C,IACLD,qBAAA,EAAuBC,SAAA,IAAa,EAAE;QAC1C;;;;;;;;QAQA,eACA,mBACA,SACA,UACA,yBACA,4BACD;QACDC,OAAA,EAAS,C,IACHF,qBAAA,EAAuBE,OAAA,IAAW,EAAE;QACxC;QACA,IAAIH,cAAA,CAAeF,OAAO,CAACM,YAAY,CAAC;UACtCC,cAAA,EAAgB;QAClB,GACD;QACDC,OAAA,EAAS;UACP,IAAIL,qBAAA,EAAuBK,OAAA,IAAW,CAAC,CAAC;UACxCC,KAAA,EAAO;YACL,IAAIN,qBAAA,EAAuBK,OAAA,EAASC,KAAA,IAAS,CAAC,CAAC;UACjD;UACAC,QAAA,EAAU;YACR,IAAIP,qBAAA,EAAuBK,OAAA,EAASE,QAAA,IAAY,CAAC,CAAC;YAClD;;;;;;;;;;;;;;;;;;;YAmBAC,IAAA,EAAM;UACR;QACF;MACF;IACF;EACF;EAEA,IAAI5C,UAAA,CAAW6C,QAAQ,EAAE;IACvBf,OAAA,CAAQ5B,GAAG,CAAC4C,cAAc,GAAG9C,UAAA,CAAW6C,QAAQ;IAChD5B,UAAA,CAAWf,GAAG,CAAC4C,cAAc,GAAG9C,UAAA,CAAW6C,QAAQ;EACrD;EAEA,OAAO5B,UAAA;AACT;AAEA,eAAelB,WAAA","ignoreList":[]}
@@ -20,6 +20,20 @@ describe('withPayload', () => {
20
20
  }
21
21
  }
22
22
  });
23
+ it('should disable devIndicators by default', () => {
24
+ const result = withPayload({});
25
+ expect(result.devIndicators).toBe(false);
26
+ });
27
+ it('should use user-provided devIndicators when specified', () => {
28
+ const result = withPayload({
29
+ devIndicators: {
30
+ appIsrStatus: true
31
+ }
32
+ });
33
+ expect(result.devIndicators).toEqual({
34
+ appIsrStatus: true
35
+ });
36
+ });
23
37
  it('should not modify process.env.NEXT_BASE_PATH when basePath is not provided', () => {
24
38
  const originalBasePath = process.env.NEXT_BASE_PATH;
25
39
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.spec.js","names":["describe","expect","it","withPayload","originalBasePath","process","env","NEXT_BASE_PATH","mockNextConfig","basePath","toBe","undefined"],"sources":["../../src/withPayload/withPayload.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { withPayload } from './withPayload.js'\n\ndescribe('withPayload', () => {\n it('should set process.env.NEXT_BASE_PATH when nextConfig.basePath is provided', () => {\n const originalBasePath = process.env.NEXT_BASE_PATH\n delete process.env.NEXT_BASE_PATH\n\n try {\n const mockNextConfig = {\n basePath: '/test/basepath',\n }\n\n withPayload(mockNextConfig)\n\n // Verify it set the env var so formatAdminURL can read it\n expect(process.env.NEXT_BASE_PATH).toBe('/test/basepath')\n } finally {\n // Restore original value\n if (originalBasePath === undefined) {\n delete process.env.NEXT_BASE_PATH\n } else {\n process.env.NEXT_BASE_PATH = originalBasePath\n }\n }\n })\n\n it('should not modify process.env.NEXT_BASE_PATH when basePath is not provided', () => {\n const originalBasePath = process.env.NEXT_BASE_PATH\n\n try {\n const mockNextConfig = {}\n\n withPayload(mockNextConfig)\n\n // Verify it didn't set the env var\n expect(process.env.NEXT_BASE_PATH).toBe(originalBasePath)\n } finally {\n // Restore original value\n if (originalBasePath === undefined) {\n delete process.env.NEXT_BASE_PATH\n } else {\n process.env.NEXT_BASE_PATH = originalBasePath\n }\n }\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,WAAW,QAAQ;AAE5BH,QAAA,CAAS,eAAe;EACtBE,EAAA,CAAG,8EAA8E;IAC/E,MAAME,gBAAA,GAAmBC,OAAA,CAAQC,GAAG,CAACC,cAAc;IACnD,OAAOF,OAAA,CAAQC,GAAG,CAACC,cAAc;IAEjC,IAAI;MACF,MAAMC,cAAA,GAAiB;QACrBC,QAAA,EAAU;MACZ;MAEAN,WAAA,CAAYK,cAAA;MAEZ;MACAP,MAAA,CAAOI,OAAA,CAAQC,GAAG,CAACC,cAAc,EAAEG,IAAI,CAAC;IAC1C,UAAU;MACR;MACA,IAAIN,gBAAA,KAAqBO,SAAA,EAAW;QAClC,OAAON,OAAA,CAAQC,GAAG,CAACC,cAAc;MACnC,OAAO;QACLF,OAAA,CAAQC,GAAG,CAACC,cAAc,GAAGH,gBAAA;MAC/B;IACF;EACF;EAEAF,EAAA,CAAG,8EAA8E;IAC/E,MAAME,gBAAA,GAAmBC,OAAA,CAAQC,GAAG,CAACC,cAAc;IAEnD,IAAI;MACF,MAAMC,cAAA,GAAiB,CAAC;MAExBL,WAAA,CAAYK,cAAA;MAEZ;MACAP,MAAA,CAAOI,OAAA,CAAQC,GAAG,CAACC,cAAc,EAAEG,IAAI,CAACN,gBAAA;IAC1C,UAAU;MACR;MACA,IAAIA,gBAAA,KAAqBO,SAAA,EAAW;QAClC,OAAON,OAAA,CAAQC,GAAG,CAACC,cAAc;MACnC,OAAO;QACLF,OAAA,CAAQC,GAAG,CAACC,cAAc,GAAGH,gBAAA;MAC/B;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"withPayload.spec.js","names":["describe","expect","it","withPayload","originalBasePath","process","env","NEXT_BASE_PATH","mockNextConfig","basePath","toBe","undefined","result","devIndicators","appIsrStatus","toEqual"],"sources":["../../src/withPayload/withPayload.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { withPayload } from './withPayload.js'\n\ndescribe('withPayload', () => {\n it('should set process.env.NEXT_BASE_PATH when nextConfig.basePath is provided', () => {\n const originalBasePath = process.env.NEXT_BASE_PATH\n delete process.env.NEXT_BASE_PATH\n\n try {\n const mockNextConfig = {\n basePath: '/test/basepath',\n }\n\n withPayload(mockNextConfig)\n\n // Verify it set the env var so formatAdminURL can read it\n expect(process.env.NEXT_BASE_PATH).toBe('/test/basepath')\n } finally {\n // Restore original value\n if (originalBasePath === undefined) {\n delete process.env.NEXT_BASE_PATH\n } else {\n process.env.NEXT_BASE_PATH = originalBasePath\n }\n }\n })\n\n it('should disable devIndicators by default', () => {\n const result = withPayload({})\n\n expect(result.devIndicators).toBe(false)\n })\n\n it('should use user-provided devIndicators when specified', () => {\n const result = withPayload({ devIndicators: { appIsrStatus: true } })\n\n expect(result.devIndicators).toEqual({ appIsrStatus: true })\n })\n\n it('should not modify process.env.NEXT_BASE_PATH when basePath is not provided', () => {\n const originalBasePath = process.env.NEXT_BASE_PATH\n\n try {\n const mockNextConfig = {}\n\n withPayload(mockNextConfig)\n\n // Verify it didn't set the env var\n expect(process.env.NEXT_BASE_PATH).toBe(originalBasePath)\n } finally {\n // Restore original value\n if (originalBasePath === undefined) {\n delete process.env.NEXT_BASE_PATH\n } else {\n process.env.NEXT_BASE_PATH = originalBasePath\n }\n }\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,WAAW,QAAQ;AAE5BH,QAAA,CAAS,eAAe;EACtBE,EAAA,CAAG,8EAA8E;IAC/E,MAAME,gBAAA,GAAmBC,OAAA,CAAQC,GAAG,CAACC,cAAc;IACnD,OAAOF,OAAA,CAAQC,GAAG,CAACC,cAAc;IAEjC,IAAI;MACF,MAAMC,cAAA,GAAiB;QACrBC,QAAA,EAAU;MACZ;MAEAN,WAAA,CAAYK,cAAA;MAEZ;MACAP,MAAA,CAAOI,OAAA,CAAQC,GAAG,CAACC,cAAc,EAAEG,IAAI,CAAC;IAC1C,UAAU;MACR;MACA,IAAIN,gBAAA,KAAqBO,SAAA,EAAW;QAClC,OAAON,OAAA,CAAQC,GAAG,CAACC,cAAc;MACnC,OAAO;QACLF,OAAA,CAAQC,GAAG,CAACC,cAAc,GAAGH,gBAAA;MAC/B;IACF;EACF;EAEAF,EAAA,CAAG,2CAA2C;IAC5C,MAAMU,MAAA,GAAST,WAAA,CAAY,CAAC;IAE5BF,MAAA,CAAOW,MAAA,CAAOC,aAAa,EAAEH,IAAI,CAAC;EACpC;EAEAR,EAAA,CAAG,yDAAyD;IAC1D,MAAMU,MAAA,GAAST,WAAA,CAAY;MAAEU,aAAA,EAAe;QAAEC,YAAA,EAAc;MAAK;IAAE;IAEnEb,MAAA,CAAOW,MAAA,CAAOC,aAAa,EAAEE,OAAO,CAAC;MAAED,YAAA,EAAc;IAAK;EAC5D;EAEAZ,EAAA,CAAG,8EAA8E;IAC/E,MAAME,gBAAA,GAAmBC,OAAA,CAAQC,GAAG,CAACC,cAAc;IAEnD,IAAI;MACF,MAAMC,cAAA,GAAiB,CAAC;MAExBL,WAAA,CAAYK,cAAA;MAEZ;MACAP,MAAA,CAAOI,OAAA,CAAQC,GAAG,CAACC,cAAc,EAAEG,IAAI,CAACN,gBAAA;IAC1C,UAAU;MACR;MACA,IAAIA,gBAAA,KAAqBO,SAAA,EAAW;QAClC,OAAON,OAAA,CAAQC,GAAG,CAACC,cAAc;MACnC,OAAO;QACLF,OAAA,CAAQC,GAAG,CAACC,cAAc,GAAGH,gBAAA;MAC/B;IACF;EACF;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/next",
3
- "version": "4.0.0-internal.5d5a2b2",
3
+ "version": "4.0.0-internal.63f8536",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -85,9 +85,9 @@
85
85
  "qs-esm": "8.0.1",
86
86
  "sass": "1.77.4",
87
87
  "uuid": "14.0.0",
88
- "@payloadcms/graphql": "4.0.0-internal.5d5a2b2",
89
- "@payloadcms/translations": "4.0.0-internal.5d5a2b2",
90
- "@payloadcms/ui": "4.0.0-internal.5d5a2b2"
88
+ "@payloadcms/graphql": "4.0.0-internal.63f8536",
89
+ "@payloadcms/translations": "4.0.0-internal.63f8536",
90
+ "@payloadcms/ui": "4.0.0-internal.63f8536"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@babel/cli": "7.27.2",
@@ -104,12 +104,12 @@
104
104
  "esbuild-sass-plugin": "3.3.1",
105
105
  "swc-plugin-transform-remove-imports": "8.3.0",
106
106
  "@payloadcms/eslint-config": "3.28.0",
107
- "payload": "4.0.0-internal.5d5a2b2"
107
+ "payload": "4.0.0-internal.63f8536"
108
108
  },
109
109
  "peerDependencies": {
110
110
  "graphql": "^16.8.1",
111
111
  "next": ">=16.2.6 <17.0.0",
112
- "payload": "4.0.0-internal.5d5a2b2"
112
+ "payload": "4.0.0-internal.63f8536"
113
113
  },
114
114
  "engines": {
115
115
  "node": ">=24.15.0"
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=assets.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assets.d.js","names":[],"sources":["../../src/@types/assets.d.ts"],"sourcesContent":[null],"mappings":"","ignoreList":[]}