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

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 (260) hide show
  1. package/README.md +88 -28
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +41 -27
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cli.parseFlags.d.ts +14 -0
  6. package/dist/cli.parseFlags.d.ts.map +1 -1
  7. package/dist/cli.parseFlags.js +29 -2
  8. package/dist/cli.parseFlags.js.map +1 -1
  9. package/dist/registry.d.ts.map +1 -1
  10. package/dist/registry.js +6 -0
  11. package/dist/registry.js.map +1 -1
  12. package/dist/runbook/payload-v4-upgrade.md +55 -0
  13. package/dist/runbook/v4.mdx +2040 -0
  14. package/dist/transforms/add-override-access-true/basic.input.js +41 -0
  15. package/dist/transforms/add-override-access-true/basic.input.js.map +1 -0
  16. package/dist/transforms/add-override-access-true/basic.output.js +50 -0
  17. package/dist/transforms/add-override-access-true/basic.output.js.map +1 -0
  18. package/dist/transforms/add-override-access-true/comment-between-properties.input.js +11 -0
  19. package/dist/transforms/add-override-access-true/comment-between-properties.input.js.map +1 -0
  20. package/dist/transforms/add-override-access-true/comment-between-properties.output.js +12 -0
  21. package/dist/transforms/add-override-access-true/comment-between-properties.output.js.map +1 -0
  22. package/dist/transforms/add-override-access-true/index.d.ts +20 -0
  23. package/dist/transforms/add-override-access-true/index.d.ts.map +1 -0
  24. package/dist/transforms/add-override-access-true/index.js +208 -0
  25. package/dist/transforms/add-override-access-true/index.js.map +1 -0
  26. package/dist/transforms/add-override-access-true/javascript.input.d.ts +6 -0
  27. package/dist/transforms/add-override-access-true/javascript.input.d.ts.map +1 -0
  28. package/dist/transforms/add-override-access-true/javascript.input.js +24 -0
  29. package/dist/transforms/add-override-access-true/javascript.input.js.map +1 -0
  30. package/dist/transforms/add-override-access-true/javascript.output.d.ts +6 -0
  31. package/dist/transforms/add-override-access-true/javascript.output.d.ts.map +1 -0
  32. package/dist/transforms/add-override-access-true/javascript.output.js +26 -0
  33. package/dist/transforms/add-override-access-true/javascript.output.js.map +1 -0
  34. package/dist/transforms/add-override-access-true/non-matching.input.js +42 -0
  35. package/dist/transforms/add-override-access-true/non-matching.input.js.map +1 -0
  36. package/dist/transforms/add-override-access-true/non-matching.output.js +42 -0
  37. package/dist/transforms/add-override-access-true/non-matching.output.js.map +1 -0
  38. package/dist/transforms/add-override-access-true/single-line.input.js +13 -0
  39. package/dist/transforms/add-override-access-true/single-line.input.js.map +1 -0
  40. package/dist/transforms/add-override-access-true/single-line.output.js +17 -0
  41. package/dist/transforms/add-override-access-true/single-line.output.js.map +1 -0
  42. package/dist/transforms/add-override-access-true/trailing-comment.input.js +10 -0
  43. package/dist/transforms/add-override-access-true/trailing-comment.input.js.map +1 -0
  44. package/dist/transforms/add-override-access-true/trailing-comment.output.js +12 -0
  45. package/dist/transforms/add-override-access-true/trailing-comment.output.js.map +1 -0
  46. package/dist/transforms/migrate-aliased-exports/index.js +2 -3
  47. package/dist/transforms/migrate-aliased-exports/index.js.map +1 -1
  48. package/dist/transforms/migrate-versions-default/index.js +5 -5
  49. package/dist/transforms/migrate-versions-default/index.js.map +1 -1
  50. package/dist/transforms/remove-default-locale-publish-option/all-value.input.js +13 -0
  51. package/dist/transforms/remove-default-locale-publish-option/all-value.input.js.map +1 -0
  52. package/dist/transforms/remove-default-locale-publish-option/basic.input.js +13 -0
  53. package/dist/transforms/remove-default-locale-publish-option/basic.input.js.map +1 -0
  54. package/dist/transforms/remove-default-locale-publish-option/basic.output.js +12 -0
  55. package/dist/transforms/remove-default-locale-publish-option/basic.output.js.map +1 -0
  56. package/dist/transforms/remove-default-locale-publish-option/dynamic.input.js +17 -0
  57. package/dist/transforms/remove-default-locale-publish-option/dynamic.input.js.map +1 -0
  58. package/dist/transforms/remove-default-locale-publish-option/index.d.ts +10 -0
  59. package/dist/transforms/remove-default-locale-publish-option/index.d.ts.map +1 -0
  60. package/dist/transforms/remove-default-locale-publish-option/index.js +103 -0
  61. package/dist/transforms/remove-default-locale-publish-option/index.js.map +1 -0
  62. package/dist/transforms/remove-default-locale-publish-option/no-match.input.js +10 -0
  63. package/dist/transforms/remove-default-locale-publish-option/no-match.input.js.map +1 -0
  64. package/dist/transforms/remove-default-locale-publish-option/no-match.output.js +10 -0
  65. package/dist/transforms/remove-default-locale-publish-option/no-match.output.js.map +1 -0
  66. package/dist/transforms/remove-default-locale-publish-option/reassigned.input.js +22 -0
  67. package/dist/transforms/remove-default-locale-publish-option/reassigned.input.js.map +1 -0
  68. package/dist/transforms/remove-default-locale-publish-option/shorthand.input.js +14 -0
  69. package/dist/transforms/remove-default-locale-publish-option/shorthand.input.js.map +1 -0
  70. package/dist/transforms/remove-default-locale-publish-option/shorthand.output.js +13 -0
  71. package/dist/transforms/remove-default-locale-publish-option/shorthand.output.js.map +1 -0
  72. package/dist/transforms/remove-publish-specific-locale/index.d.ts.map +1 -1
  73. package/dist/transforms/remove-publish-specific-locale/index.js.map +1 -1
  74. package/dist/transforms/remove-storage-always-insert-fields/aliased.input.js +11 -0
  75. package/dist/transforms/remove-storage-always-insert-fields/aliased.input.js.map +1 -0
  76. package/dist/transforms/remove-storage-always-insert-fields/aliased.output.js +10 -0
  77. package/dist/transforms/remove-storage-always-insert-fields/aliased.output.js.map +1 -0
  78. package/dist/transforms/remove-storage-always-insert-fields/basic.input.js +54 -0
  79. package/dist/transforms/remove-storage-always-insert-fields/basic.input.js.map +1 -0
  80. package/dist/transforms/remove-storage-always-insert-fields/basic.output.js +48 -0
  81. package/dist/transforms/remove-storage-always-insert-fields/basic.output.js.map +1 -0
  82. package/dist/transforms/remove-storage-always-insert-fields/index.d.ts +3 -0
  83. package/dist/transforms/remove-storage-always-insert-fields/index.d.ts.map +1 -0
  84. package/dist/transforms/remove-storage-always-insert-fields/index.js +71 -0
  85. package/dist/transforms/remove-storage-always-insert-fields/index.js.map +1 -0
  86. package/dist/transforms/remove-storage-always-insert-fields/no-match.input.js +27 -0
  87. package/dist/transforms/remove-storage-always-insert-fields/no-match.input.js.map +1 -0
  88. package/dist/transforms/remove-storage-always-insert-fields/no-match.output.js +27 -0
  89. package/dist/transforms/remove-storage-always-insert-fields/no-match.output.js.map +1 -0
  90. package/dist/transforms/remove-versions-true/index.js +4 -4
  91. package/dist/transforms/remove-versions-true/index.js.map +1 -1
  92. package/dist/upgrade/defaultTag.d.ts +9 -0
  93. package/dist/upgrade/defaultTag.d.ts.map +1 -0
  94. package/dist/upgrade/defaultTag.js +25 -0
  95. package/dist/upgrade/defaultTag.js.map +1 -0
  96. package/dist/upgrade/detectPackageManager.d.ts +8 -0
  97. package/dist/upgrade/detectPackageManager.d.ts.map +1 -0
  98. package/dist/upgrade/detectPackageManager.js +38 -0
  99. package/dist/upgrade/detectPackageManager.js.map +1 -0
  100. package/dist/upgrade/dispatch.d.ts +38 -0
  101. package/dist/upgrade/dispatch.d.ts.map +1 -0
  102. package/dist/upgrade/dispatch.js +132 -0
  103. package/dist/upgrade/dispatch.js.map +1 -0
  104. package/dist/upgrade/index.d.ts +25 -0
  105. package/dist/upgrade/index.d.ts.map +1 -0
  106. package/dist/upgrade/index.js +209 -0
  107. package/dist/upgrade/index.js.map +1 -0
  108. package/dist/upgrade/prompt.d.ts +14 -0
  109. package/dist/upgrade/prompt.d.ts.map +1 -0
  110. package/dist/upgrade/prompt.js +77 -0
  111. package/dist/upgrade/prompt.js.map +1 -0
  112. package/dist/upgrade/report.d.ts +21 -0
  113. package/dist/upgrade/report.d.ts.map +1 -0
  114. package/dist/upgrade/report.js +47 -0
  115. package/dist/upgrade/report.js.map +1 -0
  116. package/dist/upgrade/resolveVersions.d.ts +13 -0
  117. package/dist/upgrade/resolveVersions.d.ts.map +1 -0
  118. package/dist/upgrade/resolveVersions.js +55 -0
  119. package/dist/upgrade/resolveVersions.js.map +1 -0
  120. package/dist/upgrade/rewritePackageJson.d.ts +32 -0
  121. package/dist/upgrade/rewritePackageJson.d.ts.map +1 -0
  122. package/dist/upgrade/rewritePackageJson.js +123 -0
  123. package/dist/upgrade/rewritePackageJson.js.map +1 -0
  124. package/dist/upgrade/runInstall.d.ts +16 -0
  125. package/dist/upgrade/runInstall.d.ts.map +1 -0
  126. package/dist/upgrade/runInstall.js +17 -0
  127. package/dist/upgrade/runInstall.js.map +1 -0
  128. package/dist/upgrade/selectAgent.d.ts +45 -0
  129. package/dist/upgrade/selectAgent.d.ts.map +1 -0
  130. package/dist/upgrade/selectAgent.js +54 -0
  131. package/dist/upgrade/selectAgent.js.map +1 -0
  132. package/dist/upgrade/selfCommand.d.ts +13 -0
  133. package/dist/upgrade/selfCommand.d.ts.map +1 -0
  134. package/dist/upgrade/selfCommand.js +17 -0
  135. package/dist/upgrade/selfCommand.js.map +1 -0
  136. package/dist/upgrade/types.d.ts +47 -0
  137. package/dist/upgrade/types.d.ts.map +1 -0
  138. package/dist/upgrade/types.js +11 -0
  139. package/dist/upgrade/types.js.map +1 -0
  140. package/dist/utils/project.d.ts +4 -0
  141. package/dist/utils/project.d.ts.map +1 -0
  142. package/dist/utils/project.js +30 -0
  143. package/dist/utils/project.js.map +1 -0
  144. package/package.json +8 -4
  145. package/dist/cli.parseFlags.spec.d.ts +0 -2
  146. package/dist/cli.parseFlags.spec.d.ts.map +0 -1
  147. package/dist/cli.parseFlags.spec.js +0 -49
  148. package/dist/cli.parseFlags.spec.js.map +0 -1
  149. package/dist/runner.spec.d.ts +0 -2
  150. package/dist/runner.spec.d.ts.map +0 -1
  151. package/dist/runner.spec.js +0 -88
  152. package/dist/runner.spec.js.map +0 -1
  153. package/dist/transforms/example-noop/index.spec.d.ts +0 -2
  154. package/dist/transforms/example-noop/index.spec.d.ts.map +0 -1
  155. package/dist/transforms/example-noop/index.spec.js +0 -29
  156. package/dist/transforms/example-noop/index.spec.js.map +0 -1
  157. package/dist/transforms/globals-components-edit/index.spec.d.ts +0 -2
  158. package/dist/transforms/globals-components-edit/index.spec.d.ts.map +0 -1
  159. package/dist/transforms/globals-components-edit/index.spec.js +0 -37
  160. package/dist/transforms/globals-components-edit/index.spec.js.map +0 -1
  161. package/dist/transforms/migrate-after-operation-read/index.spec.d.ts +0 -2
  162. package/dist/transforms/migrate-after-operation-read/index.spec.d.ts.map +0 -1
  163. package/dist/transforms/migrate-after-operation-read/index.spec.js +0 -62
  164. package/dist/transforms/migrate-after-operation-read/index.spec.js.map +0 -1
  165. package/dist/transforms/migrate-aliased-exports/index.spec.d.ts +0 -2
  166. package/dist/transforms/migrate-aliased-exports/index.spec.d.ts.map +0 -1
  167. package/dist/transforms/migrate-aliased-exports/index.spec.js +0 -55
  168. package/dist/transforms/migrate-aliased-exports/index.spec.js.map +0 -1
  169. package/dist/transforms/migrate-azure-chunk-large-files/index.spec.d.ts +0 -2
  170. package/dist/transforms/migrate-azure-chunk-large-files/index.spec.d.ts.map +0 -1
  171. package/dist/transforms/migrate-azure-chunk-large-files/index.spec.js +0 -67
  172. package/dist/transforms/migrate-azure-chunk-large-files/index.spec.js.map +0 -1
  173. package/dist/transforms/migrate-block-references-to-blocks/index.spec.d.ts +0 -2
  174. package/dist/transforms/migrate-block-references-to-blocks/index.spec.d.ts.map +0 -1
  175. package/dist/transforms/migrate-block-references-to-blocks/index.spec.js +0 -45
  176. package/dist/transforms/migrate-block-references-to-blocks/index.spec.js.map +0 -1
  177. package/dist/transforms/migrate-build-script/index.spec.d.ts +0 -2
  178. package/dist/transforms/migrate-build-script/index.spec.d.ts.map +0 -1
  179. package/dist/transforms/migrate-build-script/index.spec.js +0 -81
  180. package/dist/transforms/migrate-build-script/index.spec.js.map +0 -1
  181. package/dist/transforms/migrate-db-types-subpath/index.spec.d.ts +0 -2
  182. package/dist/transforms/migrate-db-types-subpath/index.spec.d.ts.map +0 -1
  183. package/dist/transforms/migrate-db-types-subpath/index.spec.js +0 -46
  184. package/dist/transforms/migrate-db-types-subpath/index.spec.js.map +0 -1
  185. package/dist/transforms/migrate-disabled-fields/index.spec.d.ts +0 -2
  186. package/dist/transforms/migrate-disabled-fields/index.spec.d.ts.map +0 -1
  187. package/dist/transforms/migrate-disabled-fields/index.spec.js +0 -73
  188. package/dist/transforms/migrate-disabled-fields/index.spec.js.map +0 -1
  189. package/dist/transforms/migrate-document-title-context/index.spec.d.ts +0 -2
  190. package/dist/transforms/migrate-document-title-context/index.spec.d.ts.map +0 -1
  191. package/dist/transforms/migrate-document-title-context/index.spec.js +0 -86
  192. package/dist/transforms/migrate-document-title-context/index.spec.js.map +0 -1
  193. package/dist/transforms/migrate-force-select/index.spec.d.ts +0 -2
  194. package/dist/transforms/migrate-force-select/index.spec.d.ts.map +0 -1
  195. package/dist/transforms/migrate-force-select/index.spec.js +0 -107
  196. package/dist/transforms/migrate-force-select/index.spec.js.map +0 -1
  197. package/dist/transforms/migrate-hide-api-url/index.spec.d.ts +0 -2
  198. package/dist/transforms/migrate-hide-api-url/index.spec.d.ts.map +0 -1
  199. package/dist/transforms/migrate-hide-api-url/index.spec.js +0 -118
  200. package/dist/transforms/migrate-hide-api-url/index.spec.js.map +0 -1
  201. package/dist/transforms/migrate-import-export-hooks/index.spec.d.ts +0 -2
  202. package/dist/transforms/migrate-import-export-hooks/index.spec.d.ts.map +0 -1
  203. package/dist/transforms/migrate-import-export-hooks/index.spec.js +0 -65
  204. package/dist/transforms/migrate-import-export-hooks/index.spec.js.map +0 -1
  205. package/dist/transforms/migrate-list-view-select-api/index.spec.d.ts +0 -2
  206. package/dist/transforms/migrate-list-view-select-api/index.spec.d.ts.map +0 -1
  207. package/dist/transforms/migrate-list-view-select-api/index.spec.js +0 -37
  208. package/dist/transforms/migrate-list-view-select-api/index.spec.js.map +0 -1
  209. package/dist/transforms/migrate-next-generate-viewport-export/index.spec.d.ts +0 -2
  210. package/dist/transforms/migrate-next-generate-viewport-export/index.spec.d.ts.map +0 -1
  211. package/dist/transforms/migrate-next-generate-viewport-export/index.spec.js +0 -41
  212. package/dist/transforms/migrate-next-generate-viewport-export/index.spec.js.map +0 -1
  213. package/dist/transforms/migrate-next-subpath-exports/index.spec.d.ts +0 -2
  214. package/dist/transforms/migrate-next-subpath-exports/index.spec.d.ts.map +0 -1
  215. package/dist/transforms/migrate-next-subpath-exports/index.spec.js +0 -46
  216. package/dist/transforms/migrate-next-subpath-exports/index.spec.js.map +0 -1
  217. package/dist/transforms/migrate-slug-field/index.spec.d.ts +0 -2
  218. package/dist/transforms/migrate-slug-field/index.spec.d.ts.map +0 -1
  219. package/dist/transforms/migrate-slug-field/index.spec.js +0 -47
  220. package/dist/transforms/migrate-slug-field/index.spec.js.map +0 -1
  221. package/dist/transforms/migrate-storage-adapters-to-config/index.spec.d.ts +0 -2
  222. package/dist/transforms/migrate-storage-adapters-to-config/index.spec.d.ts.map +0 -1
  223. package/dist/transforms/migrate-storage-adapters-to-config/index.spec.js +0 -85
  224. package/dist/transforms/migrate-storage-adapters-to-config/index.spec.js.map +0 -1
  225. package/dist/transforms/migrate-versions-default/index.spec.d.ts +0 -2
  226. package/dist/transforms/migrate-versions-default/index.spec.d.ts.map +0 -1
  227. package/dist/transforms/migrate-versions-default/index.spec.js +0 -81
  228. package/dist/transforms/migrate-versions-default/index.spec.js.map +0 -1
  229. package/dist/transforms/remove-group-by-true/index.spec.d.ts +0 -2
  230. package/dist/transforms/remove-group-by-true/index.spec.d.ts.map +0 -1
  231. package/dist/transforms/remove-group-by-true/index.spec.js +0 -47
  232. package/dist/transforms/remove-group-by-true/index.spec.js.map +0 -1
  233. package/dist/transforms/remove-localize-status-config/index.spec.d.ts +0 -2
  234. package/dist/transforms/remove-localize-status-config/index.spec.d.ts.map +0 -1
  235. package/dist/transforms/remove-localize-status-config/index.spec.js +0 -38
  236. package/dist/transforms/remove-localize-status-config/index.spec.js.map +0 -1
  237. package/dist/transforms/remove-publish-specific-locale/index.spec.d.ts +0 -2
  238. package/dist/transforms/remove-publish-specific-locale/index.spec.d.ts.map +0 -1
  239. package/dist/transforms/remove-publish-specific-locale/index.spec.js +0 -47
  240. package/dist/transforms/remove-publish-specific-locale/index.spec.js.map +0 -1
  241. package/dist/transforms/remove-versions-true/index.spec.d.ts +0 -2
  242. package/dist/transforms/remove-versions-true/index.spec.d.ts.map +0 -1
  243. package/dist/transforms/remove-versions-true/index.spec.js +0 -38
  244. package/dist/transforms/remove-versions-true/index.spec.js.map +0 -1
  245. package/dist/transforms/rename-experimental-table-feature/index.spec.d.ts +0 -2
  246. package/dist/transforms/rename-experimental-table-feature/index.spec.d.ts.map +0 -1
  247. package/dist/transforms/rename-experimental-table-feature/index.spec.js +0 -54
  248. package/dist/transforms/rename-experimental-table-feature/index.spec.js.map +0 -1
  249. package/dist/transforms/rename-storage-adapters-to-storage/index.spec.d.ts +0 -2
  250. package/dist/transforms/rename-storage-adapters-to-storage/index.spec.d.ts.map +0 -1
  251. package/dist/transforms/rename-storage-adapters-to-storage/index.spec.js +0 -55
  252. package/dist/transforms/rename-storage-adapters-to-storage/index.spec.js.map +0 -1
  253. package/dist/transforms/rename-typescript-schema-to-json-schema/index.spec.d.ts +0 -2
  254. package/dist/transforms/rename-typescript-schema-to-json-schema/index.spec.d.ts.map +0 -1
  255. package/dist/transforms/rename-typescript-schema-to-json-schema/index.spec.js +0 -45
  256. package/dist/transforms/rename-typescript-schema-to-json-schema/index.spec.js.map +0 -1
  257. package/dist/utils/packageJson.spec.d.ts +0 -2
  258. package/dist/utils/packageJson.spec.d.ts.map +0 -1
  259. package/dist/utils/packageJson.spec.js +0 -41
  260. package/dist/utils/packageJson.spec.js.map +0 -1
