@payloadcms/next 3.71.0-internal.27e1e08 → 3.71.0-internal.49c4f67
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.
- package/dist/cjs/withPayload.cjs.map +3 -3
- package/dist/prod/styles.css +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +6 -6
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
- package/dist/withPayload/withPayload.d.ts +2 -8
- package/dist/withPayload/withPayload.d.ts.map +1 -1
- package/dist/withPayload/withPayload.js +7 -1
- package/dist/withPayload/withPayload.js.map +1 -1
- package/dist/withPayload/withPayload.utils.d.ts +18 -40
- package/dist/withPayload/withPayload.utils.d.ts.map +1 -1
- package/dist/withPayload/withPayload.utils.js +45 -28
- package/dist/withPayload/withPayload.utils.js.map +1 -1
- package/dist/withPayload/withPayloadLegacy.d.ts +1 -5
- package/dist/withPayload/withPayloadLegacy.d.ts.map +1 -1
- package/dist/withPayload/withPayloadLegacy.js +6 -3
- package/dist/withPayload/withPayloadLegacy.js.map +1 -1
- package/package.json +6 -6
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.d.ts +0 -27
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.d.ts.map +0 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js +0 -26
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js.map +0 -1
|
@@ -219,8 +219,8 @@ const buildVersionField = ({
|
|
|
219
219
|
field: tabAsField,
|
|
220
220
|
index: tabIndex,
|
|
221
221
|
parentIndexPath: indexPath,
|
|
222
|
-
parentPath,
|
|
223
|
-
parentSchemaPath
|
|
222
|
+
parentPath: path,
|
|
223
|
+
parentSchemaPath: schemaPath
|
|
224
224
|
});
|
|
225
225
|
let tabFieldsPermissions = undefined;
|
|
226
226
|
// The tabs field does not have its own permissions as it's unnamed => use parentFieldsPermissions
|
|
@@ -252,7 +252,7 @@ const buildVersionField = ({
|
|
|
252
252
|
parentIndexPath: isNamedTab ? '' : tabIndexPath,
|
|
253
253
|
parentIsLocalized: parentIsLocalized || tab.localized,
|
|
254
254
|
parentPath: isNamedTab ? tabPath : 'name' in field ? path : parentPath,
|
|
255
|
-
parentSchemaPath:
|
|
255
|
+
parentSchemaPath: tabSchemaPath,
|
|
256
256
|
req,
|
|
257
257
|
selectedLocales,
|
|
258
258
|
versionFromSiblingData: 'name' in tab ? valueFrom?.[tab.name] : valueFrom,
|
|
@@ -297,7 +297,7 @@ const buildVersionField = ({
|
|
|
297
297
|
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
298
298
|
parentIsLocalized: parentIsLocalized || field.localized,
|
|
299
299
|
parentPath: ('name' in field ? path : parentPath) + '.' + i,
|
|
300
|
-
parentSchemaPath:
|
|
300
|
+
parentSchemaPath: schemaPath,
|
|
301
301
|
req,
|
|
302
302
|
selectedLocales,
|
|
303
303
|
versionFromSiblingData: fromRow,
|
|
@@ -323,7 +323,7 @@ const buildVersionField = ({
|
|
|
323
323
|
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
324
324
|
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
325
325
|
parentPath: 'name' in field ? path : parentPath,
|
|
326
|
-
parentSchemaPath:
|
|
326
|
+
parentSchemaPath: schemaPath,
|
|
327
327
|
req,
|
|
328
328
|
selectedLocales,
|
|
329
329
|
versionFromSiblingData: valueFrom,
|
|
@@ -379,7 +379,7 @@ const buildVersionField = ({
|
|
|
379
379
|
parentIndexPath: 'name' in field ? '' : indexPath,
|
|
380
380
|
parentIsLocalized: parentIsLocalized || 'localized' in field && field.localized,
|
|
381
381
|
parentPath: ('name' in field ? path : parentPath) + '.' + i,
|
|
382
|
-
parentSchemaPath:
|
|
382
|
+
parentSchemaPath: schemaPath + '.' + toBlock.slug,
|
|
383
383
|
req,
|
|
384
384
|
selectedLocales,
|
|
385
385
|
versionFromSiblingData: fromRow,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildVersionFields.js","names":["RenderServerComponent","dequal","MissingEditorProp","fieldIsID","fieldShouldBeLocalized","getFieldPaths","getUniqueListBy","tabHasName","diffComponents","buildVersionFields","clientSchemaMap","customDiffComponents","entitySlug","fields","fieldsPermissions","i18n","modifiedOnly","nestingLevel","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","req","selectedLocales","versionFromSiblingData","versionToSiblingData","versionFields","fieldIndex","field","indexPath","path","schemaPath","index","clientField","get","payload","logger","error","clientFieldKey","clientSchemaMapKeys","Array","from","keys","msg","Error","versionField","isLocalized","fieldName","name","valueFrom","valueTo","fieldByLocale","locale","localizedVersionField","buildVersionField","parentFieldsPermissions","baseVersionField","localized","Object","length","push","hasReadPermission","fieldPermissions","undefined","read","CustomComponent","type","editor","CellComponent","DiffComponent","admin","components","Diff","DefaultComponent","tabs","tabIndex","tab","isNamedTab","tabAsField","tabIndexPath","tabPath","tabSchemaPath","tabFieldsPermissions","tabPermissions","tabVersion","label","t","subFieldsPermissions","maxLength","Math","max","isArray","rows","i","fromRow","toRow","blockSlugToMatch","blockType","toBlock","blocks","blockReferences","find","block","slug","fromBlockSlugToMatch","fromBlock","blockFieldsPermissions","permissionsBlockSpecific","clientDiffProps","comparisonValue","diffMethod","versionValue","serverDiffProps","clientProps","Component","Fallback","importMap","key","serverProps"],"sources":["../../../../src/views/Version/RenderFieldsToDiff/buildVersionFields.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { dequal } from 'dequal/lite'\nimport {\n type BaseVersionField,\n type ClientField,\n type ClientFieldSchemaMap,\n type Field,\n type FieldDiffClientProps,\n type FieldDiffServerProps,\n type FieldTypes,\n type FlattenedBlock,\n MissingEditorProp,\n type PayloadComponent,\n type PayloadRequest,\n type SanitizedFieldPermissions,\n type SanitizedFieldsPermissions,\n type VersionField,\n} from 'payload'\nimport {\n fieldIsID,\n fieldShouldBeLocalized,\n getFieldPaths,\n getUniqueListBy,\n tabHasName,\n} from 'payload/shared'\n\nimport { diffComponents } from './fields/index.js'\n\nexport type BuildVersionFieldsArgs = {\n clientSchemaMap: ClientFieldSchemaMap\n customDiffComponents: Partial<\n Record<FieldTypes, PayloadComponent<FieldDiffServerProps, FieldDiffClientProps>>\n >\n entitySlug: string\n fields: Field[]\n fieldsPermissions: SanitizedFieldsPermissions\n i18n: I18nClient\n modifiedOnly: boolean\n nestingLevel?: number\n parentIndexPath: string\n parentIsLocalized: boolean\n parentPath: string\n parentSchemaPath: string\n req: PayloadRequest\n selectedLocales: string[]\n versionFromSiblingData: object\n versionToSiblingData: object\n}\n\n/**\n * Build up an object that contains rendered diff components for each field.\n * This is then sent to the client to be rendered.\n *\n * Here, the server is responsible for traversing through the document data and building up this\n * version state object.\n */\nexport const buildVersionFields = ({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields,\n fieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel = 0,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n req,\n selectedLocales,\n versionFromSiblingData,\n versionToSiblingData,\n}: BuildVersionFieldsArgs): {\n versionFields: VersionField[]\n} => {\n const versionFields: VersionField[] = []\n let fieldIndex = -1\n\n for (const field of fields) {\n fieldIndex++\n\n if (fieldIsID(field)) {\n continue\n }\n\n const { indexPath, path, schemaPath } = getFieldPaths({\n field,\n index: fieldIndex,\n parentIndexPath,\n parentPath,\n parentSchemaPath,\n })\n\n const clientField = clientSchemaMap.get(entitySlug + '.' + schemaPath)\n\n if (!clientField) {\n req.payload.logger.error({\n clientFieldKey: entitySlug + '.' + schemaPath,\n clientSchemaMapKeys: Array.from(clientSchemaMap.keys()),\n msg: 'No client field found for ' + entitySlug + '.' + schemaPath,\n parentPath,\n parentSchemaPath,\n path,\n schemaPath,\n })\n throw new Error('No client field found for ' + entitySlug + '.' + schemaPath)\n }\n\n const versionField: VersionField = {}\n const isLocalized = fieldShouldBeLocalized({ field, parentIsLocalized })\n\n const fieldName: null | string = 'name' in field ? field.name : null\n\n const valueFrom = fieldName ? versionFromSiblingData?.[fieldName] : versionFromSiblingData\n const valueTo = fieldName ? versionToSiblingData?.[fieldName] : versionToSiblingData\n\n if (isLocalized) {\n versionField.fieldByLocale = {}\n\n for (const locale of selectedLocales) {\n const localizedVersionField = buildVersionField({\n clientField: clientField as ClientField,\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n field,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n nestingLevel,\n parentFieldsPermissions: fieldsPermissions,\n parentIsLocalized: true,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n valueFrom: valueFrom?.[locale],\n valueTo: valueTo?.[locale],\n })\n if (localizedVersionField) {\n versionField.fieldByLocale[locale] = localizedVersionField\n }\n }\n } else {\n const baseVersionField = buildVersionField({\n clientField: clientField as ClientField,\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n field,\n i18n,\n indexPath,\n modifiedOnly,\n nestingLevel,\n parentFieldsPermissions: fieldsPermissions,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n valueFrom,\n valueTo,\n })\n\n if (baseVersionField) {\n versionField.field = baseVersionField\n }\n }\n\n if (\n versionField.field ||\n (versionField.fieldByLocale && Object.keys(versionField.fieldByLocale).length)\n ) {\n versionFields.push(versionField)\n }\n }\n\n return {\n versionFields,\n }\n}\n\nconst buildVersionField = ({\n clientField,\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n field,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n nestingLevel,\n parentFieldsPermissions,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n valueFrom,\n valueTo,\n}: {\n clientField: ClientField\n field: Field\n indexPath: string\n locale?: string\n modifiedOnly?: boolean\n nestingLevel: number\n parentFieldsPermissions: SanitizedFieldsPermissions\n parentIsLocalized: boolean\n path: string\n schemaPath: string\n valueFrom: unknown\n valueTo: unknown\n} & Omit<\n BuildVersionFieldsArgs,\n | 'fields'\n | 'fieldsPermissions'\n | 'parentIndexPath'\n | 'versionFromSiblingData'\n | 'versionToSiblingData'\n>): BaseVersionField | null => {\n let hasReadPermission: boolean = false\n let fieldPermissions: SanitizedFieldPermissions | undefined = undefined\n\n if (typeof parentFieldsPermissions === 'boolean') {\n hasReadPermission = parentFieldsPermissions\n fieldPermissions = parentFieldsPermissions\n } else {\n if ('name' in field) {\n fieldPermissions = parentFieldsPermissions?.[field.name]\n if (typeof fieldPermissions === 'boolean') {\n hasReadPermission = fieldPermissions\n } else if (typeof fieldPermissions?.read === 'boolean') {\n hasReadPermission = fieldPermissions.read\n }\n } else {\n // If the field is unnamed and parentFieldsPermissions is an object, its sub-fields will decide their read permissions state.\n // As far as this field is concerned, we are allowed to read it, as we need to reach its sub-fields to determine their read permissions.\n hasReadPermission = true\n }\n }\n\n if (!hasReadPermission) {\n // HasReadPermission is only valid if the field has a name. E.g. for a tabs field it would incorrectly return `false`.\n return null\n }\n\n if (modifiedOnly && dequal(valueFrom, valueTo)) {\n return null\n }\n\n let CustomComponent = customDiffComponents?.[field.type]\n if (field?.type === 'richText') {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (field.editor.CellComponent) {\n CustomComponent = field.editor.DiffComponent\n }\n }\n if (field?.admin?.components?.Diff) {\n CustomComponent = field.admin.components.Diff\n }\n\n const DefaultComponent = diffComponents?.[field.type]\n\n const baseVersionField: BaseVersionField = {\n type: field.type,\n fields: [],\n path,\n schemaPath,\n }\n\n if (field.type === 'tabs' && 'tabs' in field) {\n baseVersionField.tabs = []\n let tabIndex = -1\n for (const tab of field.tabs) {\n tabIndex++\n const isNamedTab = tabHasName(tab)\n\n const tabAsField = { ...tab, type: 'tab' }\n\n const {\n indexPath: tabIndexPath,\n path: tabPath,\n schemaPath: tabSchemaPath,\n } = getFieldPaths({\n field: tabAsField,\n index: tabIndex,\n parentIndexPath: indexPath,\n parentPath,\n parentSchemaPath,\n })\n\n let tabFieldsPermissions: SanitizedFieldsPermissions = undefined\n\n // The tabs field does not have its own permissions as it's unnamed => use parentFieldsPermissions\n if (typeof parentFieldsPermissions === 'boolean') {\n tabFieldsPermissions = parentFieldsPermissions\n } else {\n if ('name' in tab) {\n const tabPermissions = parentFieldsPermissions?.[tab.name]\n if (typeof tabPermissions === 'boolean') {\n tabFieldsPermissions = tabPermissions\n } else {\n tabFieldsPermissions = tabPermissions?.fields\n }\n } else {\n tabFieldsPermissions = parentFieldsPermissions\n }\n }\n\n const tabVersion = {\n name: 'name' in tab ? tab.name : null,\n fields: buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields: tab.fields,\n fieldsPermissions: tabFieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel: nestingLevel + 1,\n parentIndexPath: isNamedTab ? '' : tabIndexPath,\n parentIsLocalized: parentIsLocalized || tab.localized,\n parentPath: isNamedTab ? tabPath : 'name' in field ? path : parentPath,\n parentSchemaPath: isNamedTab\n ? tabSchemaPath\n : 'name' in field\n ? schemaPath\n : parentSchemaPath,\n req,\n selectedLocales,\n versionFromSiblingData: 'name' in tab ? valueFrom?.[tab.name] : valueFrom,\n versionToSiblingData: 'name' in tab ? valueTo?.[tab.name] : valueTo,\n }).versionFields,\n label: typeof tab.label === 'function' ? tab.label({ i18n, t: i18n.t }) : tab.label,\n }\n if (tabVersion?.fields?.length) {\n baseVersionField.tabs.push(tabVersion)\n }\n }\n\n if (modifiedOnly && !baseVersionField.tabs.length) {\n return null\n }\n } // At this point, we are dealing with a `row`, `collapsible`, array`, etc\n else if ('fields' in field) {\n let subFieldsPermissions: SanitizedFieldsPermissions = undefined\n\n if ('name' in field && typeof fieldPermissions !== 'undefined') {\n // Named fields like arrays\n subFieldsPermissions =\n typeof fieldPermissions === 'boolean' ? fieldPermissions : fieldPermissions.fields\n } else {\n // Unnamed fields like collapsible and row inherit directly from parent permissions\n subFieldsPermissions = parentFieldsPermissions\n }\n\n if (field.type === 'array' && (valueTo || valueFrom)) {\n const maxLength = Math.max(\n Array.isArray(valueTo) ? valueTo.length : 0,\n Array.isArray(valueFrom) ? valueFrom.length : 0,\n )\n baseVersionField.rows = []\n\n for (let i = 0; i < maxLength; i++) {\n const fromRow = (Array.isArray(valueFrom) && valueFrom?.[i]) || {}\n const toRow = (Array.isArray(valueTo) && valueTo?.[i]) || {}\n\n const versionFields = buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields: field.fields,\n fieldsPermissions: subFieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel: nestingLevel + 1,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: ('name' in field ? path : parentPath) + '.' + i,\n parentSchemaPath: 'name' in field ? schemaPath : parentSchemaPath,\n req,\n selectedLocales,\n versionFromSiblingData: fromRow,\n versionToSiblingData: toRow,\n }).versionFields\n\n if (versionFields?.length) {\n baseVersionField.rows[i] = versionFields\n }\n }\n\n if (!baseVersionField.rows?.length && modifiedOnly) {\n return null\n }\n } else {\n baseVersionField.fields = buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields: field.fields,\n fieldsPermissions: subFieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel: field.type !== 'row' ? nestingLevel + 1 : nestingLevel,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath: 'name' in field ? path : parentPath,\n parentSchemaPath: 'name' in field ? schemaPath : parentSchemaPath,\n req,\n selectedLocales,\n versionFromSiblingData: valueFrom as object,\n versionToSiblingData: valueTo as object,\n }).versionFields\n\n if (modifiedOnly && !baseVersionField.fields?.length) {\n return null\n }\n }\n } else if (field.type === 'blocks') {\n baseVersionField.rows = []\n\n const maxLength = Math.max(\n Array.isArray(valueTo) ? valueTo.length : 0,\n Array.isArray(valueFrom) ? valueFrom.length : 0,\n )\n\n for (let i = 0; i < maxLength; i++) {\n const fromRow = (Array.isArray(valueFrom) && valueFrom?.[i]) || {}\n const toRow = (Array.isArray(valueTo) && valueTo?.[i]) || {}\n\n const blockSlugToMatch: string = toRow?.blockType ?? fromRow?.blockType\n const toBlock =\n req.payload.blocks[blockSlugToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === blockSlugToMatch,\n ) as FlattenedBlock | undefined)\n\n let fields = []\n\n if (toRow.blockType === fromRow.blockType) {\n fields = toBlock.fields\n } else {\n const fromBlockSlugToMatch: string = toRow?.blockType ?? fromRow?.blockType\n\n const fromBlock =\n req.payload.blocks[fromBlockSlugToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === fromBlockSlugToMatch,\n ) as FlattenedBlock | undefined)\n\n if (fromBlock) {\n fields = getUniqueListBy<Field>([...toBlock.fields, ...fromBlock.fields], 'name')\n } else {\n fields = toBlock.fields\n }\n }\n\n let blockFieldsPermissions: SanitizedFieldsPermissions = undefined\n\n // fieldPermissions will be set here, as the blocks field has a name\n if (typeof fieldPermissions === 'boolean') {\n blockFieldsPermissions = fieldPermissions\n } else if (typeof fieldPermissions?.blocks === 'boolean') {\n blockFieldsPermissions = fieldPermissions.blocks\n } else {\n const permissionsBlockSpecific = fieldPermissions?.blocks?.[blockSlugToMatch]\n if (typeof permissionsBlockSpecific === 'boolean') {\n blockFieldsPermissions = permissionsBlockSpecific\n } else {\n blockFieldsPermissions = permissionsBlockSpecific?.fields\n }\n }\n\n const versionFields = buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields,\n fieldsPermissions: blockFieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel: nestingLevel + 1,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath: ('name' in field ? path : parentPath) + '.' + i,\n parentSchemaPath: ('name' in field ? schemaPath : parentSchemaPath) + '.' + toBlock.slug,\n req,\n selectedLocales,\n versionFromSiblingData: fromRow,\n versionToSiblingData: toRow,\n }).versionFields\n\n if (versionFields?.length) {\n baseVersionField.rows[i] = versionFields\n }\n }\n\n if (!baseVersionField.rows?.length && modifiedOnly) {\n return null\n }\n }\n\n const clientDiffProps: FieldDiffClientProps = {\n baseVersionField: {\n ...baseVersionField,\n CustomComponent: undefined,\n },\n /**\n * TODO: Change to valueFrom in 4.0\n */\n comparisonValue: valueFrom,\n /**\n * @deprecated remove in 4.0. Each field should handle its own diffing logic\n */\n diffMethod: 'diffWordsWithSpace',\n field: clientField,\n fieldPermissions:\n typeof fieldPermissions === 'undefined' ? parentFieldsPermissions : fieldPermissions,\n parentIsLocalized,\n\n nestingLevel: nestingLevel ? nestingLevel : undefined,\n /**\n * TODO: Change to valueTo in 4.0\n */\n versionValue: valueTo,\n }\n if (locale) {\n clientDiffProps.locale = locale\n }\n\n const serverDiffProps: FieldDiffServerProps = {\n ...clientDiffProps,\n clientField,\n field,\n i18n,\n req,\n selectedLocales,\n }\n\n baseVersionField.CustomComponent = RenderServerComponent({\n clientProps: clientDiffProps,\n Component: CustomComponent,\n Fallback: DefaultComponent,\n importMap: req.payload.importMap,\n key: 'diff component',\n serverProps: serverDiffProps,\n })\n\n return baseVersionField\n}\n"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ;AACtC,SAASC,MAAM,QAAQ;AACvB,SASEC,iBAAiB,QAMZ;AACP,SACEC,SAAS,EACTC,sBAAsB,EACtBC,aAAa,EACbC,eAAe,EACfC,UAAU,QACL;AAEP,SAASC,cAAc,QAAQ;AAuB/B;;;;;;;AAOA,OAAO,MAAM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B;EAEA,MAAM4D,eAAA,GAAwC;IAC5C,GAAGJ,eAAe;IAClB3E,WAAA;IACAL,KAAA;IACAb,IAAA;IACAO,GAAA;IACAC;EACF;EAEAiC,gBAAA,CAAiBS,eAAe,GAAGjE,qBAAA,CAAsB;IACvDiH,WAAA,EAAaL,eAAA;IACbM,SAAA,EAAWjD,eAAA;IACXkD,QAAA,EAAU1C,gBAAA;IACV2C,SAAA,EAAW9F,GAAA,CAAIa,OAAO,CAACiF,SAAS;IAChCC,GAAA,EAAK;IACLC,WAAA,EAAaN;EACf;EAEA,OAAOxD,gBAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"buildVersionFields.js","names":["RenderServerComponent","dequal","MissingEditorProp","fieldIsID","fieldShouldBeLocalized","getFieldPaths","getUniqueListBy","tabHasName","diffComponents","buildVersionFields","clientSchemaMap","customDiffComponents","entitySlug","fields","fieldsPermissions","i18n","modifiedOnly","nestingLevel","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","req","selectedLocales","versionFromSiblingData","versionToSiblingData","versionFields","fieldIndex","field","indexPath","path","schemaPath","index","clientField","get","payload","logger","error","clientFieldKey","clientSchemaMapKeys","Array","from","keys","msg","Error","versionField","isLocalized","fieldName","name","valueFrom","valueTo","fieldByLocale","locale","localizedVersionField","buildVersionField","parentFieldsPermissions","baseVersionField","localized","Object","length","push","hasReadPermission","fieldPermissions","undefined","read","CustomComponent","type","editor","CellComponent","DiffComponent","admin","components","Diff","DefaultComponent","tabs","tabIndex","tab","isNamedTab","tabAsField","tabIndexPath","tabPath","tabSchemaPath","tabFieldsPermissions","tabPermissions","tabVersion","label","t","subFieldsPermissions","maxLength","Math","max","isArray","rows","i","fromRow","toRow","blockSlugToMatch","blockType","toBlock","blocks","blockReferences","find","block","slug","fromBlockSlugToMatch","fromBlock","blockFieldsPermissions","permissionsBlockSpecific","clientDiffProps","comparisonValue","diffMethod","versionValue","serverDiffProps","clientProps","Component","Fallback","importMap","key","serverProps"],"sources":["../../../../src/views/Version/RenderFieldsToDiff/buildVersionFields.tsx"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\n\nimport { RenderServerComponent } from '@payloadcms/ui/elements/RenderServerComponent'\nimport { dequal } from 'dequal/lite'\nimport {\n type BaseVersionField,\n type ClientField,\n type ClientFieldSchemaMap,\n type Field,\n type FieldDiffClientProps,\n type FieldDiffServerProps,\n type FieldTypes,\n type FlattenedBlock,\n MissingEditorProp,\n type PayloadComponent,\n type PayloadRequest,\n type SanitizedFieldPermissions,\n type SanitizedFieldsPermissions,\n type VersionField,\n} from 'payload'\nimport {\n fieldIsID,\n fieldShouldBeLocalized,\n getFieldPaths,\n getUniqueListBy,\n tabHasName,\n} from 'payload/shared'\n\nimport { diffComponents } from './fields/index.js'\n\nexport type BuildVersionFieldsArgs = {\n clientSchemaMap: ClientFieldSchemaMap\n customDiffComponents: Partial<\n Record<FieldTypes, PayloadComponent<FieldDiffServerProps, FieldDiffClientProps>>\n >\n entitySlug: string\n fields: Field[]\n fieldsPermissions: SanitizedFieldsPermissions\n i18n: I18nClient\n modifiedOnly: boolean\n nestingLevel?: number\n parentIndexPath: string\n parentIsLocalized: boolean\n parentPath: string\n parentSchemaPath: string\n req: PayloadRequest\n selectedLocales: string[]\n versionFromSiblingData: object\n versionToSiblingData: object\n}\n\n/**\n * Build up an object that contains rendered diff components for each field.\n * This is then sent to the client to be rendered.\n *\n * Here, the server is responsible for traversing through the document data and building up this\n * version state object.\n */\nexport const buildVersionFields = ({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields,\n fieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel = 0,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n req,\n selectedLocales,\n versionFromSiblingData,\n versionToSiblingData,\n}: BuildVersionFieldsArgs): {\n versionFields: VersionField[]\n} => {\n const versionFields: VersionField[] = []\n let fieldIndex = -1\n\n for (const field of fields) {\n fieldIndex++\n\n if (fieldIsID(field)) {\n continue\n }\n\n const { indexPath, path, schemaPath } = getFieldPaths({\n field,\n index: fieldIndex,\n parentIndexPath,\n parentPath,\n parentSchemaPath,\n })\n\n const clientField = clientSchemaMap.get(entitySlug + '.' + schemaPath)\n\n if (!clientField) {\n req.payload.logger.error({\n clientFieldKey: entitySlug + '.' + schemaPath,\n clientSchemaMapKeys: Array.from(clientSchemaMap.keys()),\n msg: 'No client field found for ' + entitySlug + '.' + schemaPath,\n parentPath,\n parentSchemaPath,\n path,\n schemaPath,\n })\n throw new Error('No client field found for ' + entitySlug + '.' + schemaPath)\n }\n\n const versionField: VersionField = {}\n const isLocalized = fieldShouldBeLocalized({ field, parentIsLocalized })\n\n const fieldName: null | string = 'name' in field ? field.name : null\n\n const valueFrom = fieldName ? versionFromSiblingData?.[fieldName] : versionFromSiblingData\n const valueTo = fieldName ? versionToSiblingData?.[fieldName] : versionToSiblingData\n\n if (isLocalized) {\n versionField.fieldByLocale = {}\n\n for (const locale of selectedLocales) {\n const localizedVersionField = buildVersionField({\n clientField: clientField as ClientField,\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n field,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n nestingLevel,\n parentFieldsPermissions: fieldsPermissions,\n parentIsLocalized: true,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n valueFrom: valueFrom?.[locale],\n valueTo: valueTo?.[locale],\n })\n if (localizedVersionField) {\n versionField.fieldByLocale[locale] = localizedVersionField\n }\n }\n } else {\n const baseVersionField = buildVersionField({\n clientField: clientField as ClientField,\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n field,\n i18n,\n indexPath,\n modifiedOnly,\n nestingLevel,\n parentFieldsPermissions: fieldsPermissions,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n valueFrom,\n valueTo,\n })\n\n if (baseVersionField) {\n versionField.field = baseVersionField\n }\n }\n\n if (\n versionField.field ||\n (versionField.fieldByLocale && Object.keys(versionField.fieldByLocale).length)\n ) {\n versionFields.push(versionField)\n }\n }\n\n return {\n versionFields,\n }\n}\n\nconst buildVersionField = ({\n clientField,\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n field,\n i18n,\n indexPath,\n locale,\n modifiedOnly,\n nestingLevel,\n parentFieldsPermissions,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n path,\n req,\n schemaPath,\n selectedLocales,\n valueFrom,\n valueTo,\n}: {\n clientField: ClientField\n field: Field\n indexPath: string\n locale?: string\n modifiedOnly?: boolean\n nestingLevel: number\n parentFieldsPermissions: SanitizedFieldsPermissions\n parentIsLocalized: boolean\n path: string\n schemaPath: string\n valueFrom: unknown\n valueTo: unknown\n} & Omit<\n BuildVersionFieldsArgs,\n | 'fields'\n | 'fieldsPermissions'\n | 'parentIndexPath'\n | 'versionFromSiblingData'\n | 'versionToSiblingData'\n>): BaseVersionField | null => {\n let hasReadPermission: boolean = false\n let fieldPermissions: SanitizedFieldPermissions | undefined = undefined\n\n if (typeof parentFieldsPermissions === 'boolean') {\n hasReadPermission = parentFieldsPermissions\n fieldPermissions = parentFieldsPermissions\n } else {\n if ('name' in field) {\n fieldPermissions = parentFieldsPermissions?.[field.name]\n if (typeof fieldPermissions === 'boolean') {\n hasReadPermission = fieldPermissions\n } else if (typeof fieldPermissions?.read === 'boolean') {\n hasReadPermission = fieldPermissions.read\n }\n } else {\n // If the field is unnamed and parentFieldsPermissions is an object, its sub-fields will decide their read permissions state.\n // As far as this field is concerned, we are allowed to read it, as we need to reach its sub-fields to determine their read permissions.\n hasReadPermission = true\n }\n }\n\n if (!hasReadPermission) {\n // HasReadPermission is only valid if the field has a name. E.g. for a tabs field it would incorrectly return `false`.\n return null\n }\n\n if (modifiedOnly && dequal(valueFrom, valueTo)) {\n return null\n }\n\n let CustomComponent = customDiffComponents?.[field.type]\n if (field?.type === 'richText') {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n if (field.editor.CellComponent) {\n CustomComponent = field.editor.DiffComponent\n }\n }\n if (field?.admin?.components?.Diff) {\n CustomComponent = field.admin.components.Diff\n }\n\n const DefaultComponent = diffComponents?.[field.type]\n\n const baseVersionField: BaseVersionField = {\n type: field.type,\n fields: [],\n path,\n schemaPath,\n }\n\n if (field.type === 'tabs' && 'tabs' in field) {\n baseVersionField.tabs = []\n let tabIndex = -1\n for (const tab of field.tabs) {\n tabIndex++\n const isNamedTab = tabHasName(tab)\n\n const tabAsField = { ...tab, type: 'tab' }\n\n const {\n indexPath: tabIndexPath,\n path: tabPath,\n schemaPath: tabSchemaPath,\n } = getFieldPaths({\n field: tabAsField,\n index: tabIndex,\n parentIndexPath: indexPath,\n parentPath: path,\n parentSchemaPath: schemaPath,\n })\n\n let tabFieldsPermissions: SanitizedFieldsPermissions = undefined\n\n // The tabs field does not have its own permissions as it's unnamed => use parentFieldsPermissions\n if (typeof parentFieldsPermissions === 'boolean') {\n tabFieldsPermissions = parentFieldsPermissions\n } else {\n if ('name' in tab) {\n const tabPermissions = parentFieldsPermissions?.[tab.name]\n if (typeof tabPermissions === 'boolean') {\n tabFieldsPermissions = tabPermissions\n } else {\n tabFieldsPermissions = tabPermissions?.fields\n }\n } else {\n tabFieldsPermissions = parentFieldsPermissions\n }\n }\n\n const tabVersion = {\n name: 'name' in tab ? tab.name : null,\n fields: buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields: tab.fields,\n fieldsPermissions: tabFieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel: nestingLevel + 1,\n parentIndexPath: isNamedTab ? '' : tabIndexPath,\n parentIsLocalized: parentIsLocalized || tab.localized,\n parentPath: isNamedTab ? tabPath : 'name' in field ? path : parentPath,\n parentSchemaPath: tabSchemaPath,\n req,\n selectedLocales,\n versionFromSiblingData: 'name' in tab ? valueFrom?.[tab.name] : valueFrom,\n versionToSiblingData: 'name' in tab ? valueTo?.[tab.name] : valueTo,\n }).versionFields,\n label: typeof tab.label === 'function' ? tab.label({ i18n, t: i18n.t }) : tab.label,\n }\n if (tabVersion?.fields?.length) {\n baseVersionField.tabs.push(tabVersion)\n }\n }\n\n if (modifiedOnly && !baseVersionField.tabs.length) {\n return null\n }\n } // At this point, we are dealing with a `row`, `collapsible`, array`, etc\n else if ('fields' in field) {\n let subFieldsPermissions: SanitizedFieldsPermissions = undefined\n\n if ('name' in field && typeof fieldPermissions !== 'undefined') {\n // Named fields like arrays\n subFieldsPermissions =\n typeof fieldPermissions === 'boolean' ? fieldPermissions : fieldPermissions.fields\n } else {\n // Unnamed fields like collapsible and row inherit directly from parent permissions\n subFieldsPermissions = parentFieldsPermissions\n }\n\n if (field.type === 'array' && (valueTo || valueFrom)) {\n const maxLength = Math.max(\n Array.isArray(valueTo) ? valueTo.length : 0,\n Array.isArray(valueFrom) ? valueFrom.length : 0,\n )\n baseVersionField.rows = []\n\n for (let i = 0; i < maxLength; i++) {\n const fromRow = (Array.isArray(valueFrom) && valueFrom?.[i]) || {}\n const toRow = (Array.isArray(valueTo) && valueTo?.[i]) || {}\n\n const versionFields = buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields: field.fields,\n fieldsPermissions: subFieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel: nestingLevel + 1,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: ('name' in field ? path : parentPath) + '.' + i,\n parentSchemaPath: schemaPath,\n req,\n selectedLocales,\n versionFromSiblingData: fromRow,\n versionToSiblingData: toRow,\n }).versionFields\n\n if (versionFields?.length) {\n baseVersionField.rows[i] = versionFields\n }\n }\n\n if (!baseVersionField.rows?.length && modifiedOnly) {\n return null\n }\n } else {\n baseVersionField.fields = buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields: field.fields,\n fieldsPermissions: subFieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel: field.type !== 'row' ? nestingLevel + 1 : nestingLevel,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath: 'name' in field ? path : parentPath,\n parentSchemaPath: schemaPath,\n req,\n selectedLocales,\n versionFromSiblingData: valueFrom as object,\n versionToSiblingData: valueTo as object,\n }).versionFields\n\n if (modifiedOnly && !baseVersionField.fields?.length) {\n return null\n }\n }\n } else if (field.type === 'blocks') {\n baseVersionField.rows = []\n\n const maxLength = Math.max(\n Array.isArray(valueTo) ? valueTo.length : 0,\n Array.isArray(valueFrom) ? valueFrom.length : 0,\n )\n\n for (let i = 0; i < maxLength; i++) {\n const fromRow = (Array.isArray(valueFrom) && valueFrom?.[i]) || {}\n const toRow = (Array.isArray(valueTo) && valueTo?.[i]) || {}\n\n const blockSlugToMatch: string = toRow?.blockType ?? fromRow?.blockType\n const toBlock =\n req.payload.blocks[blockSlugToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === blockSlugToMatch,\n ) as FlattenedBlock | undefined)\n\n let fields = []\n\n if (toRow.blockType === fromRow.blockType) {\n fields = toBlock.fields\n } else {\n const fromBlockSlugToMatch: string = toRow?.blockType ?? fromRow?.blockType\n\n const fromBlock =\n req.payload.blocks[fromBlockSlugToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === fromBlockSlugToMatch,\n ) as FlattenedBlock | undefined)\n\n if (fromBlock) {\n fields = getUniqueListBy<Field>([...toBlock.fields, ...fromBlock.fields], 'name')\n } else {\n fields = toBlock.fields\n }\n }\n\n let blockFieldsPermissions: SanitizedFieldsPermissions = undefined\n\n // fieldPermissions will be set here, as the blocks field has a name\n if (typeof fieldPermissions === 'boolean') {\n blockFieldsPermissions = fieldPermissions\n } else if (typeof fieldPermissions?.blocks === 'boolean') {\n blockFieldsPermissions = fieldPermissions.blocks\n } else {\n const permissionsBlockSpecific = fieldPermissions?.blocks?.[blockSlugToMatch]\n if (typeof permissionsBlockSpecific === 'boolean') {\n blockFieldsPermissions = permissionsBlockSpecific\n } else {\n blockFieldsPermissions = permissionsBlockSpecific?.fields\n }\n }\n\n const versionFields = buildVersionFields({\n clientSchemaMap,\n customDiffComponents,\n entitySlug,\n fields,\n fieldsPermissions: blockFieldsPermissions,\n i18n,\n modifiedOnly,\n nestingLevel: nestingLevel + 1,\n parentIndexPath: 'name' in field ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || ('localized' in field && field.localized),\n parentPath: ('name' in field ? path : parentPath) + '.' + i,\n parentSchemaPath: schemaPath + '.' + toBlock.slug,\n req,\n selectedLocales,\n versionFromSiblingData: fromRow,\n versionToSiblingData: toRow,\n }).versionFields\n\n if (versionFields?.length) {\n baseVersionField.rows[i] = versionFields\n }\n }\n\n if (!baseVersionField.rows?.length && modifiedOnly) {\n return null\n }\n }\n\n const clientDiffProps: FieldDiffClientProps = {\n baseVersionField: {\n ...baseVersionField,\n CustomComponent: undefined,\n },\n /**\n * TODO: Change to valueFrom in 4.0\n */\n comparisonValue: valueFrom,\n /**\n * @deprecated remove in 4.0. Each field should handle its own diffing logic\n */\n diffMethod: 'diffWordsWithSpace',\n field: clientField,\n fieldPermissions:\n typeof fieldPermissions === 'undefined' ? parentFieldsPermissions : fieldPermissions,\n parentIsLocalized,\n\n nestingLevel: nestingLevel ? nestingLevel : undefined,\n /**\n * TODO: Change to valueTo in 4.0\n */\n versionValue: valueTo,\n }\n if (locale) {\n clientDiffProps.locale = locale\n }\n\n const serverDiffProps: FieldDiffServerProps = {\n ...clientDiffProps,\n clientField,\n field,\n i18n,\n req,\n selectedLocales,\n }\n\n baseVersionField.CustomComponent = RenderServerComponent({\n clientProps: clientDiffProps,\n Component: CustomComponent,\n Fallback: DefaultComponent,\n importMap: req.payload.importMap,\n key: 'diff component',\n serverPro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AAe8C,SAAA;IAC5C;;;IAGAgD,YAAA,EAAc7D;EAChB;EACA,IAAIE,MAAA,EAAQ;IACVwD,eAAA,CAAgBxD,MAAM,GAAGA,MAAA;EAC3B;EAEA,MAAM4D,eAAA,GAAwC;IAC5C,GAAGJ,eAAe;IAClB3E,WAAA;IACAL,KAAA;IACAb,IAAA;IACAO,GAAA;IACAC;EACF;EAEAiC,gBAAA,CAAiBS,eAAe,GAAGjE,qBAAA,CAAsB;IACvDiH,WAAA,EAAaL,eAAA;IACbM,SAAA,EAAWjD,eAAA;IACXkD,QAAA,EAAU1C,gBAAA;IACV2C,SAAA,EAAW9F,GAAA,CAAIa,OAAO,CAACiF,SAAS;IAChCC,GAAA,EAAK;IACLC,WAAA,EAAaN;EACf;EAEA,OAAOxD,gBAAA;AACT","ignoreList":[]}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
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?: {
|
|
1
|
+
export function withPayload(nextConfig?: import("next").NextConfig, options?: {
|
|
8
2
|
devBundleServerPackages?: boolean;
|
|
9
|
-
})
|
|
3
|
+
}): import("next").NextConfig;
|
|
10
4
|
export default withPayload;
|
|
11
5
|
//# sourceMappingURL=withPayload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayload.
|
|
1
|
+
{"version":3,"file":"withPayload.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayload.js"],"names":[],"mappings":"AAsBO,yCAJI,OAAO,MAAM,EAAE,UAAU,YAEjC;IAA0B,uBAAuB,GAAzC,OAAO;CAA6F,6BAkN9G"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are
|
|
3
|
+
* imported directly in next.config.mjs files. Since next.config files run before the build process,
|
|
4
|
+
* TypeScript compilation is not available. This ensures compatibility with all templates and
|
|
5
|
+
* user projects regardless of their TypeScript setup.
|
|
6
|
+
*/import { getNextjsVersion, supportsTurbopackExternalizeTransitiveDependencies } from './withPayload.utils.js';
|
|
2
7
|
import { withPayloadLegacy } from './withPayloadLegacy.js';
|
|
3
8
|
const poweredByHeader = {
|
|
4
9
|
key: 'X-Powered-By',
|
|
@@ -17,6 +22,7 @@ export const withPayload = (nextConfig = {}, options = {}) => {
|
|
|
17
22
|
console.warn('Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.');
|
|
18
23
|
env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
|
|
19
24
|
}
|
|
25
|
+
/** @type {import('next').NextConfig} */
|
|
20
26
|
const baseConfig = {
|
|
21
27
|
...nextConfig,
|
|
22
28
|
env,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPayload.js","names":["getNextjsVersion","supportsTurbopackExternalizeTransitiveDependencies","withPayloadLegacy","poweredByHeader","key","value","withPayload","nextConfig","options","nextjsVersion","supportsTurbopackBuild","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","baseConfig","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"sources":["../../src/withPayload/withPayload.ts"],"sourcesContent":["/* eslint-disable no-console */\n/* eslint-disable no-restricted-exports */\nimport type { NextConfig } from 'next'\n\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (\n nextConfig: NextConfig = {},\n options: { devBundleServerPackages?: boolean } = {},\n): NextConfig => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const baseConfig: NextConfig = {\n ...nextConfig,\n env,\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n"],"mappings":"AAAA,gCACA,0CAGA,SACEA,gBAAgB,EAChBC,kDAAkD,QAC7C;AACP,SAASC,iBAAiB,QAAQ;AAElC,MAAMC,eAAA,GAAkB;EACtBC,GAAA,EAAK;EACLC,KAAA,EAAO;AACT;AAEA;;;;;AAKA,OAAO,MAAMC,WAAA,GAAcA,CACzBC,UAAA,GAAyB,CAAC,CAAC,EAC3BC,OAAA,GAAiD,CAAC,CAAC;EAEnD,MAAMC,aAAA,GAAg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/B,sBAAA,EAAwB;IAC3B,OAAOR,iBAAA,CAAkBgB,UAAA;EAC3B,OAAO;IACL,OAAO;MACL,GAAGA,UAAU;MACbO,sBAAA,EAAwB,C,IAClBP,UAAA,CAAWO,sBAAsB,IAAI,EAAE,GAC3C,eACA,mBACA,SACA,UACA;MACA;MACA;IAEJ;EACF;AACF;AAEA,eAAenB,WAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"withPayload.js","names":["getNextjsVersion","supportsTurbopackExternalizeTransitiveDependencies","withPayloadLegacy","poweredByHeader","key","value","withPayload","nextConfig","options","nextjsVersion","supportsTurbopackBuild","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","baseConfig","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"sources":["../../src/withPayload/withPayload.js"],"sourcesContent":["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;GAMA,SACEA,gBAAgB,EAChBC,kDAAkD,QAC7C;AACP,SAASC,iBAAiB,QAAQ;AAElC,MAAMC,eAAA,GAAkB;EACtBC,GAAA,EAAK;EACLC,KAAA,EAAO;AACT;AAEA;;;;;AAKA,OAAO,MAAMC,WAAA,GAAcA,CAACC,UAAA,GAAa,CAAC,CAAC,EAAEC,OAAA,GAAU,CAAC,CAAC;EACvD,MAAMC,aAAA,GAAgBT,gBAAA;EAEtB,MAAMU,sBAAA,GAAyBT,kDAAA,CAAmDQ,aAAA;EAElF,MAAME,GAAA,GAAMJ,UAAA,CAAWI,GAAG,IAAI,CAAC;EAE/B,IAAIJ,UAAA,CAAWK,YAAY,EAAEC,UAAA,EAAYC,OAAA,EAAS;IAChDC,OAAA,CAAQC,IAAI,CACV;IAEFL,GAAA,CAAIM,uCAAuC,GAAG;EAChD;EAEA;EACA,MAAMC,UAAA,GAAa;IACjB,GAAGX,UAAU;IACbI,GAAA;IACAQ,yBAAA,EAA2B;MACzB,IAAIZ,UAAA,CAAWY,yBAAyB,IAAI,CAAC,CAAC;MAC9C,QAAQ,C,IACFZ,UAAA,CAAWY,yBAAyB,GAAG,OAAO,IAAI,EAAE,GACxD,eACA;IAEJ;IACAC,yBA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MAEN,OAAO;QACL,GAAGE,qBAAqB;QACxBC,SAAA,EAAW,C,IACLD,qBAAA,EAAuBC,SAAA,IAAa,EAAE;QAC1C;;;;;;;;QAQA,eACA,mBACA,SACA,UACA,wBACD;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,IAAIjC,UAAA,CAAWkC,QAAQ,EAAE;IACvBvB,UAAA,CAAWP,GAAG,CAAC+B,cAAc,GAAGnC,UAAA,CAAWkC,QAAQ;EACrD;EAEA,IAAI,CAAC/B,sBAAA,EAAwB;IAC3B,OAAOR,iBAAA,CAAkBgB,UAAA;EAC3B,OAAO;IACL,OAAO;MACL,GAAGA,UAAU;MACbO,sBAAA,EAAwB,C,IAClBP,UAAA,CAAWO,sBAAsB,IAAI,EAAE,GAC3C,eACA,mBACA,SACA,UACA;MACA;MACA;IAEJ;EACF;AACF;AAEA,eAAenB,WAAA","ignoreList":[]}
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2012 Functional Software, Inc. dba Sentry
|
|
7
|
-
*
|
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
9
|
-
* this software and associated documentation files (the "Software"), to deal in
|
|
10
|
-
* the Software without restriction, including without limitation the rights to
|
|
11
|
-
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
12
|
-
* of the Software, and to permit persons to whom the Software is furnished to do
|
|
13
|
-
* so, subject to the following conditions:
|
|
14
|
-
*
|
|
15
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
* copies or substantial portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
* SOFTWARE.
|
|
2
|
+
* Parses input into a SemVer interface
|
|
3
|
+
* @param {string} input - string representation of a semver version
|
|
4
|
+
* @returns {SemVer}
|
|
25
5
|
*/
|
|
6
|
+
export function parseSemver(input: string): SemVer;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the version of Next.js installed in the project, or undefined if it cannot be determined.
|
|
9
|
+
* @returns {SemVer | undefined}
|
|
10
|
+
*/
|
|
11
|
+
export function getNextjsVersion(): SemVer | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if the current Next.js version supports Turbopack externalize transitive dependencies.
|
|
14
|
+
* This was introduced in Next.js v16.1.0-canary.3
|
|
15
|
+
* @param {SemVer | undefined} version
|
|
16
|
+
* @returns {boolean}
|
|
17
|
+
*/
|
|
18
|
+
export function supportsTurbopackExternalizeTransitiveDependencies(version: SemVer | undefined): boolean;
|
|
26
19
|
/**
|
|
27
20
|
* Represents Semantic Versioning object
|
|
28
21
|
*/
|
|
29
|
-
type SemVer = {
|
|
22
|
+
export type SemVer = {
|
|
30
23
|
buildmetadata?: string;
|
|
31
24
|
/**
|
|
32
|
-
* undefined if not a canary version
|
|
25
|
+
* - undefined if not a canary version
|
|
33
26
|
*/
|
|
34
27
|
canaryVersion?: number;
|
|
35
28
|
major?: number;
|
|
@@ -37,19 +30,4 @@ type SemVer = {
|
|
|
37
30
|
patch?: number;
|
|
38
31
|
prerelease?: string;
|
|
39
32
|
};
|
|
40
|
-
/**
|
|
41
|
-
* Parses input into a SemVer interface
|
|
42
|
-
* @param input string representation of a semver version
|
|
43
|
-
*/
|
|
44
|
-
export declare function parseSemver(input: string): SemVer;
|
|
45
|
-
/**
|
|
46
|
-
* Returns the version of Next.js installed in the project, or undefined if it cannot be determined.
|
|
47
|
-
*/
|
|
48
|
-
export declare function getNextjsVersion(): SemVer | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Checks if the current Next.js version supports Turbopack externalize transitive dependencies.
|
|
51
|
-
* This was introduced in Next.js v16.1.0-canary.3
|
|
52
|
-
*/
|
|
53
|
-
export declare function supportsTurbopackExternalizeTransitiveDependencies(version: SemVer | undefined): boolean;
|
|
54
|
-
export {};
|
|
55
33
|
//# sourceMappingURL=withPayload.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPayload.utils.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayload.utils.
|
|
1
|
+
{"version":3,"file":"withPayload.utils.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayload.utils.js"],"names":[],"mappings":"AAqDA;;;;GAIG;AACH,mCAHW,MAAM,GACJ,MAAM,CAqBlB;AAED;;;GAGG;AACH,oCAFa,MAAM,GAAG,SAAS,CAyB9B;AAED;;;;;GAKG;AACH,4EAHW,MAAM,GAAG,SAAS,GAChB,OAAO,CAqCnB;;;;;oBA5Ga,MAAM;;;;oBACN,MAAM;YACN,MAAM;YACN,MAAM;YACN,MAAM;iBACN,MAAM"}
|
|
@@ -1,37 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This was taken and modified from https://github.com/getsentry/sentry-javascript/blob/15256034ee8150a5b7dcb97d23eca1a5486f0cae/packages/nextjs/src/config/util.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2012 Functional Software, Inc. dba Sentry
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
9
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
10
|
+
* the Software without restriction, including without limitation the rights to
|
|
11
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
12
|
+
* of the Software, and to permit persons to whom the Software is furnished to do
|
|
13
|
+
* so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*/import { readFileSync } from 'fs';
|
|
26
26
|
import { fileURLToPath } from 'url';
|
|
27
|
+
/**
|
|
28
|
+
* @param {string | undefined} input
|
|
29
|
+
* @returns {number}
|
|
30
|
+
*/
|
|
27
31
|
function _parseInt(input) {
|
|
28
32
|
return parseInt(input || '', 10);
|
|
29
33
|
}
|
|
30
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Represents Semantic Versioning object
|
|
36
|
+
* @typedef {Object} SemVer
|
|
37
|
+
* @property {string} [buildmetadata]
|
|
38
|
+
* @property {number} [canaryVersion] - undefined if not a canary version
|
|
39
|
+
* @property {number} [major]
|
|
40
|
+
* @property {number} [minor]
|
|
41
|
+
* @property {number} [patch]
|
|
42
|
+
* @property {string} [prerelease]
|
|
43
|
+
*/ // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
|
31
44
|
const SEMVER_REGEXP = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i;
|
|
32
45
|
/**
|
|
33
46
|
* Parses input into a SemVer interface
|
|
34
|
-
* @param input string representation of a semver version
|
|
47
|
+
* @param {string} input - string representation of a semver version
|
|
48
|
+
* @returns {SemVer}
|
|
35
49
|
*/
|
|
36
50
|
export function parseSemver(input) {
|
|
37
51
|
const match = input.match(SEMVER_REGEXP) || [];
|
|
@@ -51,10 +65,11 @@ export function parseSemver(input) {
|
|
|
51
65
|
}
|
|
52
66
|
/**
|
|
53
67
|
* Returns the version of Next.js installed in the project, or undefined if it cannot be determined.
|
|
68
|
+
* @returns {SemVer | undefined}
|
|
54
69
|
*/
|
|
55
70
|
export function getNextjsVersion() {
|
|
56
71
|
try {
|
|
57
|
-
let pkgPath;
|
|
72
|
+
/** @type {string} */let pkgPath;
|
|
58
73
|
// Check if we're in ESM or CJS environment
|
|
59
74
|
if (typeof import.meta?.resolve === 'function') {
|
|
60
75
|
// ESM environment - use import.meta.resolve
|
|
@@ -76,6 +91,8 @@ export function getNextjsVersion() {
|
|
|
76
91
|
/**
|
|
77
92
|
* Checks if the current Next.js version supports Turbopack externalize transitive dependencies.
|
|
78
93
|
* This was introduced in Next.js v16.1.0-canary.3
|
|
94
|
+
* @param {SemVer | undefined} version
|
|
95
|
+
* @returns {boolean}
|
|
79
96
|
*/
|
|
80
97
|
export function supportsTurbopackExternalizeTransitiveDependencies(version) {
|
|
81
98
|
if (!version) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPayload.utils.js","names":["readFileSync","fileURLToPath","_parseInt","input","parseInt","SEMVER_REGEXP","parseSemver","match","major","minor","patch","prerelease","canaryVersion","startsWith","split","undefined","buildmetadata","isNaN","getNextjsVersion","pkgPath","import","meta","resolve","pkgUrl","require","pkgJson","JSON","parse","version","e","console","error","supportsTurbopackExternalizeTransitiveDependencies"],"sources":["../../src/withPayload/withPayload.utils.
|
|
1
|
+
{"version":3,"file":"withPayload.utils.js","names":["readFileSync","fileURLToPath","_parseInt","input","parseInt","SEMVER_REGEXP","parseSemver","match","major","minor","patch","prerelease","canaryVersion","startsWith","split","undefined","buildmetadata","isNaN","getNextjsVersion","pkgPath","import","meta","resolve","pkgUrl","require","pkgJson","JSON","parse","version","e","console","error","supportsTurbopackExternalizeTransitiveDependencies"],"sources":["../../src/withPayload/withPayload.utils.js"],"sourcesContent":[" \n/**\n * This was taken and modified from https://github.com/getsentry/sentry-javascript/blob/15256034ee8150a5b7dcb97d23eca1a5486f0cae/packages/nextjs/src/config/util.ts\n *\n * MIT License\n *\n * Copyright (c) 2012 Functional Software, Inc. dba Sentry\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n * of the Software, and to permit persons to whom the Software is furnished to do\n * so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { readFileSync } from 'fs'\nimport { fileURLToPath } from 'url'\n\n/**\n * @param {string | undefined} input\n * @returns {number}\n */\nfunction _parseInt(input) {\n return parseInt(input || '', 10)\n}\n\n/**\n * Represents Semantic Versioning object\n * @typedef {Object} SemVer\n * @property {string} [buildmetadata]\n * @property {number} [canaryVersion] - undefined if not a canary version\n * @property {number} [major]\n * @property {number} [minor]\n * @property {number} [patch]\n * @property {string} [prerelease]\n */\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$/i\n\n/**\n * Parses input into a SemVer interface\n * @param {string} input - string representation of a semver version\n * @returns {SemVer}\n */\nexport function parseSemver(input) {\n const match = input.match(SEMVER_REGEXP) || []\n const major = _parseInt(match[1])\n const minor = _parseInt(match[2])\n const patch = _parseInt(match[3])\n\n const prerelease = match[4]\n const canaryVersion = prerelease?.startsWith('canary.')\n ? parseInt(prerelease.split('.')[1] || '0', 10)\n : undefined\n\n return {\n buildmetadata: match[5],\n canaryVersion,\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n }\n}\n\n/**\n * Returns the version of Next.js installed in the project, or undefined if it cannot be determined.\n * @returns {SemVer | undefined}\n */\nexport function getNextjsVersion() {\n try {\n /** @type {string} */\n let pkgPath\n\n // Check if we're in ESM or CJS environment\n if (typeof import.meta?.resolve === 'function') {\n // ESM environment - use import.meta.resolve\n const pkgUrl = import.meta.resolve('next/package.json')\n // Use fileURLToPath for proper cross-platform path handling (Windows, macOS, Linux)\n // new URL().pathname returns '/C:/path' on Windows which causes path resolution issues\n pkgPath = fileURLToPath(pkgUrl)\n } else {\n // CJS environment - use require.resolve\n pkgPath = require.resolve('next/package.json')\n }\n\n const pkgJson = JSON.parse(readFileSync(pkgPath, 'utf8'))\n return parseSemver(pkgJson.version)\n } catch (e) {\n console.error('Payload: Error getting Next.js version', e)\n return undefined\n }\n}\n\n/**\n * Checks if the current Next.js version supports Turbopack externalize transitive dependencies.\n * This was introduced in Next.js v16.1.0-canary.3\n * @param {SemVer | undefined} version\n * @returns {boolean}\n */\nexport function supportsTurbopackExternalizeTransitiveDependencies(version) {\n if (!version) {\n return false\n }\n\n const { canaryVersion, major, minor, patch } = version\n\n if (major === undefined || minor === undefined) {\n return false\n }\n\n if (major > 16) {\n return true\n }\n\n if (major === 16) {\n if (minor > 1) {\n return true\n }\n if (minor === 1) {\n // 16.1.1+ and canaries support this feature\n if (patch > 0) {\n return true\n }\n if (canaryVersion !== undefined) {\n // 16.1.0-canary.3+\n return canaryVersion >= 3\n } else {\n // Next.js 16.1.0\n return true\n }\n }\n }\n\n return false\n}\n"],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;GA0BA,SAASA,YAAY,QAAQ;AAC7B,SAASC,aAAa,QAAQ;AAE9B;;;;AAIA,SAASC,UAAUC,KAAK;EACtB,OAAOC,QAAA,CAASD,KAAA,IAAS,IAAI;AAC/B;AAEA;;;;;;;;;GAAA,CAWA;AACA,MAAME,aAAA,GACJ;AAEF;;;;;AAKA,OAAO,SAASC,YAAYH,KAAK;EAC/B,MAAMI,KAAA,GAAQJ,KAAA,CAAMI,KAAK,CAACF,aAAA,KAAkB,EAAE;EAC9C,MAAMG,KAAA,GAAQN,SAAA,CAAUK,KAAK,CAAC,EAAE;EAChC,MAAME,KAAA,GAAQP,SAAA,CAAUK,KAAK,CAAC,EAAE;EAChC,MAAMG,KAAA,GAAQR,SAAA,CAAUK,KAAK,CAAC,EAAE;EAEhC,MAAMI,UAAA,GAAaJ,KAAK,CAAC,EAAE;EAC3B,MAAMK,aAAA,GAAgBD,UAAA,EAAYE,UAAA,CAAW,aACzCT,QAAA,CAASO,UAAA,CAAWG,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,KAAK,MAC1CC,SAAA;EAEJ,OAAO;IACLC,aAAA,EAAeT,KAAK,CAAC,EAAE;IACvBK,aAAA;IACAJ,KAAA,EAAOS,KAAA,CAAMT,KAAA,IAASO,SAAA,GAAYP,KAAA;IAClCC,KAAA,EAAOQ,KAAA,CAAMR,KAAA,IAASM,SAAA,GAAYN,KAAA;IAClCC,KAAA,EAAOO,KAAA,CAAMP,KAAA,IAASK,SAAA,GAAYL,KAAA;IAClCC,UAAA,EAAYJ,KAAK,CAAC;EACpB;AACF;AAEA;;;;AAIA,OAAO,SAASW,iBAAA;EACd,IAAI;IACF,qBACA,IAAIC,OAAA;IAEJ;IACA,IAAI,O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
-
export declare const withPayloadLegacy: (nextConfig?: NextConfig) => NextConfig;
|
|
1
|
+
export function withPayloadLegacy(nextConfig?: import("next").NextConfig): import("next").NextConfig;
|
|
6
2
|
//# sourceMappingURL=withPayloadLegacy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPayloadLegacy.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayloadLegacy.
|
|
1
|
+
{"version":3,"file":"withPayloadLegacy.d.ts","sourceRoot":"","sources":["../../src/withPayload/withPayloadLegacy.js"],"names":[],"mappings":"AAKO,+CAHI,OAAO,MAAM,EAAE,UAAU,GACvB,OAAO,MAAM,EAAE,UAAU,CA+DrC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Applies config options required to support Next.js versions before 16.1.0 and 16.1.0-canary.3.
|
|
3
|
+
* @param {import('next').NextConfig} nextConfig
|
|
4
|
+
* @returns {import('next').NextConfig}
|
|
5
|
+
*/export const withPayloadLegacy = (nextConfig = {}) => {
|
|
4
6
|
if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {
|
|
5
7
|
// 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.
|
|
6
8
|
// We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991
|
|
@@ -30,6 +32,7 @@
|
|
|
30
32
|
if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {
|
|
31
33
|
throw new Error('Your Next.js version does not support using Turbopack for production builds. The *minimum* Next.js version required for Turbopack Builds is 16.1.0. Please upgrade to the latest supported Next.js version to resolve this error.');
|
|
32
34
|
}
|
|
35
|
+
/** @type {import('next').NextConfig} */
|
|
33
36
|
const toReturn = {
|
|
34
37
|
...nextConfig,
|
|
35
38
|
serverExternalPackages: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPayloadLegacy.js","names":["withPayloadLegacy","nextConfig","process","env","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","turbopackConfigWarningText","consoleWarn","console","warn","args","includes","hasTurbopackConfigWarning","isBuild","NODE_ENV","isTurbopackNextjs15","TURBOPACK","isTurbopackNextjs16","Error","toReturn","serverExternalPackages"],"sources":["../../src/withPayload/withPayloadLegacy.
|
|
1
|
+
{"version":3,"file":"withPayloadLegacy.js","names":["withPayloadLegacy","nextConfig","process","env","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","turbopackConfigWarningText","consoleWarn","console","warn","args","includes","hasTurbopackConfigWarning","isBuild","NODE_ENV","isTurbopackNextjs15","TURBOPACK","isTurbopackNextjs16","Error","toReturn","serverExternalPackages"],"sources":["../../src/withPayload/withPayloadLegacy.js"],"sourcesContent":["/**\n * Applies config options required to support Next.js versions before 16.1.0 and 16.1.0-canary.3.\n * @param {import('next').NextConfig} nextConfig\n * @returns {import('next').NextConfig}\n */\nexport const withPayloadLegacy = (nextConfig = {}) => {\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n // TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.\n // We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991\n const turbopackWarningText =\n 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\\nTry to install it into the project directory by running'\n\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const turbopackConfigWarningText = \"Unrecognized key(s) in object: 'turbopack'\"\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n // Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const hasTurbopackConfigWarning =\n (typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText))\n\n if (hasTurbopackConfigWarning) {\n consoleWarn(...args)\n consoleWarn(\n 'Payload: You can safely ignore the \"Invalid next.config\" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to the latest supported Next.js version to resolve this warning.',\n )\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const isBuild = process.env.NODE_ENV === 'production'\n const isTurbopackNextjs15 = process.env.TURBOPACK === '1'\n const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto'\n\n if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {\n throw new Error(\n 'Your Next.js version does not support using Turbopack for production builds. The *minimum* Next.js version required for Turbopack Builds is 16.1.0. Please upgrade to the latest supported Next.js version to resolve this error.',\n )\n }\n\n /** @type {import('next').NextConfig} */\n const toReturn = {\n ...nextConfig,\n serverExternalPackages: [\n // serverExternalPackages = webpack.externals, but with turbopack support and an additional check\n // for whether the package is resolvable from the project root\n ...(nextConfig.serverExternalPackages || []),\n // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.\n '@sentry/nextjs',\n ],\n }\n\n return toReturn\n}\n"],"mappings":"AAAA;;;;GAKA,OAAO,MAAMA,iBAAA,GAAoBA,CAACC,UAAA,GAAa,CAAC,CAAC;EAC/C,IAAIC,OAAA,CAAQC,GAAG,CAACC,gCAAgC,KAAK,SAAS;IAC5D;IACA;IACA,MAAMC,oBAAA,GACJ;IAEF;IACA,MAAMC,0BAAA,GAA6B;IAEnC,MAAMC,WAAA,GAAcC,OAAA,CAAQC,IAAI;IAChCD,OAAA,CAAQC,IAAI,GAAG,CAAC,GAAGC,IAAA;MACjB;MACA,IACE,OAAQA,IAAI,CAAC,EAAE,KAAK,YAAYA,IAAI,CAAC,EAAE,CAACC,QAAQ,CAACN,oBAAA,KAChD,OAAOK,IAAI,CAAC,EAAE,KAAK,YAAYA,IAAI,CA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