@payloadcms/figma 0.1.0-internal.e071575 → 1.0.0-beta.0

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 (350) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/{utils → adapters}/asset-collection.d.ts +17 -3
  3. package/dist/adapters/asset-collection.js +242 -0
  4. package/dist/{utils → adapters}/build-lambda-zip.d.ts +8 -7
  5. package/dist/adapters/build-lambda-zip.js +111 -0
  6. package/dist/adapters/configureNextjsCache.d.ts +8 -0
  7. package/dist/adapters/configureNextjsCache.js +55 -0
  8. package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.d.ts +1 -0
  9. package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.js +15 -0
  10. package/dist/adapters/deploy-output/inspectNextjsOutput.d.ts +12 -0
  11. package/dist/adapters/deploy-output/inspectNextjsOutput.js +28 -0
  12. package/dist/adapters/deploy-output/inspectNitroOutput.d.ts +9 -0
  13. package/dist/adapters/deploy-output/inspectNitroOutput.js +13 -0
  14. package/dist/adapters/deploy-output/isFile.d.ts +1 -0
  15. package/dist/adapters/deploy-output/isFile.js +4 -0
  16. package/dist/adapters/deploy-output/readJson.d.ts +1 -0
  17. package/dist/adapters/deploy-output/readJson.js +9 -0
  18. package/dist/adapters/deploy-output/resolveNitroOutputLayout.d.ts +8 -0
  19. package/dist/adapters/deploy-output/resolveNitroOutputLayout.js +16 -0
  20. package/dist/adapters/deploy-output/resolveOutputPath.d.ts +2 -0
  21. package/dist/adapters/deploy-output/resolveOutputPath.js +9 -0
  22. package/dist/adapters/deploy-output/resolveWithin.d.ts +1 -0
  23. package/dist/adapters/deploy-output/resolveWithin.js +12 -0
  24. package/dist/adapters/fs-utils.d.ts +39 -0
  25. package/dist/adapters/fs-utils.js +135 -0
  26. package/dist/adapters/index.d.ts +4 -0
  27. package/dist/adapters/index.js +3 -0
  28. package/dist/adapters/lambda-runtime/nextjs-cache.d.ts +40 -0
  29. package/dist/adapters/lambda-runtime/nextjs-cache.js +174 -0
  30. package/dist/adapters/nextjs.d.ts +12 -0
  31. package/dist/adapters/nextjs.js +67 -0
  32. package/dist/adapters/nitro.d.ts +8 -0
  33. package/dist/adapters/nitro.js +193 -0
  34. package/dist/adapters/secret-files.d.ts +25 -0
  35. package/dist/adapters/secret-files.js +50 -0
  36. package/dist/adapters/types.d.ts +42 -0
  37. package/dist/adapters/types.js +1 -0
  38. package/dist/{utils/adapters → adapters}/vite.d.ts +2 -2
  39. package/dist/adapters/vite.js +33 -0
  40. package/dist/api/check-project-subdomain-availability.d.ts +12 -0
  41. package/dist/api/check-project-subdomain-availability.js +32 -0
  42. package/dist/api/control-plane-error.d.ts +6 -0
  43. package/dist/api/control-plane-error.js +8 -0
  44. package/dist/api/control-plane-fetch.d.ts +7 -0
  45. package/dist/api/control-plane-fetch.js +37 -0
  46. package/dist/api/control-plane.d.ts +12 -9
  47. package/dist/api/control-plane.js +28 -48
  48. package/dist/api/create-project.d.ts +18 -0
  49. package/dist/api/create-project.js +37 -0
  50. package/dist/api/list-project-workspaces.d.ts +8 -0
  51. package/dist/api/list-project-workspaces.js +28 -0
  52. package/dist/api/project-resource-type.d.ts +1 -0
  53. package/dist/api/project-resource-type.js +1 -0
  54. package/dist/auth/headless-oauth-flow.d.ts +23 -0
  55. package/dist/auth/headless-oauth-flow.js +73 -0
  56. package/dist/auth/oauth-flow.d.ts +2 -0
  57. package/dist/auth/oauth-flow.js +30 -8
  58. package/dist/auth/refresh.js +12 -12
  59. package/dist/auth/requested-scopes.d.ts +1 -0
  60. package/dist/auth/requested-scopes.js +3 -0
  61. package/dist/auth/token-store.d.ts +20 -1
  62. package/dist/auth/token-store.js +47 -0
  63. package/dist/auth/types.d.ts +17 -3
  64. package/dist/cli.d.ts +39 -0
  65. package/dist/cli.js +71 -36
  66. package/dist/commands/bootstrap.js +5 -1
  67. package/dist/commands/build-lambda-zip.js +1 -1
  68. package/dist/commands/deploy.d.ts +12 -0
  69. package/dist/commands/deploy.js +63 -25
  70. package/dist/commands/detect-project-resource-type.d.ts +3 -0
  71. package/dist/commands/detect-project-resource-type.js +28 -0
  72. package/dist/commands/init.d.ts +2 -2
  73. package/dist/commands/init.js +235 -80
  74. package/dist/commands/login.d.ts +11 -1
  75. package/dist/commands/login.js +66 -4
  76. package/dist/commands/prompt-to-create-project/format-project-subdomain.d.ts +1 -0
  77. package/dist/commands/prompt-to-create-project/format-project-subdomain.js +3 -0
  78. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.d.ts +1 -0
  79. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.js +7 -0
  80. package/dist/commands/prompt-to-create-project/get-default-project-name.d.ts +1 -0
  81. package/dist/commands/prompt-to-create-project/get-default-project-name.js +13 -0
  82. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.d.ts +7 -0
  83. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.js +32 -0
  84. package/dist/commands/prompt-to-create-project/resolve-project-region.d.ts +8 -0
  85. package/dist/commands/prompt-to-create-project/resolve-project-region.js +27 -0
  86. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.d.ts +9 -0
  87. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.js +54 -0
  88. package/dist/commands/prompt-to-create-project/resolve-text-input.d.ts +9 -0
  89. package/dist/commands/prompt-to-create-project/resolve-text-input.js +23 -0
  90. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.d.ts +12 -0
  91. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.js +36 -0
  92. package/dist/commands/prompt-to-create-project/validate-subdomain.d.ts +1 -0
  93. package/dist/commands/prompt-to-create-project/validate-subdomain.js +9 -0
  94. package/dist/commands/prompt-to-create-project.d.ts +24 -0
  95. package/dist/commands/prompt-to-create-project.js +69 -0
  96. package/dist/commands/setup-agent.d.ts +12 -0
  97. package/dist/commands/setup-agent.js +123 -0
  98. package/dist/commands/upgrade.js +65 -1
  99. package/dist/commands/upload-schema.js +3 -4
  100. package/dist/commands/write-project-configuration.d.ts +12 -0
  101. package/dist/commands/write-project-configuration.js +16 -0
  102. package/dist/config/oauth.js +6 -1
  103. package/dist/constants.d.ts +0 -2
  104. package/dist/constants.js +0 -3
  105. package/dist/db-content-api/generated/content-api-types.d.ts +6 -2
  106. package/dist/db-content-api/index.d.ts +1 -1
  107. package/dist/db-content-api/index.js +121 -72
  108. package/dist/db-content-api/utilities/data/index.js +8 -2
  109. package/dist/db-content-api/utilities/data/injectGlobalType.d.ts +6 -0
  110. package/dist/db-content-api/utilities/data/injectGlobalType.js +11 -0
  111. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +3 -11
  112. package/dist/db-content-api/utilities/data/removeVirtualFields.js +12 -50
  113. package/dist/db-content-api/utilities/isRecord.d.ts +9 -0
  114. package/dist/db-content-api/utilities/isRecord.js +19 -0
  115. package/dist/db-content-api/utilities/joins.js +5 -1
  116. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.d.ts +10 -0
  117. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.js +95 -0
  118. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.d.ts +9 -0
  119. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.js +112 -0
  120. package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +9 -4
  121. package/dist/db-content-api/utilities/schema/getDocumentSchema.d.ts +3 -0
  122. package/dist/db-content-api/utilities/schema/getDocumentSchema.js +24 -0
  123. package/dist/db-content-api/utilities/where.d.ts +2 -6
  124. package/dist/db-content-api/utilities/where.js +20 -9
  125. package/dist/exports/client.d.ts +2 -0
  126. package/dist/exports/client.js +2 -0
  127. package/dist/exports/views.d.ts +1 -0
  128. package/dist/exports/views.js +1 -0
  129. package/dist/imageSizeOptions.d.ts +23 -0
  130. package/dist/imageSizeOptions.js +26 -0
  131. package/dist/index.d.ts +2 -0
  132. package/dist/index.js +2 -0
  133. package/dist/lib/write-agent-config.d.ts +12 -0
  134. package/dist/lib/write-agent-config.js +52 -0
  135. package/dist/next/image-loader.d.ts +6 -0
  136. package/dist/next/image-loader.js +14 -0
  137. package/dist/oauth/components/LoginButton/index.js +66 -19
  138. package/dist/oauth/components/LoginButton/index.scss +121 -15
  139. package/dist/oauth/defaults.js +4 -1
  140. package/dist/oauth/endpoints/getLoginEndpoint.js +5 -2
  141. package/dist/oauth/index.js +8 -7
  142. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +1 -1
  143. package/dist/oauth/utilities/getAuthorizeURL.d.ts +1 -0
  144. package/dist/oauth/utilities/getAuthorizeURL.js +5 -1
  145. package/dist/plugin/build-config.d.ts +13 -3
  146. package/dist/plugin/build-config.js +250 -49
  147. package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
  148. package/dist/plugin/cache-revalidation-hooks.js +69 -0
  149. package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +9 -0
  150. package/dist/plugin/cloud-limits/CloudLimitModal/index.js +66 -0
  151. package/dist/plugin/cloud-limits/CloudLimitModal/index.scss +56 -0
  152. package/dist/plugin/cloud-limits/CloudLimitProvider/index.d.ts +4 -0
  153. package/dist/plugin/cloud-limits/CloudLimitProvider/index.js +110 -0
  154. package/dist/plugin/cloud-limits/LimitReachedView/index.css +14 -0
  155. package/dist/plugin/cloud-limits/LimitReachedView/index.d.ts +4 -0
  156. package/dist/plugin/cloud-limits/LimitReachedView/index.js +52 -0
  157. package/dist/plugin/cloud-limits/SlugRegistryContext/index.d.ts +7 -0
  158. package/dist/plugin/cloud-limits/SlugRegistryContext/index.js +3 -0
  159. package/dist/plugin/cloud-limits/SlugTracker/index.d.ts +1 -0
  160. package/dist/plugin/cloud-limits/SlugTracker/index.js +27 -0
  161. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +3 -0
  162. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.js +30 -0
  163. package/dist/plugin/cloud-limits/routes.d.ts +2 -0
  164. package/dist/plugin/cloud-limits/routes.js +4 -0
  165. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.d.ts +9 -0
  166. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.js +28 -0
  167. package/dist/plugin/cloud-limits/shared.d.ts +10 -0
  168. package/dist/plugin/cloud-limits/shared.js +52 -0
  169. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.d.ts +2 -0
  170. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.js +134 -0
  171. package/dist/plugin/cloud-limits/utilities/toasts.d.ts +4 -0
  172. package/dist/plugin/cloud-limits/utilities/toasts.js +19 -0
  173. package/dist/plugin/make-permission-access/make-permission-access.d.ts +8 -0
  174. package/dist/plugin/make-permission-access/make-permission-access.js +24 -0
  175. package/dist/plugin/sandbox-upload-fetch.d.ts +22 -20
  176. package/dist/plugin/sandbox-upload-fetch.js +15 -21
  177. package/dist/skills/deploy-to-figma/SKILL.md +234 -0
  178. package/dist/skills/deploy-to-figma/references/cli-reference.md +146 -0
  179. package/dist/storage-content-api/api-types.d.ts +5 -2
  180. package/dist/storage-content-api/buildBaseMediaResponseHeaders.d.ts +1 -0
  181. package/dist/storage-content-api/buildBaseMediaResponseHeaders.js +8 -0
  182. package/dist/storage-content-api/buildClientUploadFetchBackHeaders.d.ts +12 -0
  183. package/dist/storage-content-api/buildClientUploadFetchBackHeaders.js +26 -0
  184. package/dist/storage-content-api/buildMediaRequestHeaders.d.ts +1 -0
  185. package/dist/storage-content-api/buildMediaRequestHeaders.js +14 -0
  186. package/dist/storage-content-api/buildMediaResponseHeaders.d.ts +4 -0
  187. package/dist/storage-content-api/buildMediaResponseHeaders.js +52 -0
  188. package/dist/storage-content-api/client-uploads/generate.d.ts +7 -3
  189. package/dist/storage-content-api/client-uploads/generate.js +22 -21
  190. package/dist/storage-content-api/copyFile.d.ts +16 -0
  191. package/dist/storage-content-api/copyFile.js +90 -0
  192. package/dist/storage-content-api/deleteFile.d.ts +8 -0
  193. package/dist/storage-content-api/deleteFile.js +18 -0
  194. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.d.ts +11 -0
  195. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.js +33 -0
  196. package/dist/storage-content-api/getMediaType.d.ts +1 -0
  197. package/dist/storage-content-api/getMediaType.js +3 -0
  198. package/dist/storage-content-api/handleUpload.d.ts +1 -2
  199. package/dist/storage-content-api/handleUpload.js +13 -157
  200. package/dist/storage-content-api/hasSupportedContentEncoding.d.ts +1 -0
  201. package/dist/storage-content-api/hasSupportedContentEncoding.js +6 -0
  202. package/dist/storage-content-api/index.js +17 -8
  203. package/dist/storage-content-api/mediaErrorResponse.d.ts +1 -0
  204. package/dist/storage-content-api/mediaErrorResponse.js +12 -0
  205. package/dist/storage-content-api/resolveDownloadResponseHeaders.d.ts +5 -0
  206. package/dist/storage-content-api/resolveDownloadResponseHeaders.js +13 -0
  207. package/dist/storage-content-api/shouldAttachMedia.d.ts +1 -0
  208. package/dist/storage-content-api/shouldAttachMedia.js +34 -0
  209. package/dist/storage-content-api/staticHandler.d.ts +2 -1
  210. package/dist/storage-content-api/staticHandler.js +87 -32
  211. package/dist/storage-content-api/types.d.ts +4 -1
  212. package/dist/storage-content-api/uploadFileData.d.ts +10 -0
  213. package/dist/storage-content-api/uploadFileData.js +145 -0
  214. package/dist/translations/ar.d.ts +12 -0
  215. package/dist/translations/ar.js +12 -0
  216. package/dist/translations/az.d.ts +12 -0
  217. package/dist/translations/az.js +12 -0
  218. package/dist/translations/bg.d.ts +12 -0
  219. package/dist/translations/bg.js +12 -0
  220. package/dist/translations/bnBd.d.ts +12 -0
  221. package/dist/translations/bnBd.js +12 -0
  222. package/dist/translations/bnIn.d.ts +12 -0
  223. package/dist/translations/bnIn.js +12 -0
  224. package/dist/translations/ca.d.ts +12 -0
  225. package/dist/translations/ca.js +12 -0
  226. package/dist/translations/cs.d.ts +12 -0
  227. package/dist/translations/cs.js +12 -0
  228. package/dist/translations/da.d.ts +12 -0
  229. package/dist/translations/da.js +12 -0
  230. package/dist/translations/de.d.ts +12 -0
  231. package/dist/translations/de.js +12 -0
  232. package/dist/translations/en.d.ts +12 -0
  233. package/dist/translations/en.js +12 -0
  234. package/dist/translations/es.d.ts +12 -0
  235. package/dist/translations/es.js +12 -0
  236. package/dist/translations/et.d.ts +12 -0
  237. package/dist/translations/et.js +12 -0
  238. package/dist/translations/fa.d.ts +12 -0
  239. package/dist/translations/fa.js +12 -0
  240. package/dist/translations/fr.d.ts +12 -0
  241. package/dist/translations/fr.js +12 -0
  242. package/dist/translations/he.d.ts +12 -0
  243. package/dist/translations/he.js +12 -0
  244. package/dist/translations/hr.d.ts +12 -0
  245. package/dist/translations/hr.js +12 -0
  246. package/dist/translations/hu.d.ts +12 -0
  247. package/dist/translations/hu.js +12 -0
  248. package/dist/translations/hy.d.ts +12 -0
  249. package/dist/translations/hy.js +12 -0
  250. package/dist/translations/id.d.ts +12 -0
  251. package/dist/translations/id.js +12 -0
  252. package/dist/translations/index.d.ts +533 -0
  253. package/dist/translations/index.js +90 -0
  254. package/dist/translations/is.d.ts +12 -0
  255. package/dist/translations/is.js +12 -0
  256. package/dist/translations/it.d.ts +12 -0
  257. package/dist/translations/it.js +12 -0
  258. package/dist/translations/ja.d.ts +12 -0
  259. package/dist/translations/ja.js +12 -0
  260. package/dist/translations/ko.d.ts +12 -0
  261. package/dist/translations/ko.js +12 -0
  262. package/dist/translations/lt.d.ts +12 -0
  263. package/dist/translations/lt.js +12 -0
  264. package/dist/translations/lv.d.ts +12 -0
  265. package/dist/translations/lv.js +12 -0
  266. package/dist/translations/my.d.ts +12 -0
  267. package/dist/translations/my.js +12 -0
  268. package/dist/translations/nb.d.ts +12 -0
  269. package/dist/translations/nb.js +12 -0
  270. package/dist/translations/nl.d.ts +12 -0
  271. package/dist/translations/nl.js +12 -0
  272. package/dist/translations/pl.d.ts +12 -0
  273. package/dist/translations/pl.js +12 -0
  274. package/dist/translations/pt.d.ts +12 -0
  275. package/dist/translations/pt.js +12 -0
  276. package/dist/translations/ro.d.ts +12 -0
  277. package/dist/translations/ro.js +12 -0
  278. package/dist/translations/rs.d.ts +12 -0
  279. package/dist/translations/rs.js +12 -0
  280. package/dist/translations/rsLatin.d.ts +12 -0
  281. package/dist/translations/rsLatin.js +12 -0
  282. package/dist/translations/ru.d.ts +12 -0
  283. package/dist/translations/ru.js +12 -0
  284. package/dist/translations/sk.d.ts +12 -0
  285. package/dist/translations/sk.js +12 -0
  286. package/dist/translations/sl.d.ts +12 -0
  287. package/dist/translations/sl.js +12 -0
  288. package/dist/translations/sv.d.ts +12 -0
  289. package/dist/translations/sv.js +12 -0
  290. package/dist/translations/ta.d.ts +12 -0
  291. package/dist/translations/ta.js +12 -0
  292. package/dist/translations/th.d.ts +12 -0
  293. package/dist/translations/th.js +12 -0
  294. package/dist/translations/tr.d.ts +12 -0
  295. package/dist/translations/tr.js +12 -0
  296. package/dist/translations/uk.d.ts +12 -0
  297. package/dist/translations/uk.js +12 -0
  298. package/dist/translations/vi.d.ts +12 -0
  299. package/dist/translations/vi.js +12 -0
  300. package/dist/translations/zh.d.ts +12 -0
  301. package/dist/translations/zh.js +12 -0
  302. package/dist/translations/zhTw.d.ts +12 -0
  303. package/dist/translations/zhTw.js +12 -0
  304. package/dist/types.d.ts +11 -0
  305. package/dist/utils/assert-never.d.ts +1 -0
  306. package/dist/utils/assert-never.js +3 -0
  307. package/dist/utils/build-detection.d.ts +6 -1
  308. package/dist/utils/build-detection.js +68 -89
  309. package/dist/utils/cache-bootstrap.js +1 -0
  310. package/dist/utils/deploy-adapter.d.ts +3 -35
  311. package/dist/utils/deploy-adapter.js +25 -14
  312. package/dist/utils/env-management.d.ts +15 -0
  313. package/dist/utils/env-management.js +47 -0
  314. package/dist/utils/lambda-config.js +18 -23
  315. package/dist/utils/load-payload-config.js +1 -6
  316. package/dist/utils/messages.js +24 -3
  317. package/dist/utils/next-image-loader-config.d.ts +2 -0
  318. package/dist/utils/next-image-loader-config.js +63 -0
  319. package/dist/utils/next-image-loader-file.d.ts +2 -0
  320. package/dist/utils/next-image-loader-file.js +11 -0
  321. package/dist/utils/payload-config-ast.d.ts +5 -0
  322. package/dist/utils/payload-config-ast.js +73 -4
  323. package/dist/utils/payload-config-modifier.js +3 -0
  324. package/dist/utils/payload-generate.d.ts +10 -0
  325. package/dist/utils/payload-generate.js +59 -0
  326. package/dist/utils/payload-secret.d.ts +28 -0
  327. package/dist/utils/payload-secret.js +34 -0
  328. package/dist/utils/pnpm-builds.d.ts +14 -0
  329. package/dist/utils/pnpm-builds.js +125 -0
  330. package/dist/utils/s3-upload.js +4 -1
  331. package/package.json +32 -7
  332. package/dist/lib/download-skill.d.ts +0 -12
  333. package/dist/lib/download-skill.js +0 -77
  334. package/dist/storage-content-api/handleDelete.d.ts +0 -7
  335. package/dist/storage-content-api/handleDelete.js +0 -15
  336. package/dist/storage-content-api/utilities/getSafeFilename.d.ts +0 -11
  337. package/dist/storage-content-api/utilities/getSafeFilename.js +0 -59
  338. package/dist/storage-content-api/utilities/index.d.ts +0 -2
  339. package/dist/storage-content-api/utilities/index.js +0 -2
  340. package/dist/storage-content-api/utilities/parseUploadReference.d.ts +0 -17
  341. package/dist/storage-content-api/utilities/parseUploadReference.js +0 -27
  342. package/dist/utils/adapters/nextjs.d.ts +0 -8
  343. package/dist/utils/adapters/nextjs.js +0 -61
  344. package/dist/utils/adapters/nitro.d.ts +0 -8
  345. package/dist/utils/adapters/nitro.js +0 -172
  346. package/dist/utils/adapters/vite.js +0 -31
  347. package/dist/utils/asset-collection.js +0 -144
  348. package/dist/utils/build-lambda-zip.js +0 -90
  349. package/dist/utils/fs-utils.d.ts +0 -12
  350. package/dist/utils/fs-utils.js +0 -55