@@ -0,0 +1,10 @@
1
+ // A trailing comment after the last property previously caused a double comma.
2
+ const doc = await payload.findByID({
3
+ id: first.id,
4
+ collection
5
+ });
6
+ const posts = await payload.find({
7
+ collection: 'posts'
8
+ });
9
+
10
+ //# sourceMappingURL=trailing-comment.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/add-override-access-true/trailing-comment.input.ts"],"sourcesContent":["// A trailing comment after the last property previously caused a double comma.\nconst doc = await payload.findByID({\n id: first.id,\n collection,\n // omitting req for isolation\n})\n\nconst posts = await payload.find({\n collection: 'posts',\n // no req on purpose\n})\n"],"names":["doc","payload","findByID","id","first","collection","posts","find"],"mappings":"AAAA,+EAA+E;AAC/E,MAAMA,MAAM,MAAMC,QAAQC,QAAQ,CAAC;IACjCC,IAAIC,MAAMD,EAAE;IACZE;AAEF;AAEA,MAAMC,QAAQ,MAAML,QAAQM,IAAI,CAAC;IAC/BF,YAAY;AAEd"}
@@ -0,0 +1,12 @@
1
+ // A trailing comment after the last property previously caused a double comma.
2
+ const doc = await payload.findByID({
3
+ id: first.id,
4
+ collection,
5
+ overrideAccess: true
6
+ });
7
+ const posts = await payload.find({
8
+ collection: 'posts',
9
+ overrideAccess: true
10
+ });
11
+
12
+ //# sourceMappingURL=trailing-comment.output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/add-override-access-true/trailing-comment.output.ts"],"sourcesContent":["// A trailing comment after the last property previously caused a double comma.\nconst doc = await payload.findByID({\n id: first.id,\n collection,\n overrideAccess: true,\n // omitting req for isolation\n})\n\nconst posts = await payload.find({\n collection: 'posts',\n overrideAccess: true,\n // no req on purpose\n})\n"],"names":["doc","payload","findByID","id","first","collection","overrideAccess","posts","find"],"mappings":"AAAA,+EAA+E;AAC/E,MAAMA,MAAM,MAAMC,QAAQC,QAAQ,CAAC;IACjCC,IAAIC,MAAMD,EAAE;IACZE;IACAC,gBAAgB;AAElB;AAEA,MAAMC,QAAQ,MAAMN,QAAQO,IAAI,CAAC;IAC/BH,YAAY;IACZC,gBAAgB;AAElB"}
@@ -96,8 +96,7 @@ export const migrateAliasedExports = {
96
96
  migration,
97
97
  notes,
98
98
  sourceFile: file,
99
- spec,
100
- target: target
99
+ spec
101
100
  });
