@payloadcms/codemod 4.0.0-canary.37 → 4.0.0-canary.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +6 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.help.d.ts +4 -0
  4. package/dist/cli.help.d.ts.map +1 -0
  5. package/dist/cli.help.js +29 -0
  6. package/dist/cli.help.js.map +1 -0
  7. package/dist/cli.js +8 -0
  8. package/dist/cli.js.map +1 -1
  9. package/dist/cli.parseFlags.d.ts +1 -0
  10. package/dist/cli.parseFlags.d.ts.map +1 -1
  11. package/dist/cli.parseFlags.js +6 -0
  12. package/dist/cli.parseFlags.js.map +1 -1
  13. package/dist/registry.d.ts.map +1 -1
  14. package/dist/registry.js +8 -0
  15. package/dist/registry.js.map +1 -1
  16. package/dist/runbook/payload-v4-upgrade.md +2 -2
  17. package/dist/runbook/v4.mdx +304 -20
  18. package/dist/transforms/migrate-aliased-exports/index.d.ts.map +1 -1
  19. package/dist/transforms/migrate-aliased-exports/index.js +4 -2
  20. package/dist/transforms/migrate-aliased-exports/index.js.map +1 -1
  21. package/dist/transforms/migrate-aliased-exports/request.input.js +6 -0
  22. package/dist/transforms/migrate-aliased-exports/request.input.js.map +1 -0
  23. package/dist/transforms/migrate-aliased-exports/request.output.js +5 -0
  24. package/dist/transforms/migrate-aliased-exports/request.output.js.map +1 -0
  25. package/dist/transforms/migrate-authorship-default/already-set.input.js +15 -0
  26. package/dist/transforms/migrate-authorship-default/already-set.input.js.map +1 -0
  27. package/dist/transforms/migrate-authorship-default/already-set.output.js +15 -0
  28. package/dist/transforms/migrate-authorship-default/already-set.output.js.map +1 -0
  29. package/dist/transforms/migrate-authorship-default/basic.input.js +16 -0
  30. package/dist/transforms/migrate-authorship-default/basic.input.js.map +1 -0
  31. package/dist/transforms/migrate-authorship-default/basic.output.js +18 -0
  32. package/dist/transforms/migrate-authorship-default/basic.output.js.map +1 -0
  33. package/dist/transforms/migrate-authorship-default/build-config.input.js +32 -0
  34. package/dist/transforms/migrate-authorship-default/build-config.input.js.map +1 -0
  35. package/dist/transforms/migrate-authorship-default/build-config.output.js +35 -0
  36. package/dist/transforms/migrate-authorship-default/build-config.output.js.map +1 -0
  37. package/dist/transforms/migrate-authorship-default/globals.input.js +16 -0
  38. package/dist/transforms/migrate-authorship-default/globals.input.js.map +1 -0
  39. package/dist/transforms/migrate-authorship-default/globals.output.js +17 -0
  40. package/dist/transforms/migrate-authorship-default/globals.output.js.map +1 -0
  41. package/dist/transforms/migrate-authorship-default/index.d.ts +11 -0
  42. package/dist/transforms/migrate-authorship-default/index.d.ts.map +1 -0
  43. package/dist/transforms/migrate-authorship-default/index.js +141 -0
  44. package/dist/transforms/migrate-authorship-default/index.js.map +1 -0
  45. package/dist/transforms/migrate-authorship-default/non-matching.input.js +18 -0
  46. package/dist/transforms/migrate-authorship-default/non-matching.input.js.map +1 -0
  47. package/dist/transforms/migrate-authorship-default/non-matching.output.js +18 -0
  48. package/dist/transforms/migrate-authorship-default/non-matching.output.js.map +1 -0
  49. package/dist/transforms/migrate-authorship-default/satisfies.input.js +11 -0
  50. package/dist/transforms/migrate-authorship-default/satisfies.input.js.map +1 -0
  51. package/dist/transforms/migrate-authorship-default/satisfies.output.js +13 -0
  52. package/dist/transforms/migrate-authorship-default/satisfies.output.js.map +1 -0
  53. package/dist/transforms/migrate-field-component-types/basic.input.js +8 -0
  54. package/dist/transforms/migrate-field-component-types/basic.input.js.map +1 -0
  55. package/dist/transforms/migrate-field-component-types/basic.output.js +8 -0
  56. package/dist/transforms/migrate-field-component-types/basic.output.js.map +1 -0
  57. package/dist/transforms/migrate-field-component-types/index.d.ts +3 -0
  58. package/dist/transforms/migrate-field-component-types/index.d.ts.map +1 -0
  59. package/dist/transforms/migrate-field-component-types/index.js +620 -0
  60. package/dist/transforms/migrate-field-component-types/index.js.map +1 -0
  61. package/dist/transforms/migrate-payload-request-creation/aliases.input.js +8 -0
  62. package/dist/transforms/migrate-payload-request-creation/aliases.input.js.map +1 -0
  63. package/dist/transforms/migrate-payload-request-creation/aliases.output.js +31 -0
  64. package/dist/transforms/migrate-payload-request-creation/aliases.output.js.map +1 -0
  65. package/dist/transforms/migrate-payload-request-creation/collision.input.js +9 -0
  66. package/dist/transforms/migrate-payload-request-creation/collision.input.js.map +1 -0
  67. package/dist/transforms/migrate-payload-request-creation/comments.input.js +9 -0
  68. package/dist/transforms/migrate-payload-request-creation/comments.input.js.map +1 -0
  69. package/dist/transforms/migrate-payload-request-creation/comments.output.js +34 -0
  70. package/dist/transforms/migrate-payload-request-creation/comments.output.js.map +1 -0
  71. package/dist/transforms/migrate-payload-request-creation/empty.input.js +5 -0
  72. package/dist/transforms/migrate-payload-request-creation/empty.input.js.map +1 -0
  73. package/dist/transforms/migrate-payload-request-creation/empty.output.js +7 -0
  74. package/dist/transforms/migrate-payload-request-creation/empty.output.js.map +1 -0
  75. package/dist/transforms/migrate-payload-request-creation/evaluation-order.input.js +10 -0
  76. package/dist/transforms/migrate-payload-request-creation/evaluation-order.input.js.map +1 -0
  77. package/dist/transforms/migrate-payload-request-creation/expression.input.js +8 -0
  78. package/dist/transforms/migrate-payload-request-creation/expression.input.js.map +1 -0
  79. package/dist/transforms/migrate-payload-request-creation/expression.output.js +8 -0
  80. package/dist/transforms/migrate-payload-request-creation/expression.output.js.map +1 -0
  81. package/dist/transforms/migrate-payload-request-creation/getters.input.js +52 -0
  82. package/dist/transforms/migrate-payload-request-creation/getters.input.js.map +1 -0
  83. package/dist/transforms/migrate-payload-request-creation/index.d.ts +3 -0
  84. package/dist/transforms/migrate-payload-request-creation/index.d.ts.map +1 -0
  85. package/dist/transforms/migrate-payload-request-creation/index.js +236 -0
  86. package/dist/transforms/migrate-payload-request-creation/index.js.map +1 -0
  87. package/dist/transforms/migrate-payload-request-creation/internal.input.js +6 -0
  88. package/dist/transforms/migrate-payload-request-creation/internal.input.js.map +1 -0
  89. package/dist/transforms/migrate-payload-request-creation/internal.output.js +6 -0
  90. package/dist/transforms/migrate-payload-request-creation/internal.output.js.map +1 -0
  91. package/dist/transforms/migrate-payload-request-creation/non-matching.input.js +5 -0
  92. package/dist/transforms/migrate-payload-request-creation/non-matching.input.js.map +1 -0
  93. package/dist/transforms/migrate-payload-request-creation/populated.input.js +7 -0
  94. package/dist/transforms/migrate-payload-request-creation/populated.input.js.map +1 -0
  95. package/dist/transforms/migrate-payload-request-creation/populated.output.js +30 -0
  96. package/dist/transforms/migrate-payload-request-creation/populated.output.js.map +1 -0
  97. package/dist/transforms/migrate-payload-request-creation/shadowed.input.js +7 -0
  98. package/dist/transforms/migrate-payload-request-creation/shadowed.input.js.map +1 -0
  99. package/dist/transforms/migrate-payload-request-creation/shadowed.output.js +9 -0
  100. package/dist/transforms/migrate-payload-request-creation/shadowed.output.js.map +1 -0
  101. package/dist/transforms/migrate-payload-request-creation/shorthand.input.js +12 -0
  102. package/dist/transforms/migrate-payload-request-creation/shorthand.input.js.map +1 -0
  103. package/dist/transforms/migrate-payload-request-creation/shorthand.output.js +12 -0
  104. package/dist/transforms/migrate-payload-request-creation/shorthand.output.js.map +1 -0
  105. package/dist/transforms/migrate-payload-request-creation/unsupported.input.js +9 -0
  106. package/dist/transforms/migrate-payload-request-creation/unsupported.input.js.map +1 -0
  107. package/dist/transforms/migrate-sharp-to-transformer/basic.input.js +28 -0
  108. package/dist/transforms/migrate-sharp-to-transformer/basic.input.js.map +1 -0
  109. package/dist/transforms/migrate-sharp-to-transformer/basic.output.js +39 -0
  110. package/dist/transforms/migrate-sharp-to-transformer/basic.output.js.map +1 -0
  111. package/dist/transforms/migrate-sharp-to-transformer/existing-transformers.input.js +27 -0
  112. package/dist/transforms/migrate-sharp-to-transformer/existing-transformers.input.js.map +1 -0
  113. package/dist/transforms/migrate-sharp-to-transformer/existing-transformers.output.js +33 -0
  114. package/dist/transforms/migrate-sharp-to-transformer/existing-transformers.output.js.map +1 -0
  115. package/dist/transforms/migrate-sharp-to-transformer/index.d.ts +3 -0
  116. package/dist/transforms/migrate-sharp-to-transformer/index.d.ts.map +1 -0
  117. package/dist/transforms/migrate-sharp-to-transformer/index.js +430 -0
  118. package/dist/transforms/migrate-sharp-to-transformer/index.js.map +1 -0
  119. package/dist/transforms/migrate-sharp-to-transformer/no-match.input.js +11 -0
  120. package/dist/transforms/migrate-sharp-to-transformer/no-match.input.js.map +1 -0
  121. package/dist/transforms/migrate-sharp-to-transformer/no-match.output.js +11 -0
  122. package/dist/transforms/migrate-sharp-to-transformer/no-match.output.js.map +1 -0
  123. package/dist/transforms/remove-storage-always-insert-fields/index.d.ts.map +1 -1
  124. package/dist/transforms/remove-storage-always-insert-fields/index.js +4 -0
  125. package/dist/transforms/remove-storage-always-insert-fields/index.js.map +1 -1
  126. package/dist/transforms/rename-experimental-table-feature/index.d.ts.map +1 -1
  127. package/dist/transforms/rename-experimental-table-feature/index.js +7 -1
  128. package/dist/transforms/rename-experimental-table-feature/index.js.map +1 -1
  129. package/dist/upgrade/rewritePackageJson.d.ts.map +1 -1
  130. package/dist/upgrade/rewritePackageJson.js +52 -11
  131. package/dist/upgrade/rewritePackageJson.js.map +1 -1
  132. package/dist/utils/project.d.ts +7 -1
  133. package/dist/utils/project.d.ts.map +1 -1
  134. package/dist/utils/project.js +20 -7
  135. package/dist/utils/project.js.map +1 -1
  136. package/package.json +2 -2
