@payloadcms/codemod 4.0.0-beta.7 → 4.0.0-beta.9

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.
@@ -18,8 +18,38 @@ npx @payloadcms/codemod
18
18
 
19
19
  The codemod is idempotent and safe to run on a partially-migrated project.
20
20
 
21
+ ## Database migrations
22
+
23
+ Payload 4 adds new tables and columns. On SQL adapters (Postgres, SQLite and D1), generate one migration after upgrading with `payload migrate:create`, check it, and run it with `payload migrate`. In development, the schema is pushed automatically. MongoDB needs no migration for new fields.
24
+
25
+ Changes that need more than that, like renamed columns, say so in their own section below.
26
+
21
27
  ## Breaking Changes
22
28
 
29
+ ### Form-state data utilities are renamed
30
+
31
+ The shared form-state utilities exported from `payload/shared` now explicitly name their source:
32
+
33
+ | Old name | New name |
34
+ | ---------------------- | ----------------------------- |
35
+ | `reduceFieldsToValues` | `getDataFromFormState` |
36
+ | `getSiblingData` | `getSiblingDataFromFormState` |
37
+
38
+ Update imports and calls. Their arguments are unchanged:
39
+
40
+ ```diff
41
+ -import { reduceFieldsToValues, getSiblingData } from 'payload/shared'
42
+ +import { getDataFromFormState, getSiblingDataFromFormState } from 'payload/shared'
43
+
44
+ -const data = reduceFieldsToValues(fields, true)
45
+ +const data = getDataFromFormState(fields, true)
46
+
47
+ -const siblingData = getSiblingData(fields, 'items.0.title')
48
+ +const siblingData = getSiblingDataFromFormState(fields, 'items.0.title')
49
+ ```
50
+
51
+ The form-context methods `useForm().getData()` and `useForm().getSiblingData()` keep their names.
52
+
23
53
  ### Payload request creation is consolidated
24
54
 
25
55
  Payload request creation now uses `createPayloadRequest` for local contexts and `createPayloadRequestFromWebRequest` to convert a Web `Request`. Admin context setup is exposed as `initAdminContext`.
@@ -120,12 +150,6 @@ A token is also rejected if its `collection` is not auth-enabled or has `disable
120
150
 
121
151
  See [Token Data](../authentication/token-data) for the full token data shape.
122
152
 
123
- ### Sessions track their refreshes
124
-
125
- Auth collections with `useSessions` (the default) now store two more fields on each session, `refreshCount` and `refreshedAt`. [Refresh tokens](../authentication/overview#refresh-tokens) use them to tell the latest refresh token apart from older ones.
126
-
127
- On SQL adapters this adds two columns to each `<collection>_sessions` 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 sessions keep working, since an empty `refreshCount` counts as `0`. MongoDB needs no migration.
128
-
129
153
  ### Local API access is now enforced by default #overrideaccess-now-defaults-to-false-on-local-api-operations
130
154
 
131
155
  `overrideAccess` now defaults to `false` on Local API operations, so omitting it respects Access Control instead. Operations that do not expose `overrideAccess`, and operations such as `resetPassword` where it was already required or did not default to `true`, are unaffected by this change.
@@ -334,7 +358,7 @@ Collections and globals now have `versions: true` by default (`maxPerDoc`/`max:
334
358
 
335
359
  **What changes:**
336
360
 