@@ -0,0 +1,63 @@
1
+ import { Node, SyntaxKind } from 'ts-morph';
2
+ import { FIGMA_IMAGE_LOADER_PATH } from './next-image-loader-file.js';
3
+ export function addFigmaImageLoaderConfig(configObject) {
4
+ const imagesProperty = configObject.getProperty('images');
5
+ if (!imagesProperty) {
6
+ configObject.addPropertyAssignment({
7
+ name: 'images',
8
+ initializer: `{
9
+ loader: 'custom',
10
+ loaderFile: '${FIGMA_IMAGE_LOADER_PATH}',
11
+ }`
12
+ });
13
+ return;
14
+ }
15
+ let imagesValue;
16
+ if (Node.isPropertyAssignment(imagesProperty)) {
17
+ imagesValue = imagesProperty.getInitializer();
18
+ } else if (Node.isShorthandPropertyAssignment(imagesProperty)) {
19
+ imagesValue = imagesProperty.getNameNode();
20
+ }
21
+ const imagesObject = resolveLocalObjectLiteral(imagesValue);
22
+ if (!imagesObject) {
23
+ throw new Error('Figma could not add the image loader because it could not inspect the `images` configuration. ' + 'Define `images` as an object in this Next.js config file and rerun ' + '`npx @payloadcms/figma init`.');
24
+ }
25
+ const loaderProperty = imagesObject.getProperty('loader');
26
+ const loaderFileProperty = imagesObject.getProperty('loaderFile');
27
+ if (loaderProperty || loaderFileProperty) {
28
+ const isFigmaLoader = getStringPropertyValue(loaderProperty) === 'custom' && getStringPropertyValue(loaderFileProperty) === FIGMA_IMAGE_LOADER_PATH;
29
+ if (!isFigmaLoader) {
30
+ throw new Error('A custom Next.js image loader is already configured, so Figma left it unchanged. ' + 'Remove the existing images.loader and images.loaderFile settings and rerun ' + '`npx @payloadcms/figma init`.');
31
+ }
32
+ return;
33
+ }
34
+ imagesObject.addPropertyAssignment({
35
+ name: 'loader',
36
+ initializer: "'custom'"
37
+ });
38
+ imagesObject.addPropertyAssignment({
39
+ name: 'loaderFile',
40
+ initializer: `'${FIGMA_IMAGE_LOADER_PATH}'`
41
+ });
42
+ }
43
+ function resolveLocalObjectLiteral(node) {
44
+ if (Node.isObjectLiteralExpression(node)) {
45
+ return node;
46
+ }
47
+ if (!Node.isIdentifier(node)) {
48
+ return undefined;
49
+ }
50
+ const sourceFile = node.getSourceFile();
51
+ for (const definition of node.getDefinitionNodes()){
52
+ if (Node.isVariableDeclaration(definition) && definition.getSourceFile() === sourceFile) {
53
+ return definition.getInitializerIfKind(SyntaxKind.ObjectLiteralExpression);
54
+ }
55
+ }
56
+ return undefined;
57
+ }
58
+ function getStringPropertyValue(property) {
59
+ if (!property || !Node.isPropertyAssignment(property)) {
60
+ return undefined;
61
+ }
62
+ return property.getInitializerIfKind(SyntaxKind.StringLiteral)?.getLiteralValue();
63
+ }
@@ -0,0 +1,2 @@
1
+ export declare const FIGMA_IMAGE_LOADER_PATH = "./figma-image-loader.ts";
2
+ export declare function writeFigmaImageLoaderFile(projectPath: string): Promise<void>;
@@ -0,0 +1,11 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ export const FIGMA_IMAGE_LOADER_PATH = './figma-image-loader.ts';
4
+ const FIGMA_IMAGE_LOADER_CONTENT = `'use client'
5
+
6
+ // Generated by @payloadcms/figma. Do not edit.
7
+ export { figmaNextImageLoader as default } from '@payloadcms/figma/next-image-loader'
8
+ `;
9
+ export async function writeFigmaImageLoaderFile(projectPath) {
10
+ await fs.writeFile(path.join(projectPath, FIGMA_IMAGE_LOADER_PATH), FIGMA_IMAGE_LOADER_CONTENT);
11
+ }
@@ -34,6 +34,11 @@ export type DetectionResult = {
34
34
  /** NPM package sharp is imported from (always 'sharp') */
35
35
  importSource: string;
36
36
  };