@@ -22,6 +22,55 @@ The codemod is idempotent and safe to run on a partially-migrated project.
22
22
 
23
23
  ## Breaking Changes
24
24
 
25
+ ### Payload request creation is consolidated
26
+
27
+ Payload request creation now uses `createPayloadRequest` for local contexts and `createPayloadRequestFromWebRequest` to convert a Web `Request`. Admin context setup is exposed as `initAdminContext`.
28
+
29
+ | Old name | New name |
30
+ | --------------------------------------- | ------------------------------------------- |
31
+ | `createLocalReq` | `createPayloadRequest` |
32
+ | `CreateLocalReqOptions` (internal type) | `Omit<CreatePayloadRequestArgs, 'payload'>` |
33
+ | `createPayloadRequest` | `createPayloadRequestFromWebRequest` |
34
+ | `initReq` | `initAdminContext` |
35
+ | `InitReqArgs` | `InitAdminContextArgs` |
36
+ | `InitReqResult` | `AdminContext` |
37
+ | `InitReqCache` | `AdminContextCache` |
38
+ | `InitReqPartialResult` | `PartialAdminContext` |
39
+
40
+ `initAdminContext` and its cache types are primarily contracts for framework adapters. Custom Root layout adapters must rename their injected `initReq` callback to `initAdminContext`.
41
+
42
+ Local request creation now takes a single object argument containing `payload`. For a request without options:
43
+
44
+ ```diff
45
+ -import { createLocalReq } from 'payload'
46
+ +import { createPayloadRequest } from 'payload'
47
+
48
+ -const req = await createLocalReq({}, payload)
49
+ +const req = await createPayloadRequest({ payload })
50
+ ```
51
+
52
+ `CreatePayloadRequestArgs` is exported from `payload` and requires `payload`. Options-only values should use `Omit<CreatePayloadRequestArgs, 'payload'>`. The old `CreateLocalReqOptions` type was declared in the internal request utility, not exported from the package root; relative/private imports of that type require manual migration. The codemod handles an existing named import of that type only when its source is `payload`.
53
+
54
+ Web request conversion uses its new role-specific name:
55
+
56
+ ```diff
57
+ -import { createPayloadRequest } from 'payload'
58
+ +import { createPayloadRequestFromWebRequest } from 'payload'
59
+
60
+ -const req = await createPayloadRequest({ config, request })
61
+ +const req = await createPayloadRequestFromWebRequest({ config, request })
62
+ ```
63
+
64
+ #### Codemod
65
+
66
+ To migrate automatically, there's a codemod for this change available by running:
67
+
68
+ ```bash
69
+ npx @payloadcms/codemod --transform migrate-payload-request-creation
70
+ ```
71
+
72
+ Automatic call migration requires a plain identifier payload argument and either `{}` or an initialized local `const` options identifier. The options type must expose all seven old option properties, or be `any`. For that identifier form, the generated argument captures payload first and uses forwarding getters for `context`, `depth`, `fallbackLocale`, `locale`, `req`, `urlSuffix`, and `user`. This preserves inherited getters, their read order, and rejected promises from throwing getters without reading unrelated properties. Complex expressions, mutable/unresolved options bindings, narrow option types, collisions, and unsupported type usages are left unchanged with notes for manual migration.
73
+
25
74
  ### JWT authentication is versioned without moving token data
26
75
 
27
76
  Payload 4 keeps the decoded JWT payload flat, so integrations can continue reading `id`, `collection`, `sid`, `email`, and fields selected by `saveToJWT` from the same paths as Payload 3.
@@ -107,6 +156,31 @@ Run a typecheck after the codemod. Three patterns it cannot resolve:
107
156
 
108
157
  `payload.jobs.queue`, `run`, `runByID`, `cancel`, and `cancelByID` now also default `overrideAccess` to `false`. The option remains optional, but omitting it runs the corresponding `jobs.access.queue`, `jobs.access.run`, or `jobs.access.cancel` function. The codemod adds `overrideAccess: true` to these calls—including zero-argument `payload.jobs.run()` calls—to preserve Payload 3 behavior for review.
109
158
 
159
+ ### On-demand validation adds a `validate` operation
160
+
161
+ The `Operation` type now includes `validate`. The `operation` argument for collection, global, and field `beforeValidate` and `beforeChange` hooks also includes `validate`.
162
+
163
+ On-demand validation runs these hooks without saving the candidate. Update exhaustive operation checks and skip external side effects that should only run during `create` or `update`:
164
+
165
+ ```ts
166
+ import type { CollectionBeforeChangeHook } from 'payload'
167
+
168
+ const syncCustomer: CollectionBeforeChangeHook = async ({
169
+ data,
170
+ operation,
171
+ }) => {
172
+ if (operation === 'validate') {
173
+ return data
174
+ }
175
+
176
+ await syncCustomerWithStripe(data)
177
+
178
+ return data
179
+ }
180
+ ```
181
+
182
+ Sanitized collection and global access types now require a `validate` key. Payload supplies this key during configuration sanitization and uses `update` access by default. Code that constructs a sanitized access object directly must add the key.
183
+
110
184
  ### Collection and Global Access Control callbacks receive `slug`
111
185
 
112
186
  Collection and Global Access Control callback arguments now include the document's `slug`. This additive property is unlikely to affect most projects, but code that manually invokes access callbacks or `executeAccess` must now pass `slug`. Code that validates, enumerates, or compares the exact callback argument shape may also need updating.
@@ -301,6 +375,39 @@ export const Posts: CollectionConfig = {
301
375
  }