337
- - Any collection or global without an explicit `versions` property will automatically get a `_<slug>_versions` table or collection in the database. You will need to run a database migration to add these new tables for existing projects.
361
+ - Any collection or global without an explicit `versions` property will automatically get a `_<slug>_versions` table or collection in the database (see [Database migrations](#database-migrations)).
338
362
  - Auth collections such as Users do **not** get versions by default — the built-in user collection already ships with `versions: false`, and you should do the same for any custom auth collection.
339
363
  - The bare `versions: true` you may have added previously is now redundant and can be removed.
340
364
 
@@ -385,7 +409,7 @@ Collections and globals now track authorship by default: Payload injects `create
385
409
 
386
410
  **What changes:**
387
411
 
388
- - 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`.
412
+ - 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 in each entity's `_rels` table (see [Database migrations](#database-migrations)). Existing documents are backfilled with `null`.
389
413
  - `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.
390
414
  - 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.
391
415
 
@@ -887,6 +911,42 @@ If you only used `useDocumentInfo` for `title` / `setDocumentTitle`, drop the im
887
911
 
888
912
  Run `npx @payloadcms/codemod --transform migrate-document-title-context` to migrate automatically. The codemod splits mixed destructures, removes the `useDocumentInfo` import when no other properties are still used, and preserves any rename aliases (e.g. `{ title: docTitle }`).
889
913
 
914
+ ### `Form` makes its own form-state requests
915
+
916
+ `Form` owns server form-state requests after field changes and successful saves. Document forms derive their request information from the surrounding document and operation providers. Nested forms identify their schema with `schemaPath`; bulk forms restrict their fields with `select`, and widget forms identify their entity with `widgetSlug`.
917
+
918
+ Remove callbacks that fetch and return server form state:
919
+
920
+ ```diff
921
+ -const onChange = async ({ formState, submitted }) => {
922
+ - const { state } = await getFormState({
923
+ - collectionSlug,
924
+ - docPermissions,
925
+ - docPreferences: await getDocPreferences(),
926
+ - formState,
927
+ - operation: 'update',
928
+ - schemaPath,
929
+ - signal: controller.signal,
930
+ - skipValidation: !submitted,
931
+ - })
932
+ - return state
933
+ -}
934
+ -
935
+ -<Form initialState={initialState} onChange={[onChange]}>
936
+ +<Form initialState={initialState} schemaPath={schemaPath}>
937
+ ```
938
+
939
+ A document's main form uses `isDocumentForm` and does not need `schemaPath`. It also owns document locking, stale-data detection, permission refreshes and preview URLs. Pass persistent read-only state with `readOnly`; temporary `disabled` or processing state does not make fields read-only on the server.
940
+
941
+ Plain custom forms without `isDocumentForm`, `schemaPath` or `widgetSlug` remain local, even when they receive `initialState` or are rendered inside a document provider. Initial state continues to be built before rendering the form.
942
+
943
+ BREAKING CHANGES:
944
+
945
+ - The return values of `onChange` and `onSuccess` are ignored. Use them for side effects only.
946
+ - `onChange` receives the merged state after an edit refresh or local submit validation, including invalid validation results. Validation notifications have `submitted: true`.
947
+ - Schema-backed forms with a local `onSubmit` validate on the server before committing. Remove `beforeSubmit` callbacks whose only purpose is fetching server form state. Invalid state or a validation request failure prevents the local commit.
948
+ - After a successful save, `Form` refreshes permissions and state before calling `onSuccess`. Creates skip the state refresh because they replace the form. A failed refresh does not change the successful save outcome or suppress `onSuccess`.
949
+
890
950
  ### Locale hooks can now return null
891
951
 
892
952
  The return type of `useLocale` is now `Locale | null`. It returns `null` when localization is disabled or configured without any locales. In Payload 3, the hook was typed as `Locale` and returned an empty object when localization was unavailable.
@@ -1068,6 +1128,12 @@ Remove `diffMethod` from your props. If you passed it on to a diffing utility, p
1068
1128
  }) => {
1069
1129
  ```
1070
1130
 
1131
+ ### `root` removed from the `Endpoint` type
1132
+
1133
+ The deprecated `root` property has been removed from the `Endpoint` type. It has been typed as `never` since 3.0, so it couldn't be set, and Payload ignored it.
1134
+
1135
+ To serve a route outside of `routes.api`, add it to your app directly, e.g. as a [Next.js route handler](https://nextjs.org/docs/app/api-reference/file-conventions/route).
1136
+
1071
1137
  ### Collection after-operation hooks no longer report read operations
1072
1138
 
1073
1139
  The deprecated `'read'` value for the `operation` argument of collection `afterOperation` hooks has been removed. Payload has not dispatched `afterOperation` with `operation: 'read'` for some time — the `find` and `findByID` operations report their own names (`'find'` and `'findByID'`) instead.
@@ -1186,13 +1252,15 @@ The deprecated `findMigrationDir` re-export has been removed from `@payloadcms/d
1186
1252
  + import { findMigrationDir } from 'payload'
1187
1253
  ```
1188
1254
 
1189
- ### Minimum supported Node.js version is now 24.22.1 ([#16540](https://github.com/payloadcms/payload/pull/16540))
1255
+ ### Minimum supported Node.js version is now 24.22.3 ([#16540](https://github.com/payloadcms/payload/pull/16540))
1256
+
1257
+ The minimum supported Node.js version is now **24.22.3** (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.
1190
1258
 
1191
- The minimum supported Node.js version is now **24.22.1** (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.
1259
+ ### Minimum supported Next.js version is now 16.4.1 ([#16537](https://github.com/payloadcms/payload/pull/16537))
1192
1260
 
1193
- ### Minimum supported Next.js version is now 16.4.0 ([#16537](https://github.com/payloadcms/payload/pull/16537))
1261
+ Older versions of Next.js are no longer supported. Update Next.js to **16.4.1** or newer within the `16.x` release line.
1194
1262
 
1195
- Older versions of Next.js are no longer supported. Update Next.js to **16.4.0** or newer.
1263
+ React and React DOM must satisfy `^19.3.1`. TanStack Start applications also require `@vitejs/plugin-rsc` `^0.5.38`. These minimums include the fixes for [GHSA-xqc2-xf4c-x3h3](https://github.com/react/react/security/advisories/GHSA-xqc2-xf4c-x3h3) and its [Next.js advisory](https://github.com/vercel/next.js/security/advisories/GHSA-673q-mjm6-r5xr).
1196
1264
 
1197
1265
  ### Minimum supported TypeScript version is now 6.0.3 ([#16692](https://github.com/payloadcms/payload/pull/16692))
1198
1266
 
@@ -1645,13 +1713,13 @@ Generated workflow slugs and explicit input objects continue to work as before.
1645
1713
 
1646
1714
  When jobs are enabled, Payload now always adds the `payload-jobs-stats` global and the `meta` field on the `payload-jobs` collection. Previously, these were only added when a task or workflow used a schedule.
1647
1715
 
1648
- Existing projects that use sqlite/postgres and jobs may need a database migration.
1716
+ On SQL adapters this adds tables and columns (see [Database migrations](#database-migrations)).
1649
1717
 
1650
1718
  ### Jobs: concurrency controls and parent task logging are always enabled
1651
1719
 
1652
1720
  Concurrency controls add the indexed `concurrencyKey` field to the `payload-jobs` collection. Parent task logging adds parent information to nested task logs. Task log input is also now required and is stored as an empty object when a task has no input.
1653
1721
 
1654
- The `jobs.enableConcurrencyControl` and `jobs.addParentToTaskLog` options have been removed. Existing SQL projects that use jobs should generate a database migration for these schema changes.
1722
+ The `jobs.enableConcurrencyControl` and `jobs.addParentToTaskLog` options have been removed. The new fields are new columns on SQL adapters (see [Database migrations](#database-migrations)).
1655
1723
 
1656
1724
  ### Jobs: task and workflow types have been renamed
1657
1725
 
@@ -2156,18 +2224,33 @@ The `alwaysInsertFields` option (on `cloudStoragePlugin` and every `storage-*` a
2156
2224
 
2157
2225
  - Anyone with an upload collection that uses a storage adapter or `cloudStoragePlugin`. Every such collection now gets a hidden `prefix` field, including collections that never configured a `prefix` and collections where the plugin is disabled (`enabled: false`).
2158
2226
  - Anyone who set `alwaysInsertFields` explicitly — the option no longer exists on any storage adapter or plugin option type.
2159
- - Postgres, SQLite, and D1 users: the new field is a new database column. Running `payload migrate:create` will generate a migration that adds a `prefix` column to every affected collection's table.
2227
+ - Postgres, SQLite, and D1 users: the new field is a new `prefix` column on every affected collection's table (see [Database migrations](#database-migrations)).
2160
2228
 
2161
2229
  **How to migrate:**
2162
2230
 
2163
2231
  - Remove `alwaysInsertFields` from your storage adapter or `cloudStoragePlugin` config — it has no effect and no longer exists on the option types.
2164
- - For Postgres, SQLite, or D1 projects, run `payload migrate:create` to generate the migration that adds the `prefix` column, then run `payload migrate` to apply it.
2165
2232
 
2166
2233
  ### Upload collections retain originals and file history
2167
2234
 
2168
2235
  Upload collections now store `original` metadata and a `prefix` and `_objectKey` for each stored file (the main file, `original`, and each variant), so saved versions can find their files. New uploads keep their uploaded filename. With a storage adapter, each new file is stored under its own `_objectKey` folder, so update any code or infrastructure that relies on the old object key. When a processed main file and its original share a filename, request the original with `?original=true`; `original.url` already includes it. With local storage, the original gets a counter name instead (for example `photo-1.png`). Files saved by earlier v4 beta releases with an `-original` filename keep that name and are still served. Custom storage adapters should handle the new `params.isOriginal` in `staticHandler`; see [Custom Storage Adapters](../upload/storage-adapters#custom-storage-adapters).
2169
2236
 
2170
- **Postgres and SQLite:** after updating, run `payload migrate:create`, check that it adds these columns to each upload collection table and its versions table, then run `payload migrate`. Existing rows keep `null` values until their next write.
2237
+ On Postgres and SQLite, these are new columns on each upload collection table and its versions table (see [Database migrations](#database-migrations)). Existing rows keep `null` values until their next write.
2238
+
2239
+ ### Upload collections save crop and focal point edits in `_transforms`
2240
+
2241
+ Upload collections now have a `_transforms` JSON field that saves the crop and focal point, so an edit can start again from the retained original. See [Saved crop and focal point](../upload/overview#saved-crop-and-focal-point).
2242
+
2243
+ - `_transforms` is a reserved field name on upload collections. If an upload collection defines its own field named `_transforms`, rename it and move its data before you update.
2244
+ - `focalX` and `focalY` stay available and match `_transforms.focalPoint` when it is set. For a document saved before `_transforms` existed, the first write that saves `_transforms` copies its focal point into `_transforms`.
2245
+ - Replacing the file now sets `focalX` and `focalY` to the center, unless the request sends a new focal point. Before, the old values stayed on the document, but the new image sizes did not use them.
2246
+
2247
+ On Postgres and SQLite, `_transforms` is a new column on each upload collection table and its versions table (see [Database migrations](#database-migrations)). Existing rows keep `null` until their next write.
2248
+
2249
+ Upload collections also have a core-controlled `_stored` field on the main file, on `original`, and on each entry under `variants`. A value of `false` marks an entry with no stored object. A missing or `null` value means stored, so existing documents need no data backfill. Payload ignores client writes to this field. It is hidden in the Admin Panel, but can appear in API responses; it is not a field-level hidden value. See [Files with no stored default](../upload/transformers#files-with-no-stored-default).
2250
+
2251
+ `_stored` is now reserved for these file entries. If an upload collection already defines a custom `_stored` field, rename it and move its data, including data in saved versions, before upgrading. Remove the old custom values from `_stored`: existing `false` values would otherwise be treated as files with no stored object, and writes to the custom field would be ignored.
2252
+
2253
+ On Postgres and SQLite, `_stored` adds columns for file entries in each upload collection and its versions (see [Database migrations](#database-migrations)). Existing rows keep `null`.
2171
2254
 
2172
2255
  ### File size types have been consolidated ([#16593](https://github.com/payloadcms/payload/pull/16593))
2173
2256
 
@@ -16,7 +16,7 @@ Never report a task complete because the edit looks right. Confirm it. A silent
16
16
 
17
17
  ## 0. Preconditions
18
18
  - Work on a clean git tree or a fresh branch.
19
- - Use Node >=24.22.1 (the exact engines floor is printed by the command in step 2).
19
+ - Use Node ^24.22.3 || >=26.13.1 (the exact engines floor is printed by the command in step 2).
20
20
 
21
21
  ## 1. Pre-upgrade migrations (do these on v3, before touching versions)
22
22
  Some migrations need the v3 tooling that v4 deletes, so they MUST run before the upgrade:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/upgrade/prompt.ts"],"sourcesContent":["/**\n * Render the overarching agent prompt for a full Payload v3 -> v4 upgrade,\n * Next.js 16 included. The prompt is a thin orchestrator: it sequences the\n * gates, runs this package's `upgrade` command for the deterministic slice,\n * delegates Next.js to Next's own agent workflow, and points at the migration\n * guide for the judgment work rather than restating any of it. The text is\n * project-agnostic (the agent runs it from the project root). `command` is the\n * token that re-invokes this CLI, so a local checkout points followers at the\n * local build instead of the published package. Pure: the caller prints it.\n */\nexport function renderUpgradePrompt({\n command = 'npx @payloadcms/codemod',\n}: { command?: string } = {}): string {\n return `You are upgrading this project from Payload v3 to v4, Next.js 16 included.\n\nGround rule: resolution over intent. A step is done only when it installs, builds, and boots.\nNever report a task complete because the edit looks right. Confirm it. A silent gap reads as\n\"checked and fine\".\n\n## 0. Preconditions\n- Work on a clean git tree or a fresh branch.\n- Use Node >=24.22.1 (the exact engines floor is printed by the command in step 2).\n\n## 1. Pre-upgrade migrations (do these on v3, before touching versions)\nSome migrations need the v3 tooling that v4 deletes, so they MUST run before the upgrade:\n- Slate richtext is removed in v4. Migrate Slate -> Lexical while still on v3; the migration path\n is gone once the packages are pinned to v4.\n\nDo not proceed to step 2 until these are complete and committed.\n\n## 2. Payload mechanical slice\nRun this from the project root:\n\n ${command} upgrade run\n\nBy default it resolves Payload from the dist-tag this CLI was installed under (its own\nprerelease id, else \\`beta\\`). Add \\`--tag <dist-tag>\\` to pin a specific one.\nThis pins the Payload packages to v4, removes conflicting overrides, writes the toolchain\nfloors, installs, and runs the AST transforms. Read its report:\n- It prints the resolved payload version, the required Next target, and the path to the\n bundled runbook and migration guide. Use those paths below.\n- The unmet \\`@payloadcms/next\\` peer against Next 15 is EXPECTED at this point. Do NOT downgrade\n payload to satisfy it; step 3 resolves it by upgrading Next.\n- Do not hand-edit the versions it pinned.\n\n## 3. Next.js 16 (delegate to Next's workflow)\nPayload v4 requires Next 16. The command above did not touch Next. Run Next's own recommended\nagent workflow, which bumps Next + React and migrates the code as one unit:\n<https://nextjs.org/docs/app/guides/upgrading/version-16#use-an-ai-agent-recommended>\n\nIn short: run \\`npx @next/codemod@canary upgrade latest\\`, then\n\\`npx @next/codemod@canary next-async-request-api .\\`, and follow Next's AGENTS.md workflow for\nthe rest. Keep the result within the Next target range printed in step 2's report. Reinstall\nafterward so the \\`@payloadcms/next\\` peer resolves.\n\n## 4. Regenerate generated files\n\\`payload generate:types && payload generate:importmap\\`. Never hand-edit \\`payload-types.ts\\` or\n\\`importMap.js\\`; regenerate them.\n\n## 5. Fix-forward judgment work (against the now-v4 tree)\nThese depend on the v4 APIs and types existing, so they follow the upgrade. Open the bundled\nmigration guide (\\`v4.mdx\\`, path printed in step 2) and the bundled runbook\n(\\`runbook/payload-v4-upgrade.md\\`) and work the items they list: SCSS -> CSS and \\`--theme-*\\` ->\n\\`--color-*\\` token renames, Lexical union type-narrowing, jobs DB migrations, strict cron parsing,\nand anything flagged in the per-transform notes. Consult the guide for each; do not guess from\nmemory.\n\n## 6. Verify\n- \\`tsc --noEmit\\` (delete \\`tsconfig.tsbuildinfo\\` first; set \\`checkJs: true\\` so \\`importMap.js\\` is covered).\n- Run integration and e2e tests separately.\n- Build.\n- Confirm native modules (e.g. \\`sharp\\`) still load.\n\n## 7. Report\nDistinguish verified, cannot-confirm, and broken. Do not call the upgrade complete while any\ngate fails or any generated file is stale.\n`\n}\n"],"names":["renderUpgradePrompt","command"],"mappings":"AAAA;;;;;;;;;CASC,GACD,OAAO,SAASA,oBAAoB,EAClCC,UAAU,yBAAyB,EACd,GAAG,CAAC,CAAC;IAC1B,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;IAoBN,EAAEA,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2Cd,CAAC;AACD"}
1
+ {"version":3,"sources":["../../src/upgrade/prompt.ts"],"sourcesContent":["/**\n * Render the overarching agent prompt for a full Payload v3 -> v4 upgrade,\n * Next.js 16 included. The prompt is a thin orchestrator: it sequences the\n * gates, runs this package's `upgrade` command for the deterministic slice,\n * delegates Next.js to Next's own agent workflow, and points at the migration\n * guide for the judgment work rather than restating any of it. The text is\n * project-agnostic (the agent runs it from the project root). `command` is the\n * token that re-invokes this CLI, so a local checkout points followers at the\n * local build instead of the published package. Pure: the caller prints it.\n */\nexport function renderUpgradePrompt({\n command = 'npx @payloadcms/codemod',\n}: { command?: string } = {}): string {\n return `You are upgrading this project from Payload v3 to v4, Next.js 16 included.\n\nGround rule: resolution over intent. A step is done only when it installs, builds, and boots.\nNever report a task complete because the edit looks right. Confirm it. A silent gap reads as\n\"checked and fine\".\n\n## 0. Preconditions\n- Work on a clean git tree or a fresh branch.\n- Use Node ^24.22.3 || >=26.13.1 (the exact engines floor is printed by the command in step 2).\n\n## 1. Pre-upgrade migrations (do these on v3, before touching versions)\nSome migrations need the v3 tooling that v4 deletes, so they MUST run before the upgrade:\n- Slate richtext is removed in v4. Migrate Slate -> Lexical while still on v3; the migration path\n is gone once the packages are pinned to v4.\n\nDo not proceed to step 2 until these are complete and committed.\n\n## 2. Payload mechanical slice\nRun this from the project root:\n\n ${command} upgrade run\n\nBy default it resolves Payload from the dist-tag this CLI was installed under (its own\nprerelease id, else \\`beta\\`). Add \\`--tag <dist-tag>\\` to pin a specific one.\nThis pins the Payload packages to v4, removes conflicting overrides, writes the toolchain\nfloors, installs, and runs the AST transforms. Read its report:\n- It prints the resolved payload version, the required Next target, and the path to the\n bundled runbook and migration guide. Use those paths below.\n- The unmet \\`@payloadcms/next\\` peer against Next 15 is EXPECTED at this point. Do NOT downgrade\n payload to satisfy it; step 3 resolves it by upgrading Next.\n- Do not hand-edit the versions it pinned.\n\n## 3. Next.js 16 (delegate to Next's workflow)\nPayload v4 requires Next 16. The command above did not touch Next. Run Next's own recommended\nagent workflow, which bumps Next + React and migrates the code as one unit:\n<https://nextjs.org/docs/app/guides/upgrading/version-16#use-an-ai-agent-recommended>\n\nIn short: run \\`npx @next/codemod@canary upgrade latest\\`, then\n\\`npx @next/codemod@canary next-async-request-api .\\`, and follow Next's AGENTS.md workflow for\nthe rest. Keep the result within the Next target range printed in step 2's report. Reinstall\nafterward so the \\`@payloadcms/next\\` peer resolves.\n\n## 4. Regenerate generated files\n\\`payload generate:types && payload generate:importmap\\`. Never hand-edit \\`payload-types.ts\\` or\n\\`importMap.js\\`; regenerate them.\n\n## 5. Fix-forward judgment work (against the now-v4 tree)\nThese depend on the v4 APIs and types existing, so they follow the upgrade. Open the bundled\nmigration guide (\\`v4.mdx\\`, path printed in step 2) and the bundled runbook\n(\\`runbook/payload-v4-upgrade.md\\`) and work the items they list: SCSS -> CSS and \\`--theme-*\\` ->\n\\`--color-*\\` token renames, Lexical union type-narrowing, jobs DB migrations, strict cron parsing,\nand anything flagged in the per-transform notes. Consult the guide for each; do not guess from\nmemory.\n\n## 6. Verify\n- \\`tsc --noEmit\\` (delete \\`tsconfig.tsbuildinfo\\` first; set \\`checkJs: true\\` so \\`importMap.js\\` is covered).\n- Run integration and e2e tests separately.\n- Build.\n- Confirm native modules (e.g. \\`sharp\\`) still load.\n\n## 7. Report\nDistinguish verified, cannot-confirm, and broken. Do not call the upgrade complete while any\ngate fails or any generated file is stale.\n`\n}\n"],"names":["renderUpgradePrompt","command"],"mappings":"AAAA;;;;;;;;;CASC,GACD,OAAO,SAASA,oBAAoB,EAClCC,UAAU,yBAAyB,EACd,GAAG,CAAC,CAAC;IAC1B,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;IAoBN,EAAEA,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2Cd,CAAC;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/codemod",
3
- "version": "4.0.0-beta.7",
3
+ "version": "4.0.0-beta.9",
4
4
  "description": "Codemods for migrating Payload projects across versions.",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "vitest": "5.0.1"
43
43
  },
44
44
  "engines": {
45
- "node": ">=24.22.1"
45
+ "node": "^24.22.3 || >=26.13.1"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "pnpm typecheck && pnpm build:swc && pnpm build:copy-docs",