37
+ /** Payload v4 Sharp upload transformer (`upload.transformers: [sharpTransformer()]`) if present */
38
+ sharpTransformer?: {
39
+ /** NPM package the transformer is imported from (always '@payloadcms/transformer-sharp') */
40
+ importSource: string;
41
+ };
37
42
  };
38
43
  /**
39
44
  * Detect what changes are needed in the payload config file
@@ -1,5 +1,6 @@
1
1
  import { Node, SyntaxKind } from 'ts-morph';
2
2
  import * as log from './log.js';
3
+ const SHARP_TRANSFORMER_SOURCE = '@payloadcms/transformer-sharp';
3
4
  /**
4
5
  * Detect what changes are needed in the payload config file
5
6
  */ export function detectRequiredChanges(sourceFile) {
@@ -88,7 +89,10 @@ import * as log from './log.js';
88
89
  }
89
90
  }
90
91
  }
91
- // Check for secret property
92
+ // Check for secret property. The platform owns PAYLOAD_SECRET, so the
93
+ // scaffolded `secret: process.env.PAYLOAD_SECRET` line is stripped —
94
+ // `buildFigmaConfig` injects the value at runtime from the env var (in
95
+ // Lambda) or the TokenStore cache (local dev).
92
96
  const secretProperty = configArg.getProperty('secret');