302
376
  ```
303
377
 
378
+ ### Authorship (`createdBy` / `updatedBy`) is now enabled by default
379
+
380
+ Collections and globals now track authorship by default: Payload injects `createdBy` and `updatedBy` polymorphic relationship fields (related to every auth-enabled collection) and stamps them from `req.user` on each write. Previously there was no authorship tracking; you now opt out with `authorship: false`.
381
+
382
+ **What changes:**
383
+
384
+ - Every non-internal collection and global gains `createdBy` and `updatedBy` when your config has at least one auth collection. On SQL adapters this adds relationship rows (stored in each entity's `_rels` table), so existing projects need a database migration. In development the schema is pushed automatically; in production, generate a migration with `payload migrate:create` and run `payload migrate`. Existing documents are backfilled with `null`.
385
+ - `createdBy` is only derived on a document's first write, so editing a document whose `createdBy` is `null` (for example a migrated or anonymously created document) does not backfill the editor as the creator.
386
+ - Payload's internal system collections and globals are excluded automatically: `payload-jobs`, `payload-jobs-stats`, `payload-preferences`, `payload-locked-documents`, `payload-migrations`, `payload-query-presets`, and the KV collection.
387
+
388
+ **Plugins:** plugin-injected collections also receive authorship unless the plugin opts out. In this release:
389
+
390
+ - **Opted out** (no authorship): `@payloadcms/plugin-search`, `@payloadcms/payload-cloud`, and all `@payloadcms/plugin-ecommerce` collections.
391
+ - **Kept on** (they gain `createdBy` / `updatedBy`): `@payloadcms/plugin-redirects`, `@payloadcms/plugin-form-builder` (forms and form submissions), and `@payloadcms/plugin-import-export` (imports and exports). Existing projects using these plugins on a SQL adapter need a migration for those collections too. To opt one out, set `authorship: false` through that plugin's collection-override option.
392
+
393
+ **To opt out for an existing collection or global:**
394
+
395
+ ```diff
396
+ export const Posts: CollectionConfig = {
397
+ slug: 'posts',
398
+ fields: [],
399
+ + authorship: false,
400
+ }
401
+ ```
402
+
403
+ **A codemod is available** to preserve the previous behaviour:
404
+
405
+ ```bash
406
+ npx @payloadcms/codemod --transform migrate-authorship-default
407
+ ```
408
+
409
+ `migrate-authorship-default` adds `authorship: false` to every `CollectionConfig` and `GlobalConfig` in your source that does not already set `authorship`, so your own collections have zero schema changes. It only rewrites your config files — it cannot reach plugin-injected collections, so any plugin that keeps authorship on (above) still gains the fields and requires a migration (or an explicit `authorship: false` override).
410
+
304
411
  ### List View Select API is now the default
305
412
 
306
413
  The `admin.enableListViewSelectAPI` Collection Config property has been removed. The List View now always uses the [Select API](../queries/select) to query only the active columns, which was previously opt-in.
@@ -396,20 +503,20 @@ Several types and utilities that were re-exported from `@payloadcms/ui` and `@pa
396
503
 
397
504
  **Pass-through re-exports** — same name, new source:
398
505
 
399
- | Symbol | Old source | New source |
400
- | ----------------------------- | ---------------------------- | ---------------- |
401
- | `Column` | `@payloadcms/ui` | `payload` |
402
- | `ListViewSlots` | `@payloadcms/ui` | `payload` |
403
- | `ListViewClientProps` | `@payloadcms/ui` | `payload` |
404
- | `EntityType` | `@payloadcms/ui/shared` | `payload/shared` |
405
- | `formatAdminURL` | `@payloadcms/ui/shared` | `payload/shared` |
406
- | `mergeListSearchAndWhere` | `@payloadcms/ui/shared` | `payload/shared` |
407
- | `mergeHeaders` | `@payloadcms/next/utilities` | `payload` |
408
- | `headersWithCors` | `@payloadcms/next/utilities` | `payload` |
409
- | `createPayloadRequest` | `@payloadcms/next/utilities` | `payload` |
410
- | `addDataAndFileToRequest` | `@payloadcms/next/utilities` | `payload` |
411
- | `sanitizeLocales` | `@payloadcms/next/utilities` | `payload` |
412
- | `addLocalesToRequestFromData` | `@payloadcms/next/utilities` | `payload` |
506
+ | Symbol | Old source | New source |
507
+ | ----------------------------- | ---------------------------- | ------------------------------------------------- |
508
+ | `Column` | `@payloadcms/ui` | `payload` |
509
+ | `ListViewSlots` | `@payloadcms/ui` | `payload` |
510
+ | `ListViewClientProps` | `@payloadcms/ui` | `payload` |
511
+ | `EntityType` | `@payloadcms/ui/shared` | `payload/shared` |
512
+ | `formatAdminURL` | `@payloadcms/ui/shared` | `payload/shared` |
513
+ | `mergeListSearchAndWhere` | `@payloadcms/ui/shared` | `payload/shared` |
514
+ | `mergeHeaders` | `@payloadcms/next/utilities` | `payload` |
515
+ | `headersWithCors` | `@payloadcms/next/utilities` | `payload` |
516
+ | `createPayloadRequest` | `@payloadcms/next/utilities` | `createPayloadRequestFromWebRequest` in `payload` |
517
+ | `addDataAndFileToRequest` | `@payloadcms/next/utilities` | `payload` |
518
+ | `sanitizeLocales` | `@payloadcms/next/utilities` | `payload` |
519
+ | `addLocalesToRequestFromData` | `@payloadcms/next/utilities` | `payload` |
413
520
 
414
521
  **Renamed types** — use the new canonical name from `payload`:
415
522
 
@@ -428,7 +535,53 @@ Several types and utilities that were re-exported from `@payloadcms/ui` and `@pa
428
535
  + import { headersWithCors, mergeHeaders } from 'payload'
429
536
  ```
430
537
 
431
- Run `npx @payloadcms/codemod --transform migrate-aliased-exports` to migrate automatically. Renamed types are imported using an `as` alias (e.g. `import type { CollectionPreferences as ListPreferences } from 'payload'`) so existing usages keep compiling — drop the alias and rename usages manually if you want to fully commit to the new name.
538
+ Running `npx @payloadcms/codemod --transform migrate-aliased-exports` preserves old local bindings by importing renamed symbols with an `as` alias (e.g. `import type { CollectionPreferences as ListPreferences } from 'payload'` or `import { createPayloadRequestFromWebRequest as createPayloadRequest } from 'payload'`). Run `migrate-payload-request-creation` to complete the request helper's identifier and call-site migration, or drop the other aliases and rename their usages manually if you want to fully commit to the new names.
539
+
540
+ ### Field component types replaced by props types
541
+
542
+ Field component aliases that wrapped props in `React.ComponentType<Props>` have been removed. Import the props type directly so each component can use `React.FC<Props>` or a function declaration.
543
+
544
+ ```diff
545
+ - import type { TextFieldClientComponent } from 'payload'
546
+ + import type { TextFieldClientProps } from 'payload'
547
+ + import type React from 'react'
548
+
549
+ - export const CustomTextField: TextFieldClientComponent = (props) => {
550
+ + export const CustomTextField: React.FC<TextFieldClientProps> = (props) => {
551
+ // ...
552
+ }
553
+ ```
554
+
555
+ Generic type arguments move to the props type:
556
+
557
+ ```diff
558
+ - import type { FieldErrorClientComponent, TextFieldClient } from 'payload'
559
+ + import type { FieldErrorClientProps, TextFieldClient } from 'payload'
560
+ + import type React from 'react'
561
+
562
+ - const Error: FieldErrorClientComponent<TextFieldClient> = (props) => null
563
+ + const Error: React.FC<FieldErrorClientProps<TextFieldClient>> = (props) => null
564
+ ```
565
+
566
+ Function declarations can annotate their parameter without a component wrapper:
567
+
568
+ ```tsx
569
+ import type { TextFieldServerProps } from 'payload'
570
+
571
+ export default async function CustomTextField(props: TextFieldServerProps) {
572
+ // ...
573
+ }
574
+ ```
575
+
576
+ This covers main field components, labels, descriptions, errors, diffs, and block row labels. Admin-view types such as `AdminViewComponent` and `DocumentTabComponent` are separate.
577
+
578
+ #### Codemod
579
+
580
+ To migrate automatically, there's a codemod for this change available by running:
581
+
582
+ ```bash
583
+ npx @payloadcms/codemod --transform migrate-field-component-types
584
+ ```
432
585
 
433
586
  ### `DefaultValue` function variant is now typed to allow returning a `Promise` ([#17522](https://github.com/payloadcms/payload/pull/17522))
434
587
 
@@ -901,9 +1054,9 @@ Run `npx @payloadcms/codemod --transform migrate-db-types-subpath` to migrate au
901
1054
 
902
1055
  The minimum supported Node.js version is now **24.15.0** (previously 18.20.2). Upgrade your runtime — along with any CI, Docker images, and deployment targets — to the latest node LTS version or newer before upgrading to 4.0.
903
1056
 
904
- ### Minimum supported Next.js version is now 16.2.6 ([#16537](https://github.com/payloadcms/payload/pull/16537))
1057
+ ### Minimum supported Next.js version is now 16.4.0 ([#16537](https://github.com/payloadcms/payload/pull/16537))
905
1058
 
906
- Older versions of Next.js are no longer supported. Update Next.js to **16.2.6** or newer.
1059
+ Older versions of Next.js are no longer supported. Update Next.js to **16.4.0** or newer.
907
1060
 
908
1061
  ### Minimum supported TypeScript version is now 6.0.3 ([#16692](https://github.com/payloadcms/payload/pull/16692))
909
1062
 