102
101
  }
103
102
  mutated = true;
@@ -148,7 +147,7 @@ export const migrateAliasedExports = {
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
149
  };
151
- function applyRename({ migration, notes, sourceFile, spec, target }) {
150
+ function applyRename({ migration, notes, sourceFile, spec }) {
152
151
  if (!migration.rename) {
153
152
  return;
154
153
  }
@@ -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, target: target! })\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 target: string\n}\n\nfunction applyRename({ migration, notes, sourceFile, spec, target }: 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;IAC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AAMmC,aAAatD,KAChBI,qBAAqB,GACrBmD,MAAM,CAAC,CAACC,OAASA,KAAKlD,uBAAuB,OAAOa;IAEvD,IAAImC,WAAWvC,MAAM,KAAK,GAAG;QAC3B,OAAOe;IACT;IAEA,IAAIP,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"}
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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QA,SAASiB,mBAAmB,EAC1B9C,IAAI,EACJuB,UAAU,EACVJ,MAAM,EACiB;IACvB,MAAMmC,aAAatD,KAChBI,qBAAqB,GACrBmD,MAAM,CAAC,CAACC,OAASA,KAAKlD,uBAAuB,OAAOa;IAEvD,IAAImC,WAAWvC,MAAM,KAAK,GAAG;QAC3B,OAAOe;IACT;IAEA,IAAIP,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"}
@@ -1,4 +1,4 @@
1
- import { Node, SyntaxKind } from 'ts-morph';
1
+ import { Node } from 'ts-morph';
2
2
  const VERSIONED_CONFIG_TYPE_NAMES = new Set([
3
3
  'CollectionConfig',
4
4
  'GlobalConfig',
@@ -69,8 +69,8 @@ const isVersionedConfigTypeName = (typeText)=>{
69
69
  return undefined;
70
70
  }
71
71
  // Form 2: { ... } satisfies CollectionConfig
72
- if (node.getKind() === SyntaxKind.SatisfiesExpression) {
73
- const typeNode = node.getTypeNode?.();
72
+ if (Node.isSatisfiesExpression(node)) {
73
+ const typeNode = node.getTypeNode();
74
74
  if (!typeNode) {
75
75
  return undefined;
76
76
  }
@@ -78,8 +78,8 @@ const isVersionedConfigTypeName = (typeText)=>{
78
78
  if (!isVersionedConfigTypeName(typeText)) {
79
79
  return undefined;
80
80
  }
81
- const expr = node.getExpression?.();
82
- if (expr && Node.isObjectLiteralExpression(expr)) {
81
+ const expr = node.getExpression();
82
+ if (Node.isObjectLiteralExpression(expr)) {
83
83
  return expr;
84
84
  }
85
85
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/transforms/migrate-versions-default/index.ts"],"sourcesContent":["import { Node, SyntaxKind } from 'ts-morph'\n\nimport type { Transform } from '../../types.js'\n\nconst VERSIONED_CONFIG_TYPE_NAMES = new Set([\n 'CollectionConfig',\n 'GlobalConfig',\n 'SanitizedCollectionConfig',\n 'SanitizedGlobalConfig',\n])\n\nconst isVersionedConfigTypeName = (typeText: string): boolean => {\n const baseName = typeText.replace(/<.*>$/, '').trim()\n return VERSIONED_CONFIG_TYPE_NAMES.has(baseName)\n}\n\n/**\n * Finds object literals typed as CollectionConfig or GlobalConfig and adds\n * `versions: false` if the property is absent. Covers three annotation forms:\n * const X: CollectionConfig = { ... }\n * { ... } satisfies GlobalConfig\n * { ... } as CollectionConfig\n */\nexport const migrateVersionsDefault: Transform = {\n name: 'migrate-versions-default',\n apply: ({ project }) => {\n const filesChanged = new Set<string>()\n\n for (const sourceFile of project.getSourceFiles()) {\n let mutated = false\n\n sourceFile.forEachDescendant((node) => {\n const objectLiteral = resolveVersionedConfigObject(node)\n if (!objectLiteral) {\n return\n }\n\n if (objectLiteral.getProperty('versions')) {\n return\n }\n\n objectLiteral.addPropertyAssignment({\n name: 'versions',\n initializer: 'false',\n })\n\n mutated = true\n })\n\n if (mutated) {\n filesChanged.add(sourceFile.getFilePath())\n }\n }\n\n return { filesChanged: [...filesChanged] }\n },\n description:\n 'Add `versions: false` to CollectionConfig and GlobalConfig objects that do not already have a versions property, preserving the previous opt-in behaviour after versions became enabled by default.',\n}\n\n/**\n * Given a node, returns its ObjectLiteralExpression if the node represents a\n * CollectionConfig- or GlobalConfig-typed value in one of the three recognised forms.\n * Returns undefined for everything else.\n */\nconst resolveVersionedConfigObject = (node: Node) => {\n // Form 1: const X: CollectionConfig = { ... }\n if (Node.isVariableDeclaration(node)) {\n const typeNode = node.getTypeNode()\n if (!typeNode) {\n return undefined\n }\n const typeText = typeNode.getText().trim()\n if (!isVersionedConfigTypeName(typeText)) {\n return undefined\n }\n const initializer = node.getInitializer()\n if (initializer && Node.isObjectLiteralExpression(initializer)) {\n return initializer\n }\n return undefined\n }\n\n // Form 2: { ... } satisfies CollectionConfig\n if (node.getKind() === SyntaxKind.SatisfiesExpression) {\n const typeNode = (node as any).getTypeNode?.()\n if (!typeNode) {\n return undefined\n }\n const typeText = typeNode.getText().trim()\n if (!isVersionedConfigTypeName(typeText)) {\n return undefined\n }\n const expr = (node as any).getExpression?.()\n if (expr && Node.isObjectLiteralExpression(expr)) {\n return expr\n }\n return undefined\n }\n\n // Form 3: { ... } as CollectionConfig\n if (Node.isAsExpression(node)) {\n const typeNode = node.getTypeNode()\n if (!typeNode) {\n return undefined\n }\n const typeText = typeNode.getText().trim()\n if (!isVersionedConfigTypeName(typeText)) {\n return undefined\n }\n const expr = node.getExpression()\n if (Node.isObjectLiteralExpression(expr)) {\n return expr\n }\n return undefined\n }\n\n return undefined\n}\n"],"names":["Node","SyntaxKind","VERSIONED_CONFIG_TYPE_NAMES","Set","isVersionedConfigTypeName","typeText","baseName","replace","trim","has","migrateVersionsDefault","name","apply","project","filesChanged","sourceFile","getSourceFiles","mutated","forEachDescendant","node","objectLiteral","resolveVersionedConfigObject","getProperty","addPropertyAssignment","initializer","add","getFilePath","description","isVariableDeclaration","typeNode","getTypeNode","undefined","getText","getInitializer","isObjectLiteralExpression","getKind","SatisfiesExpression","expr","getExpression","isAsExpression"],"mappings":"AAAA,SAASA,IAAI,EAAEC,UAAU,QAAQ,WAAU;AAI3C,MAAMC,8BAA8B,IAAIC,IAAI;IAC1C;IACA;IACA;IACA;CACD;AAED,MAAMC,4BAA4B,CAACC;IACjC,MAAMC,WAAWD,SAASE,OAAO,CAAC,SAAS,IAAIC,IAAI;IACnD,OAAON,4BAA4BO,GAAG,CAACH;AACzC;AAEA;;;;;;CAMC,GACD,OAAO,MAAMI,yBAAoC;IAC/CC,MAAM;IACNC,OAAO,CAAC,EAAEC,OAAO,EAAE;QACjB,MAAMC,eAAe,IAAIX;QAEzB,KAAK,MAAMY,cAAcF,QAAQG,cAAc,GAAI;YACjD,IAAIC,UAAU;YAEdF,WAAWG,iBAAiB,CAAC,CAACC;gBAC5B,MAAMC,gBAAgBC,6BAA6BF;gBACnD,IAAI,C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WwB,SAASG,OAAO,GAAGxB,IAAI;QACxC,IAAI,CAACJ,0BAA0BC,WAAW;YACxC,OAAO0B;QACT;QACA,MAAMM,OAAOlB,KAAKmB,aAAa;QAC/B,IAAItC,KAAKkC,yBAAyB,CAACG,OAAO;YACxC,OAAOA;QACT;QACA,OAAON;IACT;IAEA,OAAOA;AACT"}
1
+ {"version":3,"sources":["../../../src/transforms/migrate-versions-default/index.ts"],"sourcesContent":["import { Node } from 'ts-morph'\n\nimport type { Transform } from '../../types.js'\n\nconst VERSIONED_CONFIG_TYPE_NAMES = new Set([\n 'CollectionConfig',\n 'GlobalConfig',\n 'SanitizedCollectionConfig',\n 'SanitizedGlobalConfig',\n])\n\nconst isVersionedConfigTypeName = (typeText: string): boolean => {\n const baseName = typeText.replace(/<.*>$/, '').trim()\n return VERSIONED_CONFIG_TYPE_NAMES.has(baseName)\n}\n\n/**\n * Finds object literals typed as CollectionConfig or GlobalConfig and adds\n * `versions: false` if the property is absent. Covers three annotation forms:\n * const X: CollectionConfig = { ... }\n * { ... } satisfies GlobalConfig\n * { ... } as CollectionConfig\n */\nexport const migrateVersionsDefault: Transform = {\n name: 'migrate-versions-default',\n apply: ({ project }) => {\n const filesChanged = new Set<string>()\n\n for (const sourceFile of project.getSourceFiles()) {\n let mutated = false\n\n sourceFile.forEachDescendant((node) => {\n const objectLiteral = resolveVersionedConfigObject(node)\n if (!objectLiteral) {\n return\n }\n\n if (objectLiteral.getProperty('versions')) {\n return\n }\n\n objectLiteral.addPropertyAssignment({\n name: 'versions',\n initializer: 'false',\n })\n\n mutated = true\n })\n\n if (mutated) {\n filesChanged.add(sourceFile.getFilePath())\n }\n }\n\n return { filesChanged: [...filesChanged] }\n },\n description:\n 'Add `versions: false` to CollectionConfig and GlobalConfig objects that do not already have a versions property, preserving the previous opt-in behaviour after versions became enabled by default.',\n}\n\n/**\n * Given a node, returns its ObjectLiteralExpression if the node represents a\n * CollectionConfig- or GlobalConfig-typed value in one of the three recognised forms.\n * Returns undefined for everything else.\n */\nconst resolveVersionedConfigObject = (node: Node) => {\n // Form 1: const X: CollectionConfig = { ... }\n if (Node.isVariableDeclaration(node)) {\n const typeNode = node.getTypeNode()\n if (!typeNode) {\n return undefined\n }\n const typeText = typeNode.getText().trim()\n if (!isVersionedConfigTypeName(typeText)) {\n return undefined\n }\n const initializer = node.getInitializer()\n if (initializer && Node.isObjectLiteralExpression(initializer)) {\n return initializer\n }\n return undefined\n }\n\n // Form 2: { ... } satisfies CollectionConfig\n if (Node.isSatisfiesExpression(node)) {\n const typeNode = node.getTypeNode()\n if (!typeNode) {\n return undefined\n }\n const typeText = typeNode.getText().trim()\n if (!isVersionedConfigTypeName(typeText)) {\n return undefined\n }\n const expr = node.getExpression()\n if (Node.isObjectLiteralExpression(expr)) {\n return expr\n }\n return undefined\n }\n\n // Form 3: { ... } as CollectionConfig\n if (Node.isAsExpression(node)) {\n const typeNode = node.getTypeNode()\n if (!typeNode) {\n return undefined\n }\n const typeText = typeNode.getText().trim()\n if (!isVersionedConfigTypeName(typeText)) {\n return undefined\n }\n const expr = node.getExpression()\n if (Node.isObjectLiteralExpression(expr)) {\n return expr\n }\n return undefined\n }\n\n return undefined\n}\n"],"names":["Node","VERSIONED_CONFIG_TYPE_NAMES","Set","isVersionedConfigTypeName","typeText","baseName","replace","trim","has","migrateVersionsDefault","name","apply","project","filesChanged","sourceFile","getSourceFiles","mutated","forEachDescendant","node","objectLiteral","resolveVersionedConfigObject","getProperty","addPropertyAssignment","initializer","add","getFilePath","description","isVariableDeclaration","typeNode","getTypeNode","undefined","getText","getInitializer","isObjectLiteralExpression","isSatisfiesExpression","expr","getExpression","isAsExpression"],"mappings":"AAAA,SAASA,IAAI,QAAQ,WAAU;AAI/B,MAAMC,8BAA8B,IAAIC,IAAI;IAC1C;IACA;IACA;IACA;CACD;AAED,MAAMC,4BAA4B,CAACC;IACjC,MAAMC,WAAWD,SAASE,OAAO,CAAC,SAAS,IAAIC,IAAI;IACnD,OAAON,4BAA4BO,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QACA,MAAMK,OAAOjB,KAAKkB,aAAa;QAC/B,IAAIpC,KAAKiC,yBAAyB,CAACE,OAAO;YACxC,OAAOA;QACT;QACA,OAAOL;IACT;IAEA,sCAAsC;IACtC,IAAI9B,KAAKqC,cAAc,CAACnB,OAAO;QAC7B,MAAMU,WAAWV,KAAKW,WAAW;QACjC,IAAI,CAACD,UAAU;YACb,OAAOE;QACT;QACA,MAAM1B,WAAWwB,SAASG,OAAO,GAAGxB,IAAI;QACxC,IAAI,CAACJ,0BAA0BC,WAAW;YACxC,OAAO0B;QACT;QACA,MAAMK,OAAOjB,KAAKkB,aAAa;QAC/B,IAAIpC,KAAKiC,yBAAyB,CAACE,OAAO;YACxC,OAAOA;QACT;QACA,OAAOL;IACT;IAEA,OAAOA;AACT"}
@@ -0,0 +1,13 @@
1
+ import { buildConfig } from 'payload';
2
+ export default buildConfig({
3
+ localization: {
4
+ defaultLocale: 'en',
5
+ defaultLocalePublishOption: 'all',
6
+ locales: [
7
+ 'en',
8
+ 'es'
9
+ ]
10
+ }
11
+ });
12
+
13
+ //# sourceMappingURL=all-value.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/all-value.input.ts"],"sourcesContent":["import { buildConfig } from 'payload'\n\nexport default buildConfig({\n localization: {\n defaultLocale: 'en',\n defaultLocalePublishOption: 'all',\n locales: ['en', 'es'],\n },\n})\n"],"names":["buildConfig","localization","defaultLocale","defaultLocalePublishOption","locales"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAS;AAErC,eAAeA,YAAY;IACzBC,cAAc;QACZC,eAAe;QACfC,4BAA4B;QAC5BC,SAAS;YAAC;YAAM;SAAK;IACvB;AACF,GAAE"}
@@ -0,0 +1,13 @@
1
+ import { buildConfig } from 'payload';
2
+ export default buildConfig({
3
+ localization: {
4
+ defaultLocale: 'en',
5
+ defaultLocalePublishOption: 'active',
6
+ locales: [
7
+ 'en',
8
+ 'es'
9
+ ]
10
+ }
11
+ });
12
+
13
+ //# sourceMappingURL=basic.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/basic.input.ts"],"sourcesContent":["import { buildConfig } from 'payload'\n\nexport default buildConfig({\n localization: {\n defaultLocale: 'en',\n defaultLocalePublishOption: 'active',\n locales: ['en', 'es'],\n },\n})\n"],"names":["buildConfig","localization","defaultLocale","defaultLocalePublishOption","locales"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAS;AAErC,eAAeA,YAAY;IACzBC,cAAc;QACZC,eAAe;QACfC,4BAA4B;QAC5BC,SAAS;YAAC;YAAM;SAAK;IACvB;AACF,GAAE"}
@@ -0,0 +1,12 @@
1
+ import { buildConfig } from 'payload';
2
+ export default buildConfig({
3
+ localization: {
4
+ defaultLocale: 'en',
5
+ locales: [
6
+ 'en',
7
+ 'es'
8
+ ]
9
+ }
10
+ });
11
+
12
+ //# sourceMappingURL=basic.output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/basic.output.ts"],"sourcesContent":["import { buildConfig } from 'payload'\n\nexport default buildConfig({\n localization: {\n defaultLocale: 'en',\n locales: ['en', 'es'],\n },\n})\n"],"names":["buildConfig","localization","defaultLocale","locales"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAS;AAErC,eAAeA,YAAY;IACzBC,cAAc;QACZC,eAAe;QACfC,SAAS;YAAC;YAAM;SAAK;IACvB;AACF,GAAE"}
@@ -0,0 +1,17 @@
1
+ import { buildConfig } from 'payload';
2
+ const localization = createLocalization();
3
+ export default buildConfig({
4
+ localization
5
+ });
6
+ function createLocalization() {
7
+ return {
8
+ defaultLocale: 'en',
9
+ defaultLocalePublishOption: 'all',
10
+ locales: [
11
+ 'en',
12
+ 'es'
13
+ ]
14
+ };
15
+ }
16
+
17
+ //# sourceMappingURL=dynamic.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/dynamic.input.ts"],"sourcesContent":["import { buildConfig } from 'payload'\n\nconst localization = createLocalization()\n\nexport default buildConfig({ localization })\n\nfunction createLocalization() {\n return {\n defaultLocale: 'en',\n defaultLocalePublishOption: 'all',\n locales: ['en', 'es'],\n }\n}\n"],"names":["buildConfig","localization","createLocalization","defaultLocale","defaultLocalePublishOption","locales"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAS;AAErC,MAAMC,eAAeC;AAErB,eAAeF,YAAY;IAAEC;AAAa,GAAE;AAE5C,SAASC;IACP,OAAO;QACLC,eAAe;QACfC,4BAA4B;QAC5BC,SAAS;YAAC;YAAM;SAAK;IACvB;AACF"}
@@ -0,0 +1,10 @@
1
+ import type { Transform } from '../../types.js';
2
+ /**
3
+ * Removes `defaultLocalePublishOption` from `localization` config objects.
4
+ *
5
+ * The Admin UI Publish button now always defaults to publishing the active
6
+ * locale when localized fields exist, with "Publish all locales" available
7
+ * as a secondary option. The config property is no longer needed.
8
+ */
9
+ export declare const removeDefaultLocalePublishOption: Transform;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/remove-default-locale-publish-option/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,EAAE,SA0E9C,CAAA"}
@@ -0,0 +1,103 @@
1
+ import { Node, SyntaxKind, VariableDeclarationKind } from 'ts-morph';
2
+ /**
3
+ * Removes `defaultLocalePublishOption` from `localization` config objects.
4
+ *
5
+ * The Admin UI Publish button now always defaults to publishing the active
6
+ * locale when localized fields exist, with "Publish all locales" available
7
+ * as a secondary option. The config property is no longer needed.
8
+ */ export const removeDefaultLocalePublishOption = {
9
+ name: 'remove-default-locale-publish-option',
10
+ apply: ({ project })=>{
11
+ const filesChanged = new Set();
12
+ const notes = new Set();
13
+ for (const sourceFile of project.getSourceFiles()){
14
+ const localizationProperties = [
15
+ ...sourceFile.getDescendantsOfKind(SyntaxKind.PropertyAssignment).filter((property)=>property.getName() === 'localization'),
16
+ ...sourceFile.getDescendantsOfKind(SyntaxKind.ShorthandPropertyAssignment).filter((property)=>property.getName() === 'localization')
17
+ ];
18
+ for (const localizationProperty of localizationProperties){
19
+ const localizationResolution = resolveLocalizationObject({
20
+ property: localizationProperty
21
+ });
22
+ if (localizationResolution.isUnresolved) {
23
+ notes.add(`${sourceFile.getFilePath()}: 'localization' uses a value that cannot be resolved safely — migrate manually by removing 'localization.defaultLocalePublishOption' if it is present.`);
24
+ continue;
25
+ }
26
+ const localizationObject = localizationResolution.object;
27
+ if (!localizationObject) {
28
+ continue;
29
+ }
30
+ if (localizationObject.getProperties().some((property)=>Node.isSpreadAssignment(property))) {
31
+ notes.add(`${sourceFile.getFilePath()}: 'localization' includes a spread — migrate manually by removing 'localization.defaultLocalePublishOption' if it is present in the spread value.`);
32
+ }
33
+ const defaultLocalePublishOption = localizationObject.getProperty('defaultLocalePublishOption');
34
+ if (!defaultLocalePublishOption || !Node.isPropertyAssignment(defaultLocalePublishOption)) {
35
+ continue;
36
+ }
37
+ const initializer = defaultLocalePublishOption.getInitializer();
38
+ if (initializer && Node.isStringLiteral(initializer) && initializer.getLiteralValue() === 'all') {
39
+ notes.add(`${sourceFile.getFilePath()}: 'localization.defaultLocalePublishOption' was set to 'all' — the Admin UI Publish button now defaults to publishing only the active locale instead. Use the "Publish all locales" option in the Publish button dropdown to publish every locale at once.`);
40
+ }
41
+ defaultLocalePublishOption.remove();
42
+ filesChanged.add(sourceFile.getFilePath());
43
+ }
44
+ }
45
+ return {
46
+ filesChanged: Array.from(filesChanged),
47
+ ...notes.size > 0 ? {
48
+ notes: Array.from(notes)
49
+ } : {}
50
+ };
51
+ },
52
+ description: 'Remove localization.defaultLocalePublishOption from Payload configs. The Admin UI Publish button now always defaults to publishing the active locale when localized fields exist, with "Publish all locales" available as a secondary dropdown option.'
53
+ };
54
+ function resolveLocalizationObject({ property }) {
55
+ if (Node.isPropertyAssignment(property)) {
56
+ return resolveLocalizationInitializer({
57
+ initializer: property.getInitializer()
58
+ });
59
+ }
60
+ const variableDeclaration = property.getValueSymbol()?.getDeclarations().find(Node.isVariableDeclaration);
61
+ return resolveLocalizationVariable({
62
+ variableDeclaration
63
+ });
64
+ }
65
+ function resolveLocalizationInitializer({ initializer }) {
66
+ if (!initializer) {
67
+ return {
68
+ isUnresolved: true
69
+ };
70
+ }
71
+ if (Node.isObjectLiteralExpression(initializer)) {
72
+ return {
73
+ isUnresolved: false,
74
+ object: initializer
75
+ };
76
+ }
77
+ if (initializer.getKind() === SyntaxKind.FalseKeyword) {
78
+ return {
79
+ isUnresolved: false
80
+ };
81
+ }
82
+ if (Node.isIdentifier(initializer)) {
83
+ const variableDeclaration = initializer.getDefinitions().map((definition)=>definition.getDeclarationNode()).find(Node.isVariableDeclaration);
84
+ return resolveLocalizationVariable({
85
+ variableDeclaration
86
+ });
87
+ }
88
+ return {
89
+ isUnresolved: true
90
+ };
91
+ }
92
+ function resolveLocalizationVariable({ variableDeclaration }) {
93
+ if (!variableDeclaration || variableDeclaration.getVariableStatement()?.getDeclarationKind() !== VariableDeclarationKind.Const) {
94
+ return {
95
+ isUnresolved: true
96
+ };
97
+ }
98
+ return resolveLocalizationInitializer({
99
+ initializer: variableDeclaration.getInitializer()
100
+ });
101
+ }
102
+
103
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/index.ts"],"sourcesContent":["import type {\n Expression,\n ObjectLiteralExpression,\n PropertyAssignment,\n ShorthandPropertyAssignment,\n VariableDeclaration,\n} from 'ts-morph'\n\nimport { Node, SyntaxKind, VariableDeclarationKind } from 'ts-morph'\n\nimport type { Transform } from '../../types.js'\n\n/**\n * Removes `defaultLocalePublishOption` from `localization` config objects.\n *\n * The Admin UI Publish button now always defaults to publishing the active\n * locale when localized fields exist, with \"Publish all locales\" available\n * as a secondary option. The config property is no longer needed.\n */\nexport const removeDefaultLocalePublishOption: Transform = {\n name: 'remove-default-locale-publish-option',\n apply: ({ project }) => {\n const filesChanged = new Set<string>()\n const notes = new Set<string>()\n\n for (const sourceFile of project.getSourceFiles()) {\n const localizationProperties = [\n ...sourceFile\n .getDescendantsOfKind(SyntaxKind.PropertyAssignment)\n .filter((property) => property.getName() === 'localization'),\n ...sourceFile\n .getDescendantsOfKind(SyntaxKind.ShorthandPropertyAssignment)\n .filter((property) => property.getName() === 'localization'),\n ]\n\n for (const localizationProperty of localizationProperties) {\n const localizationResolution = resolveLocalizationObject({\n property: localizationProperty,\n })\n\n if (localizationResolution.isUnresolved) {\n notes.add(\n `${sourceFile.getFilePath()}: 'localization' uses a value that cannot be resolved safely — migrate manually by removing 'localization.defaultLocalePublishOption' if it is present.`,\n )\n continue\n }\n\n const localizationObject = localizationResolution.object\n\n if (!localizationObject) {\n continue\n }\n\n if (\n localizationObject.getProperties().some((property) => Node.isSpreadAssignment(property))\n ) {\n notes.add(\n `${sourceFile.getFilePath()}: 'localization' includes a spread — migrate manually by removing 'localization.defaultLocalePublishOption' if it is present in the spread value.`,\n )\n }\n\n const defaultLocalePublishOption = localizationObject.getProperty(\n 'defaultLocalePublishOption',\n )\n\n if (!defaultLocalePublishOption || !Node.isPropertyAssignment(defaultLocalePublishOption)) {\n continue\n }\n\n const initializer = defaultLocalePublishOption.getInitializer()\n\n if (\n initializer &&\n Node.isStringLiteral(initializer) &&\n initializer.getLiteralValue() === 'all'\n ) {\n notes.add(\n `${sourceFile.getFilePath()}: 'localization.defaultLocalePublishOption' was set to 'all' — the Admin UI Publish button now defaults to publishing only the active locale instead. Use the \"Publish all locales\" option in the Publish button dropdown to publish every locale at once.`,\n )\n }\n\n defaultLocalePublishOption.remove()\n filesChanged.add(sourceFile.getFilePath())\n }\n }\n\n return {\n filesChanged: Array.from(filesChanged),\n ...(notes.size > 0 ? { notes: Array.from(notes) } : {}),\n }\n },\n description:\n 'Remove localization.defaultLocalePublishOption from Payload configs. The Admin UI Publish button now always defaults to publishing the active locale when localized fields exist, with \"Publish all locales\" available as a secondary dropdown option.',\n}\n\ntype LocalizationProperty = PropertyAssignment | ShorthandPropertyAssignment\n\ntype LocalizationResolution = {\n isUnresolved: boolean\n object?: ObjectLiteralExpression\n}\n\nfunction resolveLocalizationObject({\n property,\n}: {\n property: LocalizationProperty\n}): LocalizationResolution {\n if (Node.isPropertyAssignment(property)) {\n return resolveLocalizationInitializer({ initializer: property.getInitializer() })\n }\n\n const variableDeclaration = property\n .getValueSymbol()\n ?.getDeclarations()\n .find(Node.isVariableDeclaration)\n\n return resolveLocalizationVariable({ variableDeclaration })\n}\n\nfunction resolveLocalizationInitializer({\n initializer,\n}: {\n initializer: Expression | undefined\n}): LocalizationResolution {\n if (!initializer) {\n return { isUnresolved: true }\n }\n\n if (Node.isObjectLiteralExpression(initializer)) {\n return { isUnresolved: false, object: initializer }\n }\n\n if (initializer.getKind() === SyntaxKind.FalseKeyword) {\n return { isUnresolved: false }\n }\n\n if (Node.isIdentifier(initializer)) {\n const variableDeclaration = initializer\n .getDefinitions()\n .map((definition) => definition.getDeclarationNode())\n .find(Node.isVariableDeclaration)\n\n return resolveLocalizationVariable({ variableDeclaration })\n }\n\n return { isUnresolved: true }\n}\n\nfunction resolveLocalizationVariable({\n variableDeclaration,\n}: {\n variableDeclaration: undefined | VariableDeclaration\n}): LocalizationResolution {\n if (\n !variableDeclaration ||\n variableDeclaration.getVariableStatement()?.getDeclarationKind() !==\n VariableDeclarationKind.Const\n ) {\n return { isUnresolved: true }\n }\n\n return resolveLocalizationInitializer({ initializer: variableDeclaration.getInitializer() })\n}\n"],"names":["Node","SyntaxKind","VariableDeclarationKind","removeDefaultLocalePublishOption","name","apply","project","filesChanged","Set","notes","sourceFile","getSourceFiles","localizationProperties","getDescendantsOfKind","PropertyAssignment","filter","property","getName","ShorthandPropertyAssignment","localizationProperty","localizationResolution","resolveLocalizationObject","isUnresolved","add","getFilePath","localizationObject","object","getProperties","some","isSpreadAssignment","defaultLocalePublishOption","getProperty","isPropertyAssignment","initializer","getInitializer","isStringLiteral","getLiteralValue","remove","Array","from","size","description","resolveLocalizationInitializer","variableDeclaration","getValueSymbol","getDeclarations","find","isVariableDeclaration","resolveLocalizationVariable","isObjectLiteralExpression","getKind","FalseKeyword","isIdentifier","getDefinitions","map","definition","getDeclarationNode","getVariableStatement","getDeclarationKind","Const"],"mappings":"AAQA,SAASA,IAAI,EAAEC,UAAU,EAAEC,uBAAuB,QAAQ,WAAU;AAIpE;;;;;;CAMC,GACD,OAAO,MAAMC,mCAA8C;IACzDC,MAAM;IACNC,OAAO,CAAC,EAAEC,OAAO,EAAE;QACjB,MAAMC,eAAe,IAAIC;QACzB,MAAMC,QAAQ,IAAID;QAElB,KAAK,MAAME,cAAcJ,QAAQK,cAAc,GAAI;YACjD,MAAMC,yBAAyB;mBAC1BF,WACAG,oBAAoB,CAACZ,WAAWa,kBAAkB,EAClDC,MAAM,CAAC,CAACC,WAAaA,SAASC,OAAO,OAAO;mBAC5CP,WACAG,oBAAoB,CAACZ,WAAWiB,2BAA2B,EAC3DH,MAAM,CAAC,CAACC,WAAaA,SAASC,OAAO,OAAO;aAChD;YAED,KAAK,MAAME,wBAAwBP,uBAAwB;gBACzD,MAAMQ,yBAAyBC,0BAA0B;oBACvDL,UAAUG;gBACZ;gBAEA,IAAIC,uBAAuBE,YAAY,EAAE;oBACvCb,MAAMc,GAAG,CACP,GAAGb,WAAWc,WAAW,GAAG,uJAAuJ,CAAC;oBAEtL;gBACF;gBAEA,MAAMC,qBAAqBL,uBAAuBM,MAAM;gBAExD,IAAI,CAACD,oBAAoB;oBACvB;gBACF;gBAEA,IACEA,mBAAmBE,aAAa,GAAGC,IAAI,CAAC,CAACZ,WAAahB,KAAK6B,kBAAkB,CAACb,YAC9E;oBACAP,MAAMc,GAAG,CACP,GAAGb,WAAWc,WAAW,GAAG,iJAAiJ,C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dC,GAAG,CAAC,CAACC,aAAeA,WAAWC,kBAAkB,IACjDV,IAAI,CAAC9C,KAAK+C,qBAAqB;QAElC,OAAOC,4BAA4B;YAAEL;QAAoB;IAC3D;IAEA,OAAO;QAAErB,cAAc;IAAK;AAC9B;AAEA,SAAS0B,4BAA4B,EACnCL,mBAAmB,EAGpB;IACC,IACE,CAACA,uBACDA,oBAAoBc,oBAAoB,IAAIC,yBAC1CxD,wBAAwByD,KAAK,EAC/B;QACA,OAAO;YAAErC,cAAc;QAAK;IAC9B;IAEA,OAAOoB,+BAA+B;QAAET,aAAaU,oBAAoBT,cAAc;IAAG;AAC5F"}
@@ -0,0 +1,10 @@
1
+ import { buildConfig } from 'payload';
2
+ export default buildConfig({
3
+ admin: {
4
+ custom: {
5
+ defaultLocalePublishOption: 'active'
6
+ }
7
+ }
8
+ });
9
+
10
+ //# sourceMappingURL=no-match.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/no-match.input.ts"],"sourcesContent":["import { buildConfig } from 'payload'\n\nexport default buildConfig({\n admin: {\n custom: {\n defaultLocalePublishOption: 'active',\n },\n },\n})\n"],"names":["buildConfig","admin","custom","defaultLocalePublishOption"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAS;AAErC,eAAeA,YAAY;IACzBC,OAAO;QACLC,QAAQ;YACNC,4BAA4B;QAC9B;IACF;AACF,GAAE"}
@@ -0,0 +1,10 @@
1
+ import { buildConfig } from 'payload';
2
+ export default buildConfig({
3
+ admin: {
4
+ custom: {
5
+ defaultLocalePublishOption: 'active'
6
+ }
7
+ }
8
+ });
9
+
10
+ //# sourceMappingURL=no-match.output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/no-match.output.ts"],"sourcesContent":["import { buildConfig } from 'payload'\n\nexport default buildConfig({\n admin: {\n custom: {\n defaultLocalePublishOption: 'active',\n },\n },\n})\n"],"names":["buildConfig","admin","custom","defaultLocalePublishOption"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAS;AAErC,eAAeA,YAAY;IACzBC,OAAO;QACLC,QAAQ;YACNC,4BAA4B;QAC9B;IACF;AACF,GAAE"}
@@ -0,0 +1,22 @@
1
+ import { buildConfig } from 'payload';
2
+ let localization = {
3
+ defaultLocale: 'en',
4
+ defaultLocalePublishOption: 'active',
5
+ locales: [
6
+ 'en',
7
+ 'es'
8
+ ]
9
+ };
10
+ localization = {
11
+ defaultLocale: 'en',
12
+ defaultLocalePublishOption: 'all',
13
+ locales: [
14
+ 'en',
15
+ 'es'
16
+ ]
17
+ };
18
+ export default buildConfig({
19
+ localization
20
+ });
21
+
22
+ //# sourceMappingURL=reassigned.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/reassigned.input.ts"],"sourcesContent":["import { buildConfig } from 'payload'\n\nlet localization = {\n defaultLocale: 'en',\n defaultLocalePublishOption: 'active',\n locales: ['en', 'es'],\n}\n\nlocalization = {\n defaultLocale: 'en',\n defaultLocalePublishOption: 'all',\n locales: ['en', 'es'],\n}\n\nexport default buildConfig({ localization })\n"],"names":["buildConfig","localization","defaultLocale","defaultLocalePublishOption","locales"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAS;AAErC,IAAIC,eAAe;IACjBC,eAAe;IACfC,4BAA4B;IAC5BC,SAAS;QAAC;QAAM;KAAK;AACvB;AAEAH,eAAe;IACbC,eAAe;IACfC,4BAA4B;IAC5BC,SAAS;QAAC;QAAM;KAAK;AACvB;AAEA,eAAeJ,YAAY;IAAEC;AAAa,GAAE"}
@@ -0,0 +1,14 @@
1
+ import { buildConfig } from 'payload';
2
+ const localization = {
3
+ defaultLocale: 'en',
4
+ defaultLocalePublishOption: 'all',
5
+ locales: [
6
+ 'en',
7
+ 'es'
8
+ ]
9
+ };
10
+ export default buildConfig({
11
+ localization
12
+ });
13
+
14
+ //# sourceMappingURL=shorthand.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/shorthand.input.ts"],"sourcesContent":["import { buildConfig } from 'payload'\n\nconst localization = {\n defaultLocale: 'en',\n defaultLocalePublishOption: 'all',\n locales: ['en', 'es'],\n}\n\nexport default buildConfig({ localization })\n"],"names":["buildConfig","localization","defaultLocale","defaultLocalePublishOption","locales"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAS;AAErC,MAAMC,eAAe;IACnBC,eAAe;IACfC,4BAA4B;IAC5BC,SAAS;QAAC;QAAM;KAAK;AACvB;AAEA,eAAeJ,YAAY;IAAEC;AAAa,GAAE"}
@@ -0,0 +1,13 @@
1
+ import { buildConfig } from 'payload';
2
+ const localization = {
3
+ defaultLocale: 'en',
4
+ locales: [
5
+ 'en',
6
+ 'es'
7
+ ]
8
+ };
9
+ export default buildConfig({
10
+ localization
11
+ });
12
+
13
+ //# sourceMappingURL=shorthand.output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-default-locale-publish-option/shorthand.output.ts"],"sourcesContent":["import { buildConfig } from 'payload'\n\nconst localization = {\n defaultLocale: 'en',\n locales: ['en', 'es'],\n}\n\nexport default buildConfig({ localization })\n"],"names":["buildConfig","localization","defaultLocale","locales"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAS;AAErC,MAAMC,eAAe;IACnBC,eAAe;IACfC,SAAS;QAAC;QAAM;KAAK;AACvB;AAEA,eAAeH,YAAY;IAAEC;AAAa,GAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/remove-publish-specific-locale/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,EAAE,SA6EzC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transforms/remove-publish-specific-locale/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,EAAE,SA6EzC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/transforms/remove-publish-specific-locale/index.ts"],"sourcesContent":["import type { ObjectLiteralExpression } from 'ts-morph'\n\nimport { Node } from 'ts-morph'\n\nimport type { Transform } from '../../types.js'\n\n/**\n * Removes `publishSpecificLocale` from `payload.update()` and\n * `payload.updateGlobal()` call-site options objects.\n *\n * If the object already has a `locale` property, `publishSpecificLocale` is\n * simply removed. If it does not, the property is renamed to `locale` so the\n * same locale value is preserved.\n */\nexport const removePublishSpecificLocale: Transform = {\n name: 'remove-publish-specific-locale',\n apply: ({ project }) => {\n const filesChanged = new Set<string>()\n\n for (const sourceFile of project.getSourceFiles()) {\n let mutated = false\n\n sourceFile.forEachDescendant((node) => {\n if (!Node.isCallExpression(node)) {\n return\n }\n\n const expr = node.getExpression()\n if (!Node.isPropertyAccessExpression(expr)) {\n return\n }\n\n const methodName = expr.getName()\n if (methodName !== 'update' && methodName !== 'updateGlobal') {\n return\n }\n\n const args = node.getArguments()\n if (args.length === 0) {\n return\n }\n\n // The options object is always the first argument\n const optionsArg = args[0]\n if (!Node.isObjectLiteralExpression(optionsArg)) {\n return\n }\n\n const options = optionsArg\n const publishSpecificLocaleProp = options.getProperty('publishSpecificLocale')\n if (!publishSpecificLocaleProp) {\n return\n }\n\n const localeProp = options.getProperty('locale')\n\n if (localeProp) {\n // Already has `locale` — just drop publishSpecificLocale\n publishSpecificLocaleProp.remove()\n } else {\n // Rename publishSpecificLocale → locale to keep the value\n if (\n Node.isPropertyAssignment(publishSpecificLocaleProp) ||\n Node.isShorthandPropertyAssignment(publishSpecificLocaleProp)\n ) {\n if (Node.isPropertyAssignment(publishSpecificLocaleProp)) {\n const valueText = publishSpecificLocaleProp.getInitializer()?.getText() ?? 'undefined'\n publishSpecificLocaleProp.replaceWithText(`locale: ${valueText}`)\n } else {\n // shorthand: publishSpecificLocale → locale: publishSpecificLocale\n const name = publishSpecificLocaleProp.getName()\n publishSpecificLocaleProp.replaceWithText(`locale: ${name}`)\n }\n } else {\n // spread or method — just remove, we can't safely rename\n publishSpecificLocaleProp.remove()\n }\n }\n\n mutated = true\n })\n\n if (mutated) {\n filesChanged.add(sourceFile.getFilePath())\n }\n }\n\n return { filesChanged: [...filesChanged] }\n },\n description:\n 'Remove `publishSpecificLocale` from payload.update() and payload.updateGlobal() call sites. When `locale` is already present the property is simply removed; otherwise it is renamed to `locale` to preserve the value.',\n}\n"],"names":["Node","removePublishSpecificLocale","name","apply","project","filesChanged","Set","sourceFile","getSourceFiles","mutated","forEachDescendant","node","isCallExpression","expr","getExpression","isPropertyAccessExpression","methodName","getName","args","getArguments","length","optionsArg","isObjectLiteralExpression","options","publishSpecificLocaleProp","getProperty","localeProp","remove","isPropertyAssignment","isShorthandPropertyAssignment","valueText","getInitializer","getText","replaceWithText","add","getFilePath","description"],"mappings":"AAEA,SAASA,IAAI,QAAQ,WAAU;AAI/B;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAAyC;IACpDC,MAAM;IACNC,OAAO,CAAC,EAAEC,OAAO,EAAE;QACjB,MAAMC,eAAe,IAAIC;QAEzB,KAAK,MAAMC,cAAcH,QAAQI,cAAc,GAAI;YACjD,IAAIC,UAAU;YAEdF,WAAWG,iBAAiB,CAAC,CAACC;gBAC5B,IAAI,CAACX,KAAKY,gBAAgB,CAACD,OAAO;oBAChC;gBACF;gBAEA,MAAME,OAAOF,KAAKG,aAAa;gBAC/B,IAAI,CAACd,KAAKe,0BAA0B,CAACF,OAAO;oBAC1C;gBACF;gBAEA,MAAMG,aAAaH,KAAKI,OAAO;gBAC/B,IAAID,eAAe,YAAYA,eAAe,gBAAgB;oBAC5D;gBACF;gBAEA,MAAME,OAAOP,KAAKQ,YAAY;gBAC9B,IAAID,KAAKE,MAAM,KAAK,GAAG;oBACrB;gBACF;gBAEA,kDAAkD;gBAClD,MAAMC,aAAaH,IAAI,CAAC,EAAE;gBAC1B,IAAI,CAAClB,KAAKsB,yBAAyB,CAACD,aAAa;oBAC/C;gBACF;gBAEA,MAAME,UAAUF;gBAChB,MAAMG,4BAA4BD,QAAQE,WAAW,CAAC;gBACtD,IAAI,CAACD,2BAA2B;oBAC9B;gBACF;gBAEA,MAAME,aAAaH,QAAQE,WAAW,CAAC;gBAEvC,IAAIC,YAAY;oBACd,yDAAyD;oBACzDF,0BAA0BG,MAAM;gBAClC,OAAO;oBACL,0DAA0D;oBAC1D,IACE3B,KAAK4B,oBAAoB,CAACJ,8BAC1BxB,KAAK6B,6BAA6B,CAACL,4BACnC;wBACA,IAAIxB,KAAK4B,oBAAoB,CAACJ,4BAA4B;4BACxD,MAAMM,YAAYN,0BAA0BO,cAAc,IAAIC,aAAa;4BAC3ER,0BAA0BS,eAAe,CAAC,CAAC,QAAQ,EAAEH,WAAW;wBAClE,OAAO;4BACL,mEAAmE;4BACnE,MAAM5B,OAAOsB,0BAA0BP,OAAO;4BAC9CO,0BAA0BS,eAAe,CAAC,CAAC,QAAQ,EAAE/B,MAAM;wBAC7D;oBACF,OAAO;wBACL,yDAAyD;wBACzDsB,0BAA0BG,MAAM;oBAClC;gBACF;gBAEAlB,UAAU;YACZ;YAEA,IAAIA,SAAS;gBACXJ,aAAa6B,GAAG,CAAC3B,WAAW4B,WAAW;YACzC;QACF;QAEA,OAAO;YAAE9B,cAAc;mBAAIA;aAAa;QAAC;IAC3C;IACA+B,aACE;AACJ,EAAC"}
1
+ {"version":3,"sources":["../../../src/transforms/remove-publish-specific-locale/index.ts"],"sourcesContent":["import { Node } from 'ts-morph'\n\nimport type { Transform } from '../../types.js'\n\n/**\n * Removes `publishSpecificLocale` from `payload.update()` and\n * `payload.updateGlobal()` call-site options objects.\n *\n * If the object already has a `locale` property, `publishSpecificLocale` is\n * simply removed. If it does not, the property is renamed to `locale` so the\n * same locale value is preserved.\n */\nexport const removePublishSpecificLocale: Transform = {\n name: 'remove-publish-specific-locale',\n apply: ({ project }) => {\n const filesChanged = new Set<string>()\n\n for (const sourceFile of project.getSourceFiles()) {\n let mutated = false\n\n sourceFile.forEachDescendant((node) => {\n if (!Node.isCallExpression(node)) {\n return\n }\n\n const expr = node.getExpression()\n if (!Node.isPropertyAccessExpression(expr)) {\n return\n }\n\n const methodName = expr.getName()\n if (methodName !== 'update' && methodName !== 'updateGlobal') {\n return\n }\n\n const args = node.getArguments()\n if (args.length === 0) {\n return\n }\n\n // The options object is always the first argument\n const optionsArg = args[0]\n if (!Node.isObjectLiteralExpression(optionsArg)) {\n return\n }\n\n const options = optionsArg\n const publishSpecificLocaleProp = options.getProperty('publishSpecificLocale')\n if (!publishSpecificLocaleProp) {\n return\n }\n\n const localeProp = options.getProperty('locale')\n\n if (localeProp) {\n // Already has `locale` — just drop publishSpecificLocale\n publishSpecificLocaleProp.remove()\n } else {\n // Rename publishSpecificLocale → locale to keep the value\n if (\n Node.isPropertyAssignment(publishSpecificLocaleProp) ||\n Node.isShorthandPropertyAssignment(publishSpecificLocaleProp)\n ) {\n if (Node.isPropertyAssignment(publishSpecificLocaleProp)) {\n const valueText = publishSpecificLocaleProp.getInitializer()?.getText() ?? 'undefined'\n publishSpecificLocaleProp.replaceWithText(`locale: ${valueText}`)\n } else {\n // shorthand: publishSpecificLocale → locale: publishSpecificLocale\n const name = publishSpecificLocaleProp.getName()\n publishSpecificLocaleProp.replaceWithText(`locale: ${name}`)\n }\n } else {\n // spread or method — just remove, we can't safely rename\n publishSpecificLocaleProp.remove()\n }\n }\n\n mutated = true\n })\n\n if (mutated) {\n filesChanged.add(sourceFile.getFilePath())\n }\n }\n\n return { filesChanged: [...filesChanged] }\n },\n description:\n 'Remove `publishSpecificLocale` from payload.update() and payload.updateGlobal() call sites. When `locale` is already present the property is simply removed; otherwise it is renamed to `locale` to preserve the value.',\n}\n"],"names":["Node","removePublishSpecificLocale","name","apply","project","filesChanged","Set","sourceFile","getSourceFiles","mutated","forEachDescendant","node","isCallExpression","expr","getExpression","isPropertyAccessExpression","methodName","getName","args","getArguments","length","optionsArg","isObjectLiteralExpression","options","publishSpecificLocaleProp","getProperty","localeProp","remove","isPropertyAssignment","isShorthandPropertyAssignment","valueText","getInitializer","getText","replaceWithText","add","getFilePath","description"],"mappings":"AAAA,SAASA,IAAI,QAAQ,WAAU;AAI/B;;;;;;;CAOC,GACD,OAAO,MAAMC,8BAAyC;IACpDC,MAAM;IACNC,OAAO,CAAC,EAAEC,OAAO,EAAE;QACjB,MAAMC,eAAe,IAAIC;QAEzB,KAAK,MAAMC,cAAcH,QAAQI,cAAc,GAAI;YACjD,IAAIC,UAAU;YAEdF,WAAWG,iBAAiB,CAAC,CAACC;gBAC5B,IAAI,CAACX,KAAKY,gBAAgB,CAACD,OAAO;oBAChC;gBACF;gBAEA,MAAME,OAAOF,KAAKG,aAAa;gBAC/B,IAAI,CAACd,KAAKe,0BAA0B,CAACF,OAAO;oBAC1C;gBACF;gBAEA,MAAMG,aAAaH,KAAKI,OAAO;gBAC/B,IAAID,eAAe,YAAYA,eAAe,gBAAgB;oBAC5D;gBACF;gBAEA,MAAME,OAAOP,KAAKQ,YAAY;gBAC9B,IAAID,KAAKE,MAAM,KAAK,GAAG;oBACrB;gBACF;gBAEA,kDAAkD;gBAClD,MAAMC,aAAaH,IAAI,CAAC,EAAE;gBAC1B,IAAI,CAAClB,KAAKsB,yBAAyB,CAACD,aAAa;oBAC/C;gBACF;gBAEA,MAAME,UAAUF;gBAChB,MAAMG,4BAA4BD,QAAQE,WAAW,CAAC;gBACtD,IAAI,CAACD,2BAA2B;oBAC9B;gBACF;gBAEA,MAAME,aAAaH,QAAQE,WAAW,CAAC;gBAEvC,IAAIC,YAAY;oBACd,yDAAyD;oBACzDF,0BAA0BG,MAAM;gBAClC,OAAO;oBACL,0DAA0D;oBAC1D,IACE3B,KAAK4B,oBAAoB,CAACJ,8BAC1BxB,KAAK6B,6BAA6B,CAACL,4BACnC;wBACA,IAAIxB,KAAK4B,oBAAoB,CAACJ,4BAA4B;4BACxD,MAAMM,YAAYN,0BAA0BO,cAAc,IAAIC,aAAa;4BAC3ER,0BAA0BS,eAAe,CAAC,CAAC,QAAQ,EAAEH,WAAW;wBAClE,OAAO;4BACL,mEAAmE;4BACnE,MAAM5B,OAAOsB,0BAA0BP,OAAO;4BAC9CO,0BAA0BS,eAAe,CAAC,CAAC,QAAQ,EAAE/B,MAAM;wBAC7D;oBACF,OAAO;wBACL,yDAAyD;wBACzDsB,0BAA0BG,MAAM;oBAClC;gBACF;gBAEAlB,UAAU;YACZ;YAEA,IAAIA,SAAS;gBACXJ,aAAa6B,GAAG,CAAC3B,WAAW4B,WAAW;YACzC;QACF;QAEA,OAAO;YAAE9B,cAAc;mBAAIA;aAAa;QAAC;IAC3C;IACA+B,aACE;AACJ,EAAC"}
@@ -0,0 +1,11 @@
1
+ import { s3Storage as createS3Storage } from '@payloadcms/storage-s3';
2
+ const alwaysInsertFields = true;
3
+ export const storage = createS3Storage({
4
+ alwaysInsertFields,
5
+ bucket: 'media',
6
+ collections: {
7
+ media: true
8
+ }
9
+ });
10
+
11
+ //# sourceMappingURL=aliased.input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-storage-always-insert-fields/aliased.input.ts"],"sourcesContent":["import { s3Storage as createS3Storage } from '@payloadcms/storage-s3'\n\nconst alwaysInsertFields = true\n\nexport const storage = createS3Storage({\n alwaysInsertFields,\n bucket: 'media',\n collections: { media: true },\n})\n"],"names":["s3Storage","createS3Storage","alwaysInsertFields","storage","bucket","collections","media"],"mappings":"AAAA,SAASA,aAAaC,eAAe,QAAQ,yBAAwB;AAErE,MAAMC,qBAAqB;AAE3B,OAAO,MAAMC,UAAUF,gBAAgB;IACrCC;IACAE,QAAQ;IACRC,aAAa;QAAEC,OAAO;IAAK;AAC7B,GAAE"}
@@ -0,0 +1,10 @@
1
+ import { s3Storage as createS3Storage } from '@payloadcms/storage-s3';
2
+ const alwaysInsertFields = true;
3
+ export const storage = createS3Storage({
4
+ bucket: 'media',
5
+ collections: {
6
+ media: true
7
+ }
8
+ });
9
+
10
+ //# sourceMappingURL=aliased.output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/transforms/remove-storage-always-insert-fields/aliased.output.ts"],"sourcesContent":["import { s3Storage as createS3Storage } from '@payloadcms/storage-s3'\n\nconst alwaysInsertFields = true\n\nexport const storage = createS3Storage({\n bucket: 'media',\n collections: { media: true },\n})\n"],"names":["s3Storage","createS3Storage","alwaysInsertFields","storage","bucket","collections","media"],"mappings":"AAAA,SAASA,aAAaC,eAAe,QAAQ,yBAAwB;AAErE,MAAMC,qBAAqB;AAE3B,OAAO,MAAMC,UAAUF,gBAAgB;IACrCG,QAAQ;IACRC,aAAa;QAAEC,OAAO;IAAK;AAC7B,GAAE"}