93
97
  if (secretProperty) {
94
98
  result.secretProperty = true;
@@ -121,6 +125,11 @@ import * as log from './log.js';
121
125
  importSource: sharpImport?.getModuleSpecifierValue() || 'sharp'
122
126
  };
123
127
  }
128
+ if (findSharpTransformerCalls(sourceFile, configArg).length > 0) {
129
+ result.sharpTransformer = {
130
+ importSource: SHARP_TRANSFORMER_SOURCE
131
+ };
132
+ }
124
133
  // Check for figma property
125
134
  const figmaProperty = configArg.getProperty('figma');
126
135
  if (figmaProperty) {
@@ -252,7 +261,7 @@ import * as log from './log.js';
252
261
  modified = true;
253
262
  }
254
263
  }
255
- // 2. Remove secret property
264
+ // 2. Remove secret property (platform-managed)
256
265
  if (detection.secretProperty) {
257
266
  const secretProperty = configArg.getProperty('secret');
258
267
  if (secretProperty) {
@@ -279,7 +288,27 @@ import * as log from './log.js';
279
288
  modified = true;
280
289
  }
281
290
  }
282
- // 5. Update buildConfig import
291
+ // 5. Remove sharpTransformer from upload.transformers, then any config it leaves empty
292
+ if (detection.sharpTransformer) {
293
+ const calls = findSharpTransformerCalls(sourceFile, configArg);
294
+ if (calls.length > 0) {
295
+ const transformersArray = calls[0].getParentIfKindOrThrow(SyntaxKind.ArrayLiteralExpression);
296
+ for (const call of calls){
297
+ transformersArray.removeElement(call);
298
+ }
299
+ changes.push('Removed sharpTransformer from upload.transformers');
300
+ const transformersProperty = transformersArray.getParentIfKindOrThrow(SyntaxKind.PropertyAssignment);
301
+ const uploadObject = transformersProperty.getParentIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
302
+ if (transformersArray.getElements().length === 0) {
303
+ transformersProperty.remove();
304
+ }
305
+ if (uploadObject.getProperties().length === 0) {
306
+ uploadObject.getParentIfKindOrThrow(SyntaxKind.PropertyAssignment).remove();
307
+ }
308
+ modified = true;
309
+ }
310
+ }
311
+ // 6. Update buildConfig import
283
312
  if (detection.needsImportChange) {
284
313
  if (payloadImport) {
285
314
  if (detection.hasOtherPayloadImports) {
@@ -328,7 +357,7 @@ import * as log from './log.js';
328
357
  modified = true;
329
358
  }
330
359
  }
331
- // 6. Remove orphaned imports
360
+ // 7. Remove orphaned imports
332
361
  // Re-fetch imports after each removal to avoid stale references
333
362
  if (detection.dbProperty) {
334
363
  const currentImports = sourceFile.getImportDeclarations();
@@ -357,11 +386,51 @@ import * as log from './log.js';
357
386
  modified = true;
358
387
  }
359
388
  }