@@ -959,9 +1112,9 @@ The deprecated `isHTMLElement` utility has been removed from `@payloadcms/richte
959
1112
 
960
1113
  `lexical`'s built-in `isHTMLElement` is the canonical implementation and narrows against the node's owning-document `HTMLElement`, so it is also safe across iframes and other realms.
961
1114
 
962
- ### Lexical: vendored `@lexical/markdown` fork removed and lexical upgraded to `0.50.0`
1115
+ ### Lexical: vendored `@lexical/markdown` fork removed and lexical upgraded to `0.52.0`
963
1116
 
964
- `@payloadcms/richtext-lexical` no longer ships a vendored copy of `@lexical/markdown`. The package is now a direct dependency, every `@lexical/*` package was upgraded from `0.41.0` to `0.50.0`, and `@payloadcms/richtext-lexical/lexical/markdown` is a pure passthrough of `@lexical/markdown`.
1117
+ `@payloadcms/richtext-lexical` no longer ships a vendored copy of `@lexical/markdown`. The package is now a direct dependency, every `@lexical/*` package was upgraded from `0.41.0` to `0.52.0`, and `@payloadcms/richtext-lexical/lexical/markdown` is a pure passthrough of `@lexical/markdown`.
965
1118
 
966
1119
  Most projects use markdown through the editor or through `convertMarkdownToLexical` / `convertLexicalToMarkdown` and need no changes. You are only affected if you import from `@payloadcms/richtext-lexical/lexical/markdown` directly.
967
1120
 
@@ -985,7 +1138,16 @@ If you keep calling `$convertFromMarkdownString` directly, pass `editorConfig.fe
985
1138
 
986
1139
  **Whitespace-only markdown table cells now import as an empty paragraph** instead of a text node of padding spaces. This comes from the lexical upgrade, not Payload's own code. No action is required unless you assert on those padding spaces in stored content.
987
1140
 
988
- If you import lexical APIs directly through `@payloadcms/richtext-lexical/lexical/*`, also review the [lexical breaking changes](https://github.com/facebook/lexical/releases) between `0.41.0` and `0.50.0`. None of them require action for typical Payload usage.
1141
+ If you import lexical APIs directly through `@payloadcms/richtext-lexical/lexical/*`, also review the [lexical breaking changes](https://github.com/facebook/lexical/releases) between `0.41.0` and `0.52.0`. None of them require action for typical Payload usage.
1142
+
1143
+ If your app imports Lexical types or adds custom features, check these changes from `0.50.0`. They also apply to imports through `@payloadcms/richtext-lexical/lexical` and its subpaths:
1144
+
1145
+ - Lexical packages are ESM only. Use ESM imports; CommonJS `require()` needs Node.js 20.19 or later.
1146
+ - `SELECTION_CHANGE_COMMAND` now runs before DOM reconciliation. Defer DOM lookups and floating UI positioning with `$onUpdate(() => editor.read('latest', callback))`, or use an update listener for work that should run after every commit.
1147
+ - Call `node.getLatest().exportJSON()` when serializing a node reference retained across an update. Payload continues to write the full JSON format; compact export is not enabled.
1148
+ - `SerializedEditorState<T>`, `SerializedElementNode<T>`, and `SerializedRootNode<T>` no longer accept a type argument. Remove `<T>` if you only need the base node type. For a document with your own node types, use Payload's `TypedEditorState<T>` instead. Without a type argument, Lexical's `children` are still typed as `SerializedLexicalNode[]`.
1149
+ - `ReturnType<Node['exportJSON']>` can now infer partial JSON, making fields such as `version` and `url` optional. If your code expects the full format, use the node's explicit serialized type, such as `SerializedLinkNode`. A normal `node.exportJSON()` call still returns the full format.
1150
+ - `LexicalNode.getCommonAncestor` was removed. Use `$getCommonAncestor(a, b)?.commonAncestor ?? null`; pass the parents of non-element nodes if you need the old method's behavior.
989
1151
 
990
1152
  ### Lexical: `EXPERIMENTAL_TableFeature` renamed to `TableFeature`
991
1153
 
@@ -1677,6 +1839,126 @@ azureStorage({
1677
1839
 
1678
1840
  Run `npx @payloadcms/codemod --transform migrate-azure-chunk-large-files` to remove the flag automatically (it collapses `clientUploads: { chunkLargeFiles: true }` to `clientUploads: true` and keeps any other `clientUploads` options).
1679
1841
 
1842
+ ### Sharp moved out of core into `@payloadcms/transformer-sharp`
1843
+
1844
+ Image resizing is no longer built into `payload` itself. It now ships as an official [file transformer](../upload/transformers), `@payloadcms/transformer-sharp`, that you register under `upload.transformers`.
1845
+
1846
+ This affects four things:
1847
+
1848
+ 1. The top-level `sharp` config property has been removed. Passing a Sharp instance now happens through `sharpTransformer({ sharp })` instead.
1849
+ 2. Per-collection Sharp options — `constructorOptions`, `formatOptions`, `resizeOptions`, `trimOptions`, and `withMetadata` — have been removed from `CollectionConfig['upload']`. They're now authored through `sharpTransformer({ collections })`.
1850
+ - `imageSizes` has also been removed from `CollectionConfig['upload']`. Image sizes are now declared as `variants` on `sharpTransformer({ collections: { <slug>: { variants } } })`. The entries themselves (`name`, `width`, `height`, `generateImageName`, and so on) are unchanged. A collection that still sets `upload.imageSizes` fails the build.
1851
+ 3. `sharp` is no longer a dependency of `payload` at all (previously a `devDependency`, not a runtime `dependency`). Install `@payloadcms/transformer-sharp` explicitly.
1852
+ 4. The Sharp-specific types `SharpDependency`, `ImageUploadFormatOptions`, `ImageUploadTrimOptions`, and `SharpImageSizeOptions` are no longer exported from `payload`. Import `SharpDependency` from `@payloadcms/transformer-sharp`. For the option types, use `SharpCollectionConfig['formatOptions']`, `SharpCollectionConfig['trimOptions']`, and `NonNullable<SharpCollectionConfig['variants']>[number]` from the same package.
1853
+
1854
+ ```sh
1855
+ pnpm add @payloadcms/transformer-sharp
1856
+ ```
1857
+
1858
+ ```diff
1859
+ + import { sharpTransformer } from '@payloadcms/transformer-sharp'
1860
+ import { buildConfig } from 'payload'
1861
+
1862
+ export default buildConfig({
1863
+ collections: [
1864
+ {
1865
+ slug: 'media',
1866
+ upload: {
1867
+ - resizeOptions: { width: 2048, height: 2048 },
1868
+ - imageSizes: [{ name: 'thumbnail', width: 400, height: 300 }],
1869
+ },
1870
+ },
1871
+ ],
1872
+ - sharp,
1873
+ upload: {
1874
+ + transformers: [
1875
+ + sharpTransformer({
1876
+ + sharp,
1877
+ + collections: {
1878
+ + media: {
1879
+ + resizeOptions: { width: 2048, height: 2048 },
1880
+ + variants: [{ name: 'thumbnail', width: 400, height: 300 }],
1881
+ + },
1882
+ + },
1883
+ + }),
1884
+ + ],
1885
+ },
1886
+ })
1887
+ ```
1888
+
1889
+ Run `npx @payloadcms/codemod --transform migrate-sharp-to-transformer` to migrate automatically. The codemod moves a top-level `sharp` dependency and inline collection Sharp options — including `crop` and `focalPoint` — into `sharpTransformer({ collections })` (writing `imageSizes` as `variants`), appends to an existing `upload.transformers` array if you already have one, and leaves anything it can't safely rewrite in place with a note — for example, a `collections` array built by a function call, or a collection defined outside the `buildConfig` call. Review those manually. For a config that already registers `sharpTransformer`, it only renames `imageSizes` to `variants` inside the existing `sharpTransformer` call and flags a leftover top-level `sharp` property; it doesn't move any remaining collection options.
1890
+
1891
+ Your `variants`, `crop`, and `focalPoint` are readable at `collection.upload.variants`/`.crop`/`.focalPoint` on the **sanitized** config (for example `req.payload.collections.media.config.upload.variants`). Code that read the sanitized `upload.imageSizes` in 3.x must read `upload.variants` instead. `sharpTransformer` writes a projection of what you configure back onto the sanitized collection at startup, so the Admin Panel and the rest of core see the same configuration. For a collection configured on `sharpTransformer`, a `crop` or `focalPoint` set on the transformer replaces the collection's own value; one left unset there keeps the collection's. Neither `imageSizes` nor `variants` can be set on the collection at all.
1892
+
1893
+ If you inject a custom Sharp build or version, pass it the same way:
1894
+
1895
+ ```diff
1896
+ - buildConfig({ sharp: myCustomSharp })
1897
+ + sharpTransformer({ sharp: myCustomSharp })
1898
+ ```
1899
+
1900
+ `sharpTransformer` can also resize images at request time (`/api/media/file/photo.png?width=400`). This is new in Payload 4 and **disabled by default**, so a migrated config keeps serving only the original file and your pre-generated `variants`. The codemod doesn't enable it. To opt in, pass `dynamic: true` or `dynamic: { collections: ['media'] }` — see [Dynamic (request-time) resizing](../upload/transformers#dynamic-request-time-resizing), and [Securing dynamic resizing](../upload/transformers#securing-dynamic-resizing) before enabling it on a publicly readable collection.
1901
+
1902
+ #### The stored `sizes` field on upload documents is renamed to `variants`
1903
+
1904
+ The group field that holds each generated image size on an upload document is now `variants` instead of `sizes`. Every place that reads or queries it changes:
1905
+
1906
+ ```diff
1907
+ - doc.sizes?.thumbnail?.url
1908
+ + doc.variants?.thumbnail?.url
1909
+
1910
+ - where: { 'sizes.thumbnail.filename': { equals: 'photo-400x300.png' } }
1911
+ + where: { 'variants.thumbnail.filename': { equals: 'photo-400x300.png' } }
1912
+
1913
+ - select: { sizes: { thumbnail: true } }
1914
+ + select: { variants: { thumbnail: true } }
1915
+ ```
1916
+
1917
+ GraphQL queries select `variants { thumbnail { url } }` instead of `sizes { thumbnail { url } }`, and regenerated types expose `variants?: { ... }` (and `variants?: T | { ... }` on the `*Select` types) in place of `sizes`. Update any frontend code that reads `media.sizes`, including values you pass to helpers such as `getBestFitFromSizes({ sizes: doc.variants })`.
1918
+
1919
+ Existing documents must be migrated. Create the predefined migration for your database adapter and run it:
1920
+
1921
+ <Banner type="warning">
1922
+ Payload 4 uses `variants` as the top-level field for generated upload
1923
+ variants. If an upload collection already defines a custom field named
1924
+ `variants`, rename that field before you run the predefined migration. Choose
1925
+ a new name, update your config, and write a custom migration that moves the
1926
+ existing custom data from `variants` to the new field. Then run the predefined
1927
+ `sizes-to-variants` migration. If legacy `sizes` data or columns and custom
1928
+ `variants` data or columns are both present, the predefined migration stops
1929
+ before it changes data or indexes. It cannot choose a new name or merge this
1930
+ custom data for you.
1931
+ </Banner>
1932
+
1933
+ ```sh
1934
+ # MongoDB
1935
+ payload migrate:create --file @payloadcms/db-mongodb/sizes-to-variants
1936
+ # Postgres
1937
+ payload migrate:create --file @payloadcms/db-postgres/sizes-to-variants
1938
+ # Vercel Postgres
1939
+ payload migrate:create --file @payloadcms/db-vercel-postgres/sizes-to-variants
1940
+ # SQLite
1941
+ payload migrate:create --file @payloadcms/db-sqlite/sizes-to-variants
1942
+ # Cloudflare D1
1943
+ payload migrate:create --file @payloadcms/db-d1-sqlite/sizes-to-variants
1944
+
1945
+ payload migrate
1946
+ ```
1947
+
1948
+ **Postgres and SQLite (including Vercel Postgres and D1):** the columns are renamed in place from `sizes_<name>_<property>` to `variants_<name>_<property>`, on each upload collection's table and its versions table, along with their indexes. Use the predefined migration above **instead of** a plain `payload migrate:create` for this change. A generated migration would drop the `sizes_*` columns and add new `variants_*` columns, losing the stored image size data. The predefined migration also writes the schema snapshot, so the next generated migration starts from the renamed columns.
1949
+
1950
+ On MongoDB the migration renames `sizes` (and `version.sizes` on versions) with `$rename` and re-creates the indexes on those fields under the new path. Run the migration before the upgraded app writes to upload documents.
1951
+
1952
+ #### The file endpoint changes once any transformer is registered
1953
+
1954
+ Registering any transformer under `upload.transformers` — including `sharpTransformer()` with dynamic resizing off — routes every file request through the transformer-aware handler:
1955
+
1956
+ - A file must belong to an upload document to be served. A file that exists in storage without a matching document now returns `404`.
1957
+ - For files whose MIME type a transformer declares (every image, with `sharpTransformer()`), `access.read` can run twice per request: once with `req.fileTransform` set to `true` to decide a possible transform, and once without it for an ordinary read. Keep `access.read` cheap, and use `req.fileTransform` to restrict transformed reads — see [Access control](../upload/transformers#access-control).
1958
+ - Responses produced by a transformer always carry Payload's CORS headers, which `modifyResponseHeaders` can't override.
1959
+
1960
+ To link to a file from your own code, including with transformer query parameters, use the new `generatePayloadFileURL` helper (exported from `payload` and `payload/shared`). It always builds the access-controlled Payload file endpoint, so links never bypass `access.read` by pointing straight at storage.
1961
+
1680
1962
  ### Storage adapters always insert the `prefix` field now — `alwaysInsertFields` removed
1681
1963
 
1682
1964
  The `alwaysInsertFields` option (on `cloudStoragePlugin` and every `storage-*` adapter: `-s3`, `-azure`, `-gcs`, `-r2`, `-vercel-blob`) has been removed. The behavior it used to opt into — always inserting the hidden `prefix` field into the collection schema — is now unconditional, so the schema stays consistent whether or not a collection configures a `prefix` and whether or not the plugin is `enabled`.
@@ -1946,6 +2228,8 @@ By default, MCP items require an authenticated user. Built-in collection and glo
1946
2228
 
1947
2229
  **Dependencies.** The plugin now builds on `@modelcontextprotocol/server` instead of `@modelcontextprotocol/sdk` + `mcp-handler`. It no longer depends on Zod directly; its built-in tools use the Zod Mini export from `payload`. If your custom tools use regular Zod, install Zod v4 in your project and import it directly.
1948
2230
 
2231
+ **HTTP requests have a size limit.** `POST /api/mcp` now answers request bodies over 4 MiB with `413`. Base64 file uploads count toward this limit. Raise it with `mcp.maxRequestBodySize`.
2232
+
1949
2233
  ### `@payloadcms/ui/scss` export removed and legacy `--theme-*` tokens retired
1950
2234
 
1951
2235
  The Admin UI styles were migrated from SCSS to plain CSS. The `@payloadcms/ui/scss` package export and its SCSS source files have been removed, and the legacy `--theme-*` CSS variables were retired in favor of semantic `--color-*` tokens and the raw `--ramp-*` color palette.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/migrate-aliased-exports/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAoC/C,eAAO,MAAM,qBAAqB,EAAE,SA2FnC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/migrate-aliased-exports/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAoC/C,eAAO,MAAM,qBAAqB,EAAE,SA0FnC,CAAA"}
@@ -7,6 +7,7 @@ const SOURCE_MAP = {
7
7
  to: 'payload'
8
8
  },
9
9
  createPayloadRequest: {
10
+ rename: 'createPayloadRequestFromWebRequest',
10
11
  to: 'payload'
11
12
  },
12
13
  headersWithCors: {
@@ -107,6 +108,7 @@ export const migrateAliasedExports = {
107
108
  const aliasNode = spec.getAliasNode();
108
109
  const localName = aliasNode?.getText() ?? spec.getName();
109
110
  const canonicalName = migration.rename ?? spec.getName();
111
+ const originalName = spec.getName();
110
112
  const alias = localName !== canonicalName ? localName : undefined;
111
113
  spec.remove();
112
114
  attachToTargetImport({
@@ -122,7 +124,7 @@ export const migrateAliasedExports = {
122
124
  notes.push(renameNote({
123
125
  filePath: file.getFilePath(),
124
126
  migration,
125
- originalName: spec.getName()
127
+ originalName
126
128
  }));
127
129
  }
128
130
  }
@@ -145,7 +147,7 @@ export const migrateAliasedExports = {
145
147
  } : {}
146
148
  };
147
149
  },
148
- description: 'Move imports of aliased re-exports from @payloadcms/ui and @payloadcms/next/utilities to their canonical sources in `payload` / `payload/shared`. Renamed names (`ListPreferences` → `CollectionPreferences`, `ListComponentClientProps` → `ListViewClientProps`, `ListComponentServerProps` → `ListViewServerProps`) are imported using an `as` alias so existing usages keep compiling.'
150
+ description: 'Move imports of aliased re-exports from @payloadcms/ui and @payloadcms/next/utilities to their canonical sources in `payload` / `payload/shared`. Renamed names (`createPayloadRequest` → `createPayloadRequestFromWebRequest`, `ListPreferences` → `CollectionPreferences`, `ListComponentClientProps` → `ListViewClientProps`, `ListComponentServerProps` → `ListViewServerProps`) are imported using an `as` alias so existing usages keep compiling.'
149
151
  };
150
152
  function applyRename({ migration, notes, sourceFile, spec }) {
151
153
  if (!migration.rename) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/transforms/migrate-aliased-exports/index.ts"],"sourcesContent":["import type { ImportDeclaration, ImportSpecifier, SourceFile } from 'ts-morph'\n\nimport type { Transform } from '../../types.js'\n\ntype Migration = {\n rename?: string\n to: string\n}\n\nconst SOURCE_MAP: Record<string, Record<string, Migration>> = {\n '@payloadcms/next/utilities': {\n addDataAndFileToRequest: { to: 'payload' },\n addLocalesToRequestFromData: { to: 'payload' },\n createPayloadRequest: { to: 'payload' },\n headersWithCors: { to: 'payload' },\n mergeHeaders: { to: 'payload' },\n sanitizeLocales: { to: 'payload' },\n },\n '@payloadcms/ui': {\n Column: { to: 'payload' },\n ListComponentClientProps: { rename: 'ListViewClientProps', to: 'payload' },\n ListComponentServerProps: { rename: 'ListViewServerProps', to: 'payload' },\n ListPreferences: { rename: 'CollectionPreferences', to: 'payload' },\n ListViewClientProps: { to: 'payload' },\n ListViewSlots: { to: 'payload' },\n },\n '@payloadcms/ui/shared': {\n EntityType: { to: 'payload/shared' },\n formatAdminURL: { to: 'payload/shared' },\n mergeListSearchAndWhere: { to: 'payload/shared' },\n },\n}\n\ntype MigratingSpec = {\n migration: Migration\n named: ImportSpecifier\n}\n\nexport const migrateAliasedExports: Transform = {\n name: 'migrate-aliased-exports',\n apply: ({ project }) => {\n const filesChanged = new Set<string>()\n const notes: string[] = []\n\n for (const file of project.getSourceFiles()) {\n let mutated = false\n\n for (const importDecl of [...file.getImportDeclarations()]) {\n const migrations = SOURCE_MAP[importDecl.getModuleSpecifierValue()]\n if (!migrations) {\n continue\n }\n\n const named = importDecl.getNamedImports()\n const migrating: MigratingSpec[] = []\n let kept = 0\n\n for (const spec of named) {\n const migration = migrations[spec.getName()]\n if (migration) {\n migrating.push({ migration, named: spec })\n } else {\n kept++\n }\n }\n\n if (migrating.length === 0) {\n continue\n }\n\n const targets = new Set(migrating.map(({ migration }) => migration.to))\n\n if (kept === 0 && targets.size === 1) {\n const [target] = [...targets]\n importDecl.setModuleSpecifier(target!)\n for (const { migration, named: spec } of migrating) {\n applyRename({ migration, notes, sourceFile: file, spec })\n }\n mutated = true\n continue\n }\n\n for (const { migration, named: spec } of migrating) {\n const isTypeOnly = importDecl.isTypeOnly() || spec.isTypeOnly()\n const aliasNode = spec.getAliasNode()\n const localName = aliasNode?.getText() ?? spec.getName()\n const canonicalName = migration.rename ?? spec.getName()\n const alias = localName !== canonicalName ? localName : undefined\n\n spec.remove()\n\n attachToTargetImport({\n file,\n isTypeOnly,\n named: { name: canonicalName, alias },\n target: migration.to,\n })\n\n if (migration.rename) {\n notes.push(\n renameNote({ filePath: file.getFilePath(), migration, originalName: spec.getName() }),\n )\n }\n }\n\n const remaining = importDecl.getNamedImports()\n if (\n remaining.length === 0 &&\n !importDecl.getDefaultImport() &&\n !importDecl.getNamespaceImport()\n ) {\n importDecl.remove()\n }\n\n mutated = true\n }\n\n if (mutated) {\n filesChanged.add(file.getFilePath())\n }\n }\n\n return {\n filesChanged: [...filesChanged],\n ...(notes.length > 0 ? { notes } : {}),\n }\n },\n description:\n 'Move imports of aliased re-exports from @payloadcms/ui and @payloadcms/next/utilities to their canonical sources in `payload` / `payload/shared`. Renamed names (`ListPreferences` → `CollectionPreferences`, `ListComponentClientProps` → `ListViewClientProps`, `ListComponentServerProps` → `ListViewServerProps`) are imported using an `as` alias so existing usages keep compiling.',\n}\n\ntype ApplyRenameArgs = {\n migration: Migration\n notes: string[]\n sourceFile: SourceFile\n spec: ImportSpecifier\n}\n\nfunction applyRename({ migration, notes, sourceFile, spec }: ApplyRenameArgs): void {\n if (!migration.rename) {\n return\n }\n\n const originalName = spec.getName()\n const aliasNode = spec.getAliasNode()\n const localName = aliasNode?.getText() ?? originalName\n\n spec.setName(migration.rename)\n\n if (localName !== migration.rename) {\n spec.setAlias(localName)\n } else {\n spec.removeAlias()\n }\n\n notes.push(renameNote({ filePath: sourceFile.getFilePath(), migration, originalName }))\n}\n\ntype RenameNoteArgs = {\n filePath: string\n migration: Migration\n originalName: string\n}\n\nfunction renameNote({ filePath, migration, originalName }: RenameNoteArgs): string {\n return `${filePath}: \\`${originalName}\\` is now \\`${migration.rename}\\` in \\`${migration.to}\\`. Codemod imported as \\`${migration.rename} as ${originalName}\\`; rename usages manually if you want to drop the alias.`\n}\n\ntype AttachToTargetArgs = {\n file: SourceFile\n isTypeOnly: boolean\n named: { alias?: string; name: string }\n target: string\n}\n\nfunction attachToTargetImport({ file, isTypeOnly, named, target }: AttachToTargetArgs): void {\n const localName = named.alias ?? named.name\n const existing = findExistingTarget({ file, isTypeOnly, target })\n\n if (existing) {\n const declTypeOnly = existing.isTypeOnly()\n const alreadyHas = existing\n .getNamedImports()\n .some((spec) => (spec.getAliasNode()?.getText() ?? spec.getName()) === localName)\n if (alreadyHas) {\n return\n }\n existing.addNamedImport({\n name: named.name,\n alias: named.alias,\n isTypeOnly: !declTypeOnly && isTypeOnly,\n })\n return\n }\n\n file.addImportDeclaration({\n isTypeOnly,\n moduleSpecifier: target,\n namedImports: [{ name: named.name, alias: named.alias }],\n })\n}\n\ntype FindExistingTargetArgs = {\n file: SourceFile\n isTypeOnly: boolean\n target: string\n}\n\nfunction findExistingTarget({\n file,\n isTypeOnly,\n target,\n}: FindExistingTargetArgs): ImportDeclaration | undefined {\n const candidates = file\n .getImportDeclarations()\n .filter((decl) => decl.getModuleSpecifierValue() === target)\n\n if (candidates.length === 0) {\n return undefined\n }\n\n if (isTypeOnly) {\n return candidates.find((decl) => decl.isTypeOnly()) ?? candidates[0]\n }\n\n return candidates.find((decl) => !decl.isTypeOnly()) ?? candidates[0]\n}\n"],"names":["SOURCE_MAP","addDataAndFileToRequest","to","addLocalesToRequestFromData","createPayloadRequest","headersWithCors","mergeHeaders","sanitizeLocales","Column","ListComponentClientProps","rename","ListComponentServerProps","ListPreferences","ListViewClientProps","ListViewSlots","EntityType","formatAdminURL","mergeListSearchAndWhere","migrateAliasedExports","name","apply","project","filesChanged","Set","notes","file","getSourceFiles","mutated","importDecl","getImportDeclarations","migrations","getModuleSpecifierValue","named","getNamedImports","migrating","kept","spec","migration","getName","push","length","targets","map","size","target","setModuleSpecifier","applyRename","sourceFile","isTypeOnly","aliasNode","getAliasNode","localName","getText","canonicalName","alias","undefined","remove","attachToTargetImport","renameNote","filePath","getFilePath","originalName","remaining","getDefaultImport","getNamespaceImport","add","description","setName","setAlias","removeAlias","existing","findExistingTarget","declTypeOnly","alreadyHas","some","addNamedImport","addImportDeclaration","moduleSpecifier","namedImports","candidates","filter","decl","find"],"mappings":"AASA,MAAMA,aAAwD;IAC5D,8BAA8B;QAC5BC,yBAAyB;YAAEC,IAAI;QAAU;QACzCC,6BAA6B;YAAED,IAAI;QAAU;QAC7CE,sBAAsB;YAAEF,IAAI;QAAU;QACtCG,iBAAiB;YAAEH,IAAI;QAAU;QACjCI,cAAc;YAAEJ,IAAI;QAAU;QAC9BK,iBAAiB;YAAEL,IAAI;QAAU;IACnC;IACA,kBAAkB;QAChBM,QAAQ;YAAEN,IAAI;QAAU;QACxBO,0BAA0B;YAAEC,QAAQ;YAAuBR,IAAI;QAAU;QACzES,0BAA0B;YAAED,QAAQ;YAAuBR,IAAI;QAAU;QACzEU,iBAAiB;YAAEF,QAAQ;YAAyBR,IAAI;QAAU;QAClEW,qBAAqB;YAAEX,IAAI;QAAU;QACrCY,eAAe;YAAEZ,IAAI;QAAU;IACjC;IACA,yBAAyB;QACvBa,YAAY;YAAEb,IAAI;QAAiB;QACnCc,gBAAgB;YAAEd,IAAI;QAAiB;QACvCe,yBAAyB;YAAEf,IAAI;QAAiB;IAClD;AACF;AAOA,OAAO,MAAMgB,wBAAmC;IAC9CC,MAAM;IACNC,OAAO,CAAC,EAAEC,OAAO,EAAE;QACjB,MAAMC,eAAe,IAAIC;QACzB,MAAMC,QAAkB,EAAE;QAE1B,KAAK,MAAMC,QAAQJ,QAAQK,cAAc,GAAI;YAC3C,IAAIC,UAAU;YAEd,KAAK,MAAMC,cAAc;mBAAIH,KAAKI,qBAAqB;aAAG,CAAE;gBAC1D,MAAMC,aAAa9B,UAAU,CAAC4B,WAAWG,uBAAuB,G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,OAAO+B,UAAU,CAAC,EAAE;AACvE"}
1
+ {"version":3,"sources":["../../../src/transforms/migrate-aliased-exports/index.ts"],"sourcesContent":["import type { ImportDeclaration, ImportSpecifier, SourceFile } from 'ts-morph'\n\nimport type { Transform } from '../../types.js'\n\ntype Migration = {\n rename?: string\n to: string\n}\n\nconst SOURCE_MAP: Record<string, Record<string, Migration>> = {\n '@payloadcms/next/utilities': {\n addDataAndFileToRequest: { to: 'payload' },\n addLocalesToRequestFromData: { to: 'payload' },\n createPayloadRequest: { rename: 'createPayloadRequestFromWebRequest', to: 'payload' },\n headersWithCors: { to: 'payload' },\n mergeHeaders: { to: 'payload' },\n sanitizeLocales: { to: 'payload' },\n },\n '@payloadcms/ui': {\n Column: { to: 'payload' },\n ListComponentClientProps: { rename: 'ListViewClientProps', to: 'payload' },\n ListComponentServerProps: { rename: 'ListViewServerProps', to: 'payload' },\n ListPreferences: { rename: 'CollectionPreferences', to: 'payload' },\n ListViewClientProps: { to: 'payload' },\n ListViewSlots: { to: 'payload' },\n },\n '@payloadcms/ui/shared': {\n EntityType: { to: 'payload/shared' },\n formatAdminURL: { to: 'payload/shared' },\n mergeListSearchAndWhere: { to: 'payload/shared' },\n },\n}\n\ntype MigratingSpec = {\n migration: Migration\n named: ImportSpecifier\n}\n\nexport const migrateAliasedExports: Transform = {\n name: 'migrate-aliased-exports',\n apply: ({ project }) => {\n const filesChanged = new Set<string>()\n const notes: string[] = []\n\n for (const file of project.getSourceFiles()) {\n let mutated = false\n\n for (const importDecl of [...file.getImportDeclarations()]) {\n const migrations = SOURCE_MAP[importDecl.getModuleSpecifierValue()]\n if (!migrations) {\n continue\n }\n\n const named = importDecl.getNamedImports()\n const migrating: MigratingSpec[] = []\n let kept = 0\n\n for (const spec of named) {\n const migration = migrations[spec.getName()]\n if (migration) {\n migrating.push({ migration, named: spec })\n } else {\n kept++\n }\n }\n\n if (migrating.length === 0) {\n continue\n }\n\n const targets = new Set(migrating.map(({ migration }) => migration.to))\n\n if (kept === 0 && targets.size === 1) {\n const [target] = [...targets]\n importDecl.setModuleSpecifier(target!)\n for (const { migration, named: spec } of migrating) {\n applyRename({ migration, notes, sourceFile: file, spec })\n }\n mutated = true\n continue\n }\n\n for (const { migration, named: spec } of migrating) {\n const isTypeOnly = importDecl.isTypeOnly() || spec.isTypeOnly()\n const aliasNode = spec.getAliasNode()\n const localName = aliasNode?.getText() ?? spec.getName()\n const canonicalName = migration.rename ?? spec.getName()\n const originalName = spec.getName()\n const alias = localName !== canonicalName ? localName : undefined\n\n spec.remove()\n\n attachToTargetImport({\n file,\n isTypeOnly,\n named: { name: canonicalName, alias },\n target: migration.to,\n })\n\n if (migration.rename) {\n notes.push(renameNote({ filePath: file.getFilePath(), migration, originalName }))\n }\n }\n\n const remaining = importDecl.getNamedImports()\n if (\n remaining.length === 0 &&\n !importDecl.getDefaultImport() &&\n !importDecl.getNamespaceImport()\n ) {\n importDecl.remove()\n }\n\n mutated = true\n }\n\n if (mutated) {\n filesChanged.add(file.getFilePath())\n }\n }\n\n return {\n filesChanged: [...filesChanged],\n ...(notes.length > 0 ? { notes } : {}),\n }\n },\n description:\n 'Move imports of aliased re-exports from @payloadcms/ui and @payloadcms/next/utilities to their canonical sources in `payload` / `payload/shared`. Renamed names (`createPayloadRequest` → `createPayloadRequestFromWebRequest`, `ListPreferences` → `CollectionPreferences`, `ListComponentClientProps` → `ListViewClientProps`, `ListComponentServerProps` → `ListViewServerProps`) are imported using an `as` alias so existing usages keep compiling.',\n}\n\ntype ApplyRenameArgs = {\n migration: Migration\n notes: string[]\n sourceFile: SourceFile\n spec: ImportSpecifier\n}\n\nfunction applyRename({ migration, notes, sourceFile, spec }: ApplyRenameArgs): void {\n if (!migration.rename) {\n return\n }\n\n const originalName = spec.getName()\n const aliasNode = spec.getAliasNode()\n const localName = aliasNode?.getText() ?? originalName\n\n spec.setName(migration.rename)\n\n if (localName !== migration.rename) {\n spec.setAlias(localName)\n } else {\n spec.removeAlias()\n }\n\n notes.push(renameNote({ filePath: sourceFile.getFilePath(), migration, originalName }))\n}\n\ntype RenameNoteArgs = {\n filePath: string\n migration: Migration\n originalName: string\n}\n\nfunction renameNote({ filePath, migration, originalName }: RenameNoteArgs): string {\n return `${filePath}: \\`${originalName}\\` is now \\`${migration.rename}\\` in \\`${migration.to}\\`. Codemod imported as \\`${migration.rename} as ${originalName}\\`; rename usages manually if you want to drop the alias.`\n}\n\ntype AttachToTargetArgs = {\n file: SourceFile\n isTypeOnly: boolean\n named: { alias?: string; name: string }\n target: string\n}\n\nfunction attachToTargetImport({ file, isTypeOnly, named, target }: AttachToTargetArgs): void {\n const localName = named.alias ?? named.name\n const existing = findExistingTarget({ file, isTypeOnly, target })\n\n if (existing) {\n const declTypeOnly = existing.isTypeOnly()\n const alreadyHas = existing\n .getNamedImports()\n .some((spec) => (spec.getAliasNode()?.getText() ?? spec.getName()) === localName)\n if (alreadyHas) {\n return\n }\n existing.addNamedImport({\n name: named.name,\n alias: named.alias,\n isTypeOnly: !declTypeOnly && isTypeOnly,\n })\n return\n }\n\n file.addImportDeclaration({\n isTypeOnly,\n moduleSpecifier: target,\n namedImports: [{ name: named.name, alias: named.alias }],\n })\n}\n\ntype FindExistingTargetArgs = {\n file: SourceFile\n isTypeOnly: boolean\n target: string\n}\n\nfunction findExistingTarget({\n file,\n isTypeOnly,\n target,\n}: FindExistingTargetArgs): ImportDeclaration | undefined {\n const candidates = file\n .getImportDeclarations()\n .filter((decl) => decl.getModuleSpecifierValue() === target)\n\n if (candidates.length === 0) {\n return undefined\n }\n\n if (isTypeOnly) {\n return candidates.find((decl) => decl.isTypeOnly()) ?? candidates[0]\n }\n\n return candidates.find((decl) => !decl.isTypeOnly()) ?? candidates[0]\n}\n"],"names":["SOURCE_MAP","addDataAndFileToRequest","to","addLocalesToRequestFromData","createPayloadRequest","rename","headersWithCors","mergeHeaders","sanitizeLocales","Column","ListComponentClientProps","ListComponentServerProps","ListPreferences","ListViewClientProps","ListViewSlots","EntityType","formatAdminURL","mergeListSearchAndWhere","migrateAliasedExports","name","apply","project","filesChanged","Set","notes","file","getSourceFiles","mutated","importDecl","getImportDeclarations","migrations","getModuleSpecifierValue","named","getNamedImports","migrating","kept","spec","migration","getName","push","length","targets","map","size","target","setModuleSpecifier","applyRename","sourceFile","isTypeOnly","aliasNode","getAliasNode","localName","getText","canonicalName","originalName","alias","undefined","remove","attachToTargetImport","renameNote","filePath","getFilePath","remaining","getDefaultImport","getNamespaceImport","add","description","setName","setAlias","removeAlias","existing","findExistingTarget","declTypeOnly","alreadyHas","some","addNamedImport","addImportDeclaration","moduleSpecifier","namedImports","candidates","filter","decl","find"],"mappings":"AASA,MAAMA,aAAwD;IAC5D,8BAA8B;QAC5BC,yBAAyB;YAAEC,IAAI;QAAU;QACzCC,6BAA6B;YAAED,IAAI;QAAU;QAC7CE,sBAAsB;YAAEC,QAAQ;YAAsCH,IAAI;QAAU;QACpFI,iBAAiB;YAAEJ,IAAI;QAAU;QACjCK,cAAc;YAAEL,IAAI;QAAU;QAC9BM,iBAAiB;YAAEN,IAAI;QAAU;IACnC;IACA,kBAAkB;QAChBO,QAAQ;YAAEP,IAAI;QAAU;QACxBQ,0BAA0B;YAAEL,QAAQ;YAAuBH,IAAI;QAAU;QACzES,0BAA0B;YAAEN,QAAQ;YAAuBH,IAAI;QAAU;QACzEU,iBAAiB;YAAEP,QAAQ;YAAyBH,IAAI;QAAU;QAClEW,qBAAqB;YAAEX,IAAI;QAAU;QACrCY,eAAe;YAAEZ,IAAI;QAAU;IACjC;IACA,yBAAyB;QACvBa,YAAY;YAAEb,IAAI;QAAiB;QACnCc,gBAAgB;YAAEd,IAAI;QAAiB;QACvCe,yBAAyB;YAAEf,IAAI;QAAiB;IAClD;AACF;AAOA,OAAO,MAAMgB,wBAAmC;IAC9CC,MAAM;IACNC,OAAO,CAAC,EAAEC,OAAO,EAAE;QACjB,MAAMC,eAAe,IAAIC;QACzB,MAAMC,QAAkB,EAAE;QAE1B,KAAK,MAAMC,QAAQJ,QA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EA,IAAIR,YAAY;QACd,OAAO+B,WAAWG,IAAI,CAAC,CAACD,OAASA,KAAKjC,UAAU,OAAO+B,UAAU,CAAC,EAAE;IACtE;IAEA,OAAOA,WAAWG,IAAI,CAAC,CAACD,OAAS,CAACA,KAAKjC,UAAU,OAAO+B,UAAU,CAAC,EAAE;AACvE"}
@@ -0,0 +1,6 @@
1
+ import { createPayloadRequest } from '@payloadcms/next/utilities';
2
+ import { createPayloadRequest as webRequest } from '@payloadcms/next/utilities';
3
+ const req = createPayloadRequest(args);
4
+ const aliased = webRequest(args);
5
+
6
+ //# sourceMappingURL=request.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/migrate-aliased-exports/request.input.ts"],"sourcesContent":["import { createPayloadRequest } from '@payloadcms/next/utilities'\nimport { createPayloadRequest as webRequest, unrelated } from '@payloadcms/next/utilities'\n\nconst req = createPayloadRequest(args)\nconst aliased = webRequest(args)\n"],"names":["createPayloadRequest","webRequest","req","args","aliased"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,6BAA4B;AACjE,SAASA,wBAAwBC,UAAU,QAAmB,6BAA4B;AAE1F,MAAMC,MAAMF,qBAAqBG;AACjC,MAAMC,UAAUH,WAAWE"}
@@ -0,0 +1,5 @@
1
+ import { createPayloadRequestFromWebRequest as createPayloadRequest, createPayloadRequestFromWebRequest as webRequest } from 'payload';
2
+ const req = createPayloadRequest(args);
3
+ const aliased = webRequest(args);
4
+
5
+ //# sourceMappingURL=request.output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/migrate-aliased-exports/request.output.ts"],"sourcesContent":["import { createPayloadRequestFromWebRequest as createPayloadRequest, createPayloadRequestFromWebRequest as webRequest } from 'payload'\nimport { unrelated } from '@payloadcms/next/utilities'\n\nconst req = createPayloadRequest(args)\nconst aliased = webRequest(args)\n"],"names":["createPayloadRequestFromWebRequest","createPayloadRequest","webRequest","req","args","aliased"],"mappings":"AAAA,SAASA,sCAAsCC,oBAAoB,EAAED,sCAAsCE,UAAU,QAAQ,UAAS;AAGtI,MAAMC,MAAMF,qBAAqBG;AACjC,MAAMC,UAAUH,WAAWE"}
@@ -0,0 +1,15 @@
1
+ export const Posts = {
2
+ slug: 'posts',
3
+ fields: [],
4
+ authorship: {
5
+ updatedBy: false
6
+ }
7
+ };
8
+ export const Users = {
9
+ slug: 'users',
10
+ auth: true,
11
+ fields: [],
12
+ authorship: false
13
+ };
14
+
15
+ //# sourceMappingURL=already-set.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/migrate-authorship-default/already-set.input.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nexport const Posts: CollectionConfig = {\n slug: 'posts',\n fields: [],\n authorship: {\n updatedBy: false,\n },\n}\n\nexport const Users: CollectionConfig = {\n slug: 'users',\n auth: true,\n fields: [],\n authorship: false,\n}\n"],"names":["Posts","slug","fields","authorship","updatedBy","Users","auth"],"mappings":"AAEA,OAAO,MAAMA,QAA0B;IACrCC,MAAM;IACNC,QAAQ,EAAE;IACVC,YAAY;QACVC,WAAW;IACb;AACF,EAAC;AAED,OAAO,MAAMC,QAA0B;IACrCJ,MAAM;IACNK,MAAM;IACNJ,QAAQ,EAAE;IACVC,YAAY;AACd,EAAC"}
@@ -0,0 +1,15 @@
1
+ export const Posts = {
2
+ slug: 'posts',
3
+ fields: [],
4
+ authorship: {
5
+ updatedBy: false
6
+ }
7
+ };
8
+ export const Users = {
9
+ slug: 'users',
10
+ auth: true,
11
+ fields: [],
12
+ authorship: false
13
+ };
14
+
15
+ //# sourceMappingURL=already-set.output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/migrate-authorship-default/already-set.output.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nexport const Posts: CollectionConfig = {\n slug: 'posts',\n fields: [],\n authorship: {\n updatedBy: false,\n },\n}\n\nexport const Users: CollectionConfig = {\n slug: 'users',\n auth: true,\n fields: [],\n authorship: false,\n}\n"],"names":["Posts","slug","fields","authorship","updatedBy","Users","auth"],"mappings":"AAEA,OAAO,MAAMA,QAA0B;IACrCC,MAAM;IACNC,QAAQ,EAAE;IACVC,YAAY;QACVC,WAAW;IACb;AACF,EAAC;AAED,OAAO,MAAMC,QAA0B;IACrCJ,MAAM;IACNK,MAAM;IACNJ,QAAQ,EAAE;IACVC,YAAY;AACd,EAAC"}
@@ -0,0 +1,16 @@
1
+ export const Posts = {
2
+ slug: 'posts',
3
+ fields: [
4
+ {
5
+ name: 'title',
6
+ type: 'text'
7
+ }
8
+ ]
9
+ };
10
+ export const Media = {
11
+ slug: 'media',
12
+ fields: [],
13
+ upload: true
14
+ };
15
+
16
+ //# sourceMappingURL=basic.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/migrate-authorship-default/basic.input.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nexport const Posts: CollectionConfig = {\n slug: 'posts',\n fields: [\n {\n name: 'title',\n type: 'text',\n },\n ],\n}\n\nexport const Media: CollectionConfig = {\n slug: 'media',\n fields: [],\n upload: true,\n}\n"],"names":["Posts","slug","fields","name","type","Media","upload"],"mappings":"AAEA,OAAO,MAAMA,QAA0B;IACrCC,MAAM;IACNC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;QACR;KACD;AACH,EAAC;AAED,OAAO,MAAMC,QAA0B;IACrCJ,MAAM;IACNC,QAAQ,EAAE;IACVI,QAAQ;AACV,EAAC"}
@@ -0,0 +1,18 @@
1
+ export const Posts = {
2
+ slug: 'posts',
3
+ fields: [
4
+ {
5
+ name: 'title',
6
+ type: 'text'
7
+ }
8
+ ],
9
+ authorship: false
10
+ };
11
+ export const Media = {
12
+ slug: 'media',
13
+ fields: [],
14
+ upload: true,
15
+ authorship: false
16
+ };
17
+
18
+ //# sourceMappingURL=basic.output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/migrate-authorship-default/basic.output.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nexport const Posts: CollectionConfig = {\n slug: 'posts',\n fields: [\n {\n name: 'title',\n type: 'text',\n },\n ],\n authorship: false,\n}\n\nexport const Media: CollectionConfig = {\n slug: 'media',\n fields: [],\n upload: true,\n authorship: false,\n}\n"],"names":["Posts","slug","fields","name","type","authorship","Media","upload"],"mappings":"AAEA,OAAO,MAAMA,QAA0B;IACrCC,MAAM;IACNC,QAAQ;QACN;YACEC,MAAM;YACNC,MAAM;QACR;KACD;IACDC,YAAY;AACd,EAAC;AAED,OAAO,MAAMC,QAA0B;IACrCL,MAAM;IACNC,QAAQ,EAAE;IACVK,QAAQ;IACRF,YAAY;AACd,EAAC"}