389
+ if (detection.sharpTransformer) {
390
+ const currentImports = sourceFile.getImportDeclarations();
391
+ const transformerImport = currentImports.find((imp)=>imp.getModuleSpecifierValue() === SHARP_TRANSFORMER_SOURCE);
392
+ if (transformerImport) {
393
+ transformerImport.remove();
394
+ changes.push('Removed sharpTransformer import');
395
+ modified = true;
396
+ }
397
+ }
360
398
  return {
361
399
  changes,
362
400
  modified
363
401
  };
364
402
  }
403
+ /**
404
+ * Find `sharpTransformer()` calls in `upload.transformers` of the config object.
405
+ * Returns none when the imported name is used anywhere else, so the import can be
406
+ * removed without breaking other code.
407
+ */ function findSharpTransformerCalls(sourceFile, configArg) {
408
+ const transformerImport = sourceFile.getImportDeclarations().find((imp)=>imp.getModuleSpecifierValue() === SHARP_TRANSFORMER_SOURCE);
409
+ const specifier = transformerImport?.getNamedImports().find((ni)=>ni.getName() === 'sharpTransformer');
410
+ if (!transformerImport || !specifier) {
411
+ return [];
412
+ }
413
+ const localName = specifier.getAliasNode()?.getText() ?? 'sharpTransformer';
414
+ if (!Node.isObjectLiteralExpression(configArg)) {
415
+ return [];
416
+ }
417
+ const upload = configArg.getProperty('upload');
418
+ const uploadObject = Node.isPropertyAssignment(upload) ? upload.getInitializer() : undefined;
419
+ if (!Node.isObjectLiteralExpression(uploadObject)) {
420
+ return [];
421
+ }
422
+ const transformers = uploadObject.getProperty('transformers');
423
+ const transformersArray = Node.isPropertyAssignment(transformers) ? transformers.getInitializer() : undefined;
424
+ if (!Node.isArrayLiteralExpression(transformersArray)) {
425
+ return [];
426
+ }
427
+ const calls = transformersArray.getElements().filter((element)=>Node.isCallExpression(element) && element.getExpression().getText() === localName);
428
+ const references = sourceFile.getDescendantsOfKind(SyntaxKind.Identifier).filter((id)=>id.getText() === localName && !id.getFirstAncestorByKind(SyntaxKind.ImportDeclaration));
429
+ if (references.length !== calls.length) {
430
+ return [];
431
+ }
432
+ return calls;
433
+ }
365
434
  /**
366
435
  * Add figma property to buildConfig if it doesn't exist
367
436
  * Modifies the AST in memory - caller must call sourceFile.save()
@@ -104,6 +104,9 @@ import { getOwnVersion } from './version-check.js';
104
104
  if (detection.sharpProperty) {
105
105
  packagesToUninstall.push('sharp');
106
106
  }
107
+ if (detection.sharpTransformer) {
108
+ packagesToUninstall.push(detection.sharpTransformer.importSource);
109
+ }
107
110
  if (packagesToInstall.length > 0) {
108
111
  log.debug(`Installing ${packagesToInstall.length} packages in a single operation: ${packagesToInstall.map((p)=>p.name).join(', ')}`);
109
112
  try {
@@ -0,0 +1,10 @@
1
+ export type PayloadGenerateResult = {
2
+ error: string;
3
+ ok: false;
4
+ } | {
5
+ ok: true;
6
+ };
7
+ /** Never throws. */
8
+ export declare function generateImportMap(projectPath: string): Promise<PayloadGenerateResult>;
9
+ /** Never throws. */
10
+ export declare function generateTypes(projectPath: string): Promise<PayloadGenerateResult>;
@@ -0,0 +1,59 @@
1
+ import spawn from 'cross-spawn';
2
+ import path from 'path';
3
+ // buildFigmaConfig throws without a resolvable environmentId/contentSystemId,
4
+ // which an unauthenticated init lacks. It reads these env vars before the
5
+ // bootstrap cache, so injecting them avoids the throw. Always inject the
6
+ // placeholder (not the real env) for deterministic behavior; the generated
7
+ // artifacts are ID-independent, so the value never affects output.
8
+ const GENERATE_PLACEHOLDER = 'figma-generate-placeholder';
9
+ /** Runs `payload <subcommand>` via the project's local binary. Never throws. */ function runPayloadGenerate(projectPath, subcommand) {
10
+ const bin = path.join(projectPath, 'node_modules', '.bin', 'payload');
11
+ return new Promise((resolve)=>{
12
+ const child = spawn(bin, [
13
+ subcommand
14
+ ], {
15
+ cwd: projectPath,
16
+ env: {
17
+ ...process.env,
18
+ FIGMA_CONTENT_API_CONTENT_SYSTEM_ID: GENERATE_PLACEHOLDER,
19
+ FIGMA_EID: GENERATE_PLACEHOLDER
20
+ },
21
+ stdio: 'pipe'
22
+ });
23
+ // Drain both pipes. An unread stdout buffer fills and blocks the child,
24
+ // hanging init; stdout also carries diagnostics on some failures.
25
+ let stderr = '';
26
+ let stdout = '';
27
+ child.stderr?.on('data', (data)=>{
28
+ stderr += data.toString();
29
+ });
30
+ child.stdout?.on('data', (data)=>{
31
+ stdout += data.toString();
32
+ });
33
+ child.on('close', (code)=>{
34
+ if (code === 0) {
35
+ resolve({
36
+ ok: true
37
+ });
38
+ } else {
39
+ const output = stderr.trim() || stdout.trim();
40
+ resolve({
41
+ error: output || `payload ${subcommand} exited with code ${code}`,
42
+ ok: false
43
+ });
44
+ }
45
+ });
46
+ child.on('error', (error)=>{
47
+ resolve({
48
+ error: error.message,
49
+ ok: false
50
+ });
51
+ });
52
+ });
53
+ }
54
+ /** Never throws. */ export function generateImportMap(projectPath) {
55
+ return runPayloadGenerate(projectPath, 'generate:importmap');
56
+ }
57
+ /** Never throws. */ export function generateTypes(projectPath) {
58
+ return runPayloadGenerate(projectPath, 'generate:types');
59
+ }
@@ -0,0 +1,28 @@
1
+ import type { AuthCredential } from '../auth/credentials.js';
2
+ import type { TokenStore } from '../auth/token-store.js';
3
+ import type { ProjectStoreScope } from '../auth/types.js';
4
+ export declare const PAYLOAD_SECRET_ENV_VAR = "PAYLOAD_SECRET";
5
+ interface EnsurePayloadSecretArgs {
6
+ credential: AuthCredential;
7
+ projectInfo: ProjectStoreScope;
8
+ /** Fetch the current platform value even when cached, preserving the cache on failure. */
9
+ refresh?: boolean;
10
+ tenantInstanceId: string;
11
+ tokenStore: TokenStore;
12
+ }
13
+ /**
14
+ * Resolve the tenant's PAYLOAD_SECRET and cache it in the encrypted
15
+ * TokenStore. The secret is intentionally NOT written to `.env`: keeping it
16
+ * only in the machine-scoped, AES-256-GCM-encrypted store avoids the
17
+ * plaintext-on-disk / accidental-exfiltration risks of a project-local file.
18
+ * `buildFigmaConfig` reads it back from the TokenStore at dev/build time.
19
+ *
20
+ * The Figma platform owns PAYLOAD_SECRET rotation; this helper never
21
+ * generates or mutates the value — it only fetches whatever the Control
22
+ * Plane currently returns and caches it.
23
+ *
24
+ * Non-fatal on failure: callers should catch and log rather than abort init,
25
+ * so the sinatra endpoint rollout can lag the CLI.
26
+ */
27
+ export declare function ensurePayloadSecret({ credential, projectInfo, refresh, tenantInstanceId, tokenStore, }: EnsurePayloadSecretArgs): Promise<string>;
28
+ export {};
@@ -0,0 +1,34 @@
1
+ import { getEnvironmentVariableByName } from '../api/control-plane.js';
2
+ import * as log from './log.js';
3
+ export const PAYLOAD_SECRET_ENV_VAR = 'PAYLOAD_SECRET';
4
+ /**
5
+ * Resolve the tenant's PAYLOAD_SECRET and cache it in the encrypted
6
+ * TokenStore. The secret is intentionally NOT written to `.env`: keeping it
7
+ * only in the machine-scoped, AES-256-GCM-encrypted store avoids the
8
+ * plaintext-on-disk / accidental-exfiltration risks of a project-local file.
9
+ * `buildFigmaConfig` reads it back from the TokenStore at dev/build time.
10
+ *
11
+ * The Figma platform owns PAYLOAD_SECRET rotation; this helper never
12
+ * generates or mutates the value — it only fetches whatever the Control
13
+ * Plane currently returns and caches it.
14
+ *
15
+ * Non-fatal on failure: callers should catch and log rather than abort init,
16
+ * so the sinatra endpoint rollout can lag the CLI.
17
+ */ export async function ensurePayloadSecret({ credential, projectInfo, refresh = false, tenantInstanceId, tokenStore }) {
18
+ const cached = tokenStore.getPayloadSecret({
19
+ projectInfo
20
+ });
21
+ if (cached && !refresh) {
22
+ return cached;
23
+ }
24
+ const secret = await getEnvironmentVariableByName(credential, tenantInstanceId, PAYLOAD_SECRET_ENV_VAR);
25
+ if (!secret) {
26
+ throw new Error('Control Plane returned an empty PAYLOAD_SECRET');
27
+ }
28
+ tokenStore.setPayloadSecret({
29
+ projectInfo,
30
+ secret
31
+ });
32
+ log.debug(`Cached PAYLOAD_SECRET for ${projectInfo.projectId}:${projectInfo.environmentName}`);
33
+ return secret;
34
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Write init's pnpm-workspace.yaml: hoisted node linker (the Lambda runtime needs a
3
+ * flat node_modules) plus build approvals, migrating off the now-ignored package.json
4
+ * `pnpm.onlyBuiltDependencies`. Written for every project so an npx/npm scaffold still
5
+ * installs cleanly when the user later switches to pnpm.
6
+ */
7
+ export declare function ensurePnpmWorkspace(projectPath: string): Promise<void>;
8
+ /**
9
+ * Set each build `true` under `allowBuilds` and drop it from any `ignoredBuiltDependencies`
10
+ * denylist. Pure and idempotent. pnpm v11 reads approvals only from pnpm-workspace.yaml.
11
+ */
12
+ export declare function upsertBuildApprovals(content: string, builds: string[]): string;
13
+ /** Set a top-level `key: value` scalar, replacing any existing one. Pure and idempotent. */
14
+ export declare function upsertTopLevelScalar(content: string, key: string, value: string): string;
@@ -0,0 +1,125 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ /** Fallback builds when package.json declares none. */ const DEFAULT_BUILDS = [
4
+ 'sharp',
5
+ 'esbuild',
6
+ 'unrs-resolver'
7
+ ];
8
+ /**
9
+ * Write init's pnpm-workspace.yaml: hoisted node linker (the Lambda runtime needs a
10
+ * flat node_modules) plus build approvals, migrating off the now-ignored package.json
11
+ * `pnpm.onlyBuiltDependencies`. Written for every project so an npx/npm scaffold still
12
+ * installs cleanly when the user later switches to pnpm.
13
+ */ export async function ensurePnpmWorkspace(projectPath) {
14
+ const packageJsonPath = path.join(projectPath, 'package.json');
15
+ const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
16
+ const pnpmField = packageJson.pnpm;
17
+ const configured = pnpmField?.onlyBuiltDependencies;
18
+ const builds = configured && configured.length > 0 ? configured : DEFAULT_BUILDS;
19
+ const workspacePath = path.join(projectPath, 'pnpm-workspace.yaml');
20
+ let yaml = '';
21
+ try {
22
+ yaml = await fs.readFile(workspacePath, 'utf-8');
23
+ } catch (error) {
24
+ // Rethrow on a present-but-unreadable file; the write below would clobber it.
25
+ if (error.code !== 'ENOENT') {
26
+ throw error;
27
+ }
28
+ }
29
+ yaml = upsertTopLevelScalar(yaml, 'nodeLinker', 'hoisted');
30
+ yaml = upsertBuildApprovals(yaml, builds);
31
+ await fs.writeFile(workspacePath, yaml, 'utf-8');
32
+ if (pnpmField) {
33
+ delete pnpmField.onlyBuiltDependencies;
34
+ if (Object.keys(pnpmField).length === 0) {
35
+ delete packageJson.pnpm;
36
+ }
37
+ await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
38
+ }
39
+ }
40
+ /**
41
+ * Set each build `true` under `allowBuilds` and drop it from any `ignoredBuiltDependencies`
42
+ * denylist. Pure and idempotent. pnpm v11 reads approvals only from pnpm-workspace.yaml.
43
+ */ export function upsertBuildApprovals(content, builds) {
44
+ const blocks = toTopLevelBlocks(content);
45
+ const ignored = blocks.find((block)=>block.key === 'ignoredBuiltDependencies');
46
+ if (ignored) {
47
+ ignored.lines = ignored.lines.filter((line, index)=>{
48
+ if (index === 0) {
49
+ return true;
50
+ }
51
+ const name = /^\s*-\s*'?([^'\s]+)'?\s*$/.exec(line)?.[1];
52
+ return !(name && builds.includes(name));
53
+ });
54
+ }
55
+ const allow = blocks.find((block)=>block.key === 'allowBuilds');
56
+ if (allow) {
57
+ for (const name of builds){
58
+ const pattern = new RegExp(`^\\s+'?${escapeRegExp(name)}'?:`);
59
+ const index = allow.lines.findIndex((line)=>pattern.test(line));
60
+ if (index >= 0) {
61
+ allow.lines[index] = ` ${name}: true`;
62
+ } else {
63
+ allow.lines.push(` ${name}: true`);
64
+ }
65
+ }
66
+ } else {
67
+ blocks.push({
68
+ key: 'allowBuilds',
69
+ lines: [
70
+ 'allowBuilds:',
71
+ ...builds.map((name)=>` ${name}: true`)
72
+ ]
73
+ });
74
+ }
75
+ const output = blocks.flatMap((block)=>block.lines).join('\n');
76
+ return output.endsWith('\n') ? output : `${output}\n`;
77
+ }
78
+ /** Set a top-level `key: value` scalar, replacing any existing one. Pure and idempotent. */ export function upsertTopLevelScalar(content, key, value) {
79
+ const blocks = toTopLevelBlocks(content);
80
+ const line = `${key}: ${value}`;
81
+ const existing = blocks.find((block)=>block.key === key);
82
+ if (existing) {
83
+ existing.lines = [
84
+ line
85
+ ];
86
+ } else {
87
+ blocks.push({
88
+ key,
89
+ lines: [
90
+ line
91
+ ]
92
+ });
93
+ }
94
+ const output = blocks.flatMap((block)=>block.lines).join('\n');
95
+ return output.endsWith('\n') ? output : `${output}\n`;
96
+ }
97
+ function toTopLevelBlocks(content) {
98
+ const lines = content.length ? content.replace(/\n$/, '').split('\n') : [];
99
+ const blocks = [];
100
+ for (const line of lines){
101
+ const key = /^[^\s#]/.test(line) ? /^([^:]+):/.exec(line)?.[1] : undefined;
102
+ const current = blocks[blocks.length - 1];
103
+ if (key !== undefined) {
104
+ blocks.push({
105
+ key,
106
+ lines: [
107
+ line
108
+ ]
109
+ });
110
+ } else if (current) {
111
+ current.lines.push(line);
112
+ } else {
113
+ blocks.push({
114
+ key: null,
115
+ lines: [
116
+ line
117
+ ]
118
+ });
119
+ }
120
+ }
121
+ return blocks;
122
+ }
123
+ function escapeRegExp(value) {
124
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
125
+ }
@@ -141,16 +141,19 @@ const INITIAL_RETRY_DELAY = 1000 // 1 second
141
141
  const fsPath = pathMap?.[assetPath] ?? assetPath.replace(/^_next\//, '.next/');
142
142
  const fullPath = path.join(projectPath, fsPath);
143
143
  const signedUrl = assetUrls[assetPath];
144
- await uploadFile(fullPath, signedUrl);
144
+ const contentType = MIME_TYPES[path.extname(assetPath).toLowerCase()];
145
+ await uploadFile(fullPath, signedUrl, contentType);
145
146
  results.assetsUploaded++;
146
147
  // Track bytes uploaded
147
148
  const stats = await fs.stat(fullPath);
148
149
  results.totalBytesUploaded += stats.size;
149
150
  // Report progress
150
151
  onProgress?.(results.assetsUploaded, assetPaths.length);
152
+ return undefined;
151
153
  } catch (error) {
152
154
  results.assetsFailed++;
153
155
  log.debug(`Failed to upload ${assetPath}: ${error instanceof Error ? error.message : 'Unknown error'}`);
156
+ return undefined;
154
157
  }
155
158
  }));
156
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/figma",
3
- "version": "0.1.0-internal.e071575",
3
+ "version": "1.0.0-beta.0",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,6 +13,16 @@
13
13
  "import": "./dist/exports/client.js",
14
14
  "types": "./dist/exports/client.d.ts",
15
15
  "default": "./dist/exports/client.js"
16
+ },
17
+ "./next-image-loader": {
18
+ "import": "./dist/next/image-loader.js",
19
+ "types": "./dist/next/image-loader.d.ts",
20
+ "default": "./dist/next/image-loader.js"
21
+ },
22
+ "./views": {
23
+ "import": "./dist/exports/views.js",
24
+ "types": "./dist/exports/views.d.ts",
25
+ "default": "./dist/exports/views.js"
16
26
  }
17
27
  },
18
28
  "main": "./dist/index.js",
@@ -28,12 +38,14 @@
28
38
  ],
29
39
  "dependencies": {
30
40
  "@clack/prompts": "^0.11.0",
41
+ "@cloudflare/workers-types": "5.20260716.1",
31
42
  "@figma/rest-api-spec": "^0.34.0",
32
43
  "@sindresorhus/slugify": "^3.0.0",
33
44
  "archiver": "7.0.1",
34
45
  "arg": "^5.0.2",
35
46
  "conf": "^13.1.0",
36
47
  "cross-spawn": "7.0.6",
48
+ "dotenv": "^16.4.5",
37
49
  "env-paths": "^3.0.0",
38
50
  "figures": "^6.1.0",
39
51
  "jose": "6.0.12",
@@ -41,7 +53,10 @@
41
53
  "open": "^10.2.0",
42
54
  "openapi-fetch": "0.15.0",
43
55
  "picocolors": "1.1.1",
44
- "tar": "^7.5.13",
56
+ "qs-esm": "^8.0.1",
57
+ "sanitize-filename": "^1.6.4",
58
+ "skills": "1.4.4",
59
+ "tar": "^7.5.21",
45
60
  "terminal-link": "^5.0.0",
46
61
  "ts-morph": "^21.0.1",
47
62
  "uuid": "^10.0.0"
@@ -49,26 +64,35 @@
49
64
  "devDependencies": {
50
65
  "@payloadcms/eslint-config": "3.28.0",
51
66
  "@payloadcms/eslint-plugin": "3.28.0",
52
- "@payloadcms/next": "4.0.0-canary.20",
67
+ "@payloadcms/next": "4.0.0-beta.0",
68
+ "@payloadcms/plugin-cloud-storage": "4.0.0-beta.0",
69
+ "@payloadcms/richtext-lexical": "4.0.0-beta.0",
70
+ "@payloadcms/translations": "4.0.0-beta.0",
71
+ "@payloadcms/ui": "4.0.0-beta.0",
53
72
  "@swc/cli": "0.7.7",
54
73
  "@types/archiver": "7.0.0",
55
74
  "@types/cross-spawn": "6.0.6",
56
75
  "@types/jsonwebtoken": "^9.0.10",
57
76
  "@types/node": "^24.0.0",
77
+ "@types/react": "^19",
58
78
  "@types/uuid": "^8.3.4",
59
79
  "copyfiles": "^2.4.1",
60
80
  "eslint": "9.22.0",
61
- "next": "^16.2.6",
81
+ "next": "^16.3.3",
62
82
  "openapi-typescript": "^7.13.0",
83
+ "payload": "4.0.0-beta.0",
63
84
  "rimraf": "^6.1.3",
64
85
  "tsx": "4.20.6",
65
86
  "typescript": "5.7.3",
66
87
  "vitest": "4.0.15"
67
88
  },
68
89
  "peerDependencies": {
69
- "@payloadcms/plugin-cloud-storage": ">=4.0.0-canary.20 <4.0.0-internal",
70
- "@payloadcms/richtext-lexical": ">=4.0.0-canary.20 <4.0.0-internal",
71
- "payload": ">=4.0.0-canary.20 <4.0.0-internal"
90
+ "@payloadcms/plugin-cloud-storage": ">=4.0.0-beta.0 <4.0.0-internal",
91
+ "@payloadcms/richtext-lexical": ">=4.0.0-beta.0 <4.0.0-internal",
92
+ "@payloadcms/translations": ">=4.0.0-beta.0 <4.0.0-internal",
93
+ "@payloadcms/ui": ">=4.0.0-beta.0 <4.0.0-internal",
94
+ "payload": ">=4.0.0-beta.0 <4.0.0-internal",
95
+ "react": "^19.0.1 || ^19.1.2 || ^19.2.1"
72
96
  },
73
97
  "peerDependenciesMeta": {
74
98
  "@payloadcms/plugin-cloud-storage": {
@@ -104,6 +128,7 @@
104
128
  "test:int:watch": "TEST_INT=true vitest --config vitest.config.int.ts",
105
129
  "test:e2e": "TEST_E2E=true vitest run --config vitest.config.e2e.ts",
106
130
  "test:e2e:watch": "TEST_E2E=true vitest --config vitest.config.e2e.ts",
131
+ "test:types": "tsc --project tsconfig.imageSizeOptions.json",
107
132
  "test:watch": "TEST_UNIT=true vitest"
108
133
  }
109
134
  }
@@ -1,12 +0,0 @@
1
- export type DownloadSkillResult = {
2
- detail?: string;
3
- ok: false;
4
- reason: 'already-installed' | 'empty-extract' | 'error' | 'fetch-failed';
5
- } | {
6
- ok: true;
7
- };
8
- export declare function downloadSkill(args: {
9
- branch?: string;
10
- debug?: boolean;
11
- projectDir: string;
12
- }): Promise<DownloadSkillResult>;