@payloadcms/figma 0.1.0-alpha.0 → 0.1.0-alpha.10

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 (320) 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 +1 -9
  47. package/dist/api/control-plane.js +2 -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 +69 -0
  56. package/dist/auth/oauth-flow.d.ts +2 -0
  57. package/dist/auth/oauth-flow.js +13 -8
  58. package/dist/auth/token-store.d.ts +4 -1
  59. package/dist/auth/token-store.js +14 -0
  60. package/dist/auth/types.d.ts +12 -0
  61. package/dist/cli.d.ts +39 -0
  62. package/dist/cli.js +71 -36
  63. package/dist/commands/bootstrap.js +2 -1
  64. package/dist/commands/build-lambda-zip.js +1 -1
  65. package/dist/commands/deploy.d.ts +12 -0
  66. package/dist/commands/deploy.js +63 -25
  67. package/dist/commands/detect-project-resource-type.d.ts +3 -0
  68. package/dist/commands/detect-project-resource-type.js +28 -0
  69. package/dist/commands/init.d.ts +2 -2
  70. package/dist/commands/init.js +164 -79
  71. package/dist/commands/login.d.ts +11 -1
  72. package/dist/commands/login.js +66 -4
  73. package/dist/commands/prompt-to-create-project/format-project-subdomain.d.ts +1 -0
  74. package/dist/commands/prompt-to-create-project/format-project-subdomain.js +3 -0
  75. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.d.ts +1 -0
  76. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.js +7 -0
  77. package/dist/commands/prompt-to-create-project/get-default-project-name.d.ts +1 -0
  78. package/dist/commands/prompt-to-create-project/get-default-project-name.js +13 -0
  79. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.d.ts +7 -0
  80. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.js +32 -0
  81. package/dist/commands/prompt-to-create-project/resolve-project-region.d.ts +8 -0
  82. package/dist/commands/prompt-to-create-project/resolve-project-region.js +27 -0
  83. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.d.ts +9 -0
  84. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.js +54 -0
  85. package/dist/commands/prompt-to-create-project/resolve-text-input.d.ts +9 -0
  86. package/dist/commands/prompt-to-create-project/resolve-text-input.js +23 -0
  87. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.d.ts +12 -0
  88. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.js +36 -0
  89. package/dist/commands/prompt-to-create-project/validate-subdomain.d.ts +1 -0
  90. package/dist/commands/prompt-to-create-project/validate-subdomain.js +9 -0
  91. package/dist/commands/prompt-to-create-project.d.ts +24 -0
  92. package/dist/commands/prompt-to-create-project.js +69 -0
  93. package/dist/commands/setup-agent.d.ts +12 -0
  94. package/dist/commands/setup-agent.js +123 -0
  95. package/dist/commands/write-project-configuration.d.ts +12 -0
  96. package/dist/commands/write-project-configuration.js +16 -0
  97. package/dist/db-content-api/generated/content-api-types.d.ts +661 -16
  98. package/dist/db-content-api/index.d.ts +3 -0
  99. package/dist/db-content-api/index.js +155 -161
  100. package/dist/db-content-api/utilities/clientVersionHeaders.d.ts +7 -0
  101. package/dist/db-content-api/utilities/clientVersionHeaders.js +15 -0
  102. package/dist/db-content-api/utilities/data/atomicOperations.d.ts +16 -0
  103. package/dist/db-content-api/utilities/data/atomicOperations.js +48 -0
  104. package/dist/db-content-api/utilities/data/convertRelationshipIds.d.ts +25 -0
  105. package/dist/db-content-api/utilities/data/convertRelationshipIds.js +109 -0
  106. package/dist/db-content-api/utilities/data/index.js +73 -57
  107. package/dist/db-content-api/utilities/data/injectGlobalType.d.ts +6 -0
  108. package/dist/db-content-api/utilities/data/injectGlobalType.js +11 -0
  109. package/dist/db-content-api/utilities/data/isLocaleMap.d.ts +10 -0
  110. package/dist/db-content-api/utilities/data/isLocaleMap.js +13 -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/data/resolveFieldLocalization.d.ts +18 -0
  114. package/dist/db-content-api/utilities/data/resolveFieldLocalization.js +21 -0
  115. package/dist/db-content-api/utilities/data/validateRelationships.js +19 -12
  116. package/dist/db-content-api/utilities/isRecord.d.ts +9 -0
  117. package/dist/db-content-api/utilities/isRecord.js +19 -0
  118. package/dist/db-content-api/utilities/joins.d.ts +6 -8
  119. package/dist/db-content-api/utilities/joins.js +13 -22
  120. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.d.ts +10 -0
  121. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.js +95 -0
  122. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.d.ts +9 -0
  123. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.js +112 -0
  124. package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +21 -4
  125. package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +118 -36
  126. package/dist/db-content-api/utilities/schema/getDocumentSchema.d.ts +3 -0
  127. package/dist/db-content-api/utilities/schema/getDocumentSchema.js +24 -0
  128. package/dist/db-content-api/utilities/where.d.ts +3 -17
  129. package/dist/db-content-api/utilities/where.js +21 -21
  130. package/dist/exports/client.d.ts +2 -0
  131. package/dist/exports/client.js +2 -0
  132. package/dist/exports/views.d.ts +1 -0
  133. package/dist/exports/views.js +1 -0
  134. package/dist/imageSizeOptions.d.ts +23 -0
  135. package/dist/imageSizeOptions.js +26 -0
  136. package/dist/index.d.ts +2 -0
  137. package/dist/index.js +2 -0
  138. package/dist/lib/write-agent-config.d.ts +12 -0
  139. package/dist/lib/write-agent-config.js +52 -0
  140. package/dist/next/image-loader.d.ts +6 -0
  141. package/dist/next/image-loader.js +14 -0
  142. package/dist/oauth/components/LoginButton/index.js +66 -19
  143. package/dist/oauth/components/LoginButton/index.scss +121 -15
  144. package/dist/oauth/defaults.js +4 -1
  145. package/dist/oauth/endpoints/getLoginEndpoint.js +5 -2
  146. package/dist/oauth/index.js +8 -7
  147. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +1 -1
  148. package/dist/oauth/utilities/getAuthorizeURL.d.ts +1 -0
  149. package/dist/oauth/utilities/getAuthorizeURL.js +5 -1
  150. package/dist/plugin/build-config.d.ts +4 -2
  151. package/dist/plugin/build-config.js +95 -31
  152. package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
  153. package/dist/plugin/cache-revalidation-hooks.js +69 -0
  154. package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +8 -0
  155. package/dist/plugin/cloud-limits/CloudLimitModal/index.js +66 -0
  156. package/dist/plugin/cloud-limits/CloudLimitModal/index.scss +56 -0
  157. package/dist/plugin/cloud-limits/CloudLimitProvider/index.d.ts +4 -0
  158. package/dist/plugin/cloud-limits/CloudLimitProvider/index.js +110 -0
  159. package/dist/plugin/cloud-limits/LimitReachedView/index.css +14 -0
  160. package/dist/plugin/cloud-limits/LimitReachedView/index.d.ts +4 -0
  161. package/dist/plugin/cloud-limits/LimitReachedView/index.js +52 -0
  162. package/dist/plugin/cloud-limits/SlugRegistryContext/index.d.ts +7 -0
  163. package/dist/plugin/cloud-limits/SlugRegistryContext/index.js +3 -0
  164. package/dist/plugin/cloud-limits/SlugTracker/index.d.ts +1 -0
  165. package/dist/plugin/cloud-limits/SlugTracker/index.js +27 -0
  166. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +2 -0
  167. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.js +30 -0
  168. package/dist/plugin/cloud-limits/routes.d.ts +2 -0
  169. package/dist/plugin/cloud-limits/routes.js +4 -0
  170. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.d.ts +9 -0
  171. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.js +28 -0
  172. package/dist/plugin/cloud-limits/shared.d.ts +10 -0
  173. package/dist/plugin/cloud-limits/shared.js +52 -0
  174. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.d.ts +2 -0
  175. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.js +134 -0
  176. package/dist/plugin/cloud-limits/utilities/toasts.d.ts +4 -0
  177. package/dist/plugin/cloud-limits/utilities/toasts.js +19 -0
  178. package/dist/plugin/make-permission-access/make-permission-access.d.ts +8 -0
  179. package/dist/plugin/make-permission-access/make-permission-access.js +24 -0
  180. package/dist/plugin/sandbox-upload-fetch.d.ts +32 -0
  181. package/dist/plugin/sandbox-upload-fetch.js +53 -0
  182. package/dist/skills/deploy-to-figma/SKILL.md +234 -0
  183. package/dist/skills/deploy-to-figma/references/cli-reference.md +146 -0
  184. package/dist/storage-content-api/client-uploads/generate.js +2 -1
  185. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.d.ts +11 -0
  186. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.js +27 -0
  187. package/dist/storage-content-api/index.js +1 -0
  188. package/dist/storage-content-api/resolveDownloadResponseHeaders.d.ts +5 -0
  189. package/dist/storage-content-api/resolveDownloadResponseHeaders.js +13 -0
  190. package/dist/storage-content-api/staticHandler.js +2 -1
  191. package/dist/storage-content-api/types.d.ts +4 -1
  192. package/dist/translations/ar.d.ts +12 -0
  193. package/dist/translations/ar.js +12 -0
  194. package/dist/translations/az.d.ts +12 -0
  195. package/dist/translations/az.js +12 -0
  196. package/dist/translations/bg.d.ts +12 -0
  197. package/dist/translations/bg.js +12 -0
  198. package/dist/translations/bnBd.d.ts +12 -0
  199. package/dist/translations/bnBd.js +12 -0
  200. package/dist/translations/bnIn.d.ts +12 -0
  201. package/dist/translations/bnIn.js +12 -0
  202. package/dist/translations/ca.d.ts +12 -0
  203. package/dist/translations/ca.js +12 -0
  204. package/dist/translations/cs.d.ts +12 -0
  205. package/dist/translations/cs.js +12 -0
  206. package/dist/translations/da.d.ts +12 -0
  207. package/dist/translations/da.js +12 -0
  208. package/dist/translations/de.d.ts +12 -0
  209. package/dist/translations/de.js +12 -0
  210. package/dist/translations/en.d.ts +12 -0
  211. package/dist/translations/en.js +12 -0
  212. package/dist/translations/es.d.ts +12 -0
  213. package/dist/translations/es.js +12 -0
  214. package/dist/translations/et.d.ts +12 -0
  215. package/dist/translations/et.js +12 -0
  216. package/dist/translations/fa.d.ts +12 -0
  217. package/dist/translations/fa.js +12 -0
  218. package/dist/translations/fr.d.ts +12 -0
  219. package/dist/translations/fr.js +12 -0
  220. package/dist/translations/he.d.ts +12 -0
  221. package/dist/translations/he.js +12 -0
  222. package/dist/translations/hr.d.ts +12 -0
  223. package/dist/translations/hr.js +12 -0
  224. package/dist/translations/hu.d.ts +12 -0
  225. package/dist/translations/hu.js +12 -0
  226. package/dist/translations/hy.d.ts +12 -0
  227. package/dist/translations/hy.js +12 -0
  228. package/dist/translations/id.d.ts +12 -0
  229. package/dist/translations/id.js +12 -0
  230. package/dist/translations/index.d.ts +533 -0
  231. package/dist/translations/index.js +90 -0
  232. package/dist/translations/is.d.ts +12 -0
  233. package/dist/translations/is.js +12 -0
  234. package/dist/translations/it.d.ts +12 -0
  235. package/dist/translations/it.js +12 -0
  236. package/dist/translations/ja.d.ts +12 -0
  237. package/dist/translations/ja.js +12 -0
  238. package/dist/translations/ko.d.ts +12 -0
  239. package/dist/translations/ko.js +12 -0
  240. package/dist/translations/lt.d.ts +12 -0
  241. package/dist/translations/lt.js +12 -0
  242. package/dist/translations/lv.d.ts +12 -0
  243. package/dist/translations/lv.js +12 -0
  244. package/dist/translations/my.d.ts +12 -0
  245. package/dist/translations/my.js +12 -0
  246. package/dist/translations/nb.d.ts +12 -0
  247. package/dist/translations/nb.js +12 -0
  248. package/dist/translations/nl.d.ts +12 -0
  249. package/dist/translations/nl.js +12 -0
  250. package/dist/translations/pl.d.ts +12 -0
  251. package/dist/translations/pl.js +12 -0
  252. package/dist/translations/pt.d.ts +12 -0
  253. package/dist/translations/pt.js +12 -0
  254. package/dist/translations/ro.d.ts +12 -0
  255. package/dist/translations/ro.js +12 -0
  256. package/dist/translations/rs.d.ts +12 -0
  257. package/dist/translations/rs.js +12 -0
  258. package/dist/translations/rsLatin.d.ts +12 -0
  259. package/dist/translations/rsLatin.js +12 -0
  260. package/dist/translations/ru.d.ts +12 -0
  261. package/dist/translations/ru.js +12 -0
  262. package/dist/translations/sk.d.ts +12 -0
  263. package/dist/translations/sk.js +12 -0
  264. package/dist/translations/sl.d.ts +12 -0
  265. package/dist/translations/sl.js +12 -0
  266. package/dist/translations/sv.d.ts +12 -0
  267. package/dist/translations/sv.js +12 -0
  268. package/dist/translations/ta.d.ts +12 -0
  269. package/dist/translations/ta.js +12 -0
  270. package/dist/translations/th.d.ts +12 -0
  271. package/dist/translations/th.js +12 -0
  272. package/dist/translations/tr.d.ts +12 -0
  273. package/dist/translations/tr.js +12 -0
  274. package/dist/translations/uk.d.ts +12 -0
  275. package/dist/translations/uk.js +12 -0
  276. package/dist/translations/vi.d.ts +12 -0
  277. package/dist/translations/vi.js +12 -0
  278. package/dist/translations/zh.d.ts +12 -0
  279. package/dist/translations/zh.js +12 -0
  280. package/dist/translations/zhTw.d.ts +12 -0
  281. package/dist/translations/zhTw.js +12 -0
  282. package/dist/types.d.ts +11 -0
  283. package/dist/utils/assert-never.d.ts +1 -0
  284. package/dist/utils/assert-never.js +3 -0
  285. package/dist/utils/build-detection.d.ts +6 -1
  286. package/dist/utils/build-detection.js +68 -89
  287. package/dist/utils/deploy-adapter.d.ts +3 -35
  288. package/dist/utils/deploy-adapter.js +25 -14
  289. package/dist/utils/lambda-config.js +18 -23
  290. package/dist/utils/load-payload-config.d.ts +2 -2
  291. package/dist/utils/messages.js +24 -3
  292. package/dist/utils/next-image-loader-config.d.ts +2 -0
  293. package/dist/utils/next-image-loader-config.js +63 -0
  294. package/dist/utils/next-image-loader-file.d.ts +2 -0
  295. package/dist/utils/next-image-loader-file.js +11 -0
  296. package/dist/utils/payload-generate.d.ts +10 -0
  297. package/dist/utils/payload-generate.js +59 -0
  298. package/dist/utils/pnpm-builds.d.ts +14 -0
  299. package/dist/utils/pnpm-builds.js +125 -0
  300. package/dist/utils/s3-upload.js +4 -1
  301. package/package.json +31 -7
  302. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +0 -10
  303. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +0 -71
  304. package/dist/db-content-api/utilities/meta/buildMeta.d.ts +0 -41
  305. package/dist/db-content-api/utilities/meta/buildMeta.js +0 -39
  306. package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +0 -16
  307. package/dist/db-content-api/utilities/meta/buildPathTypes.js +0 -243
  308. package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +0 -12
  309. package/dist/db-content-api/utilities/meta/buildUniquePaths.js +0 -60
  310. package/dist/lib/download-skill.d.ts +0 -12
  311. package/dist/lib/download-skill.js +0 -77
  312. package/dist/utils/adapters/nextjs.d.ts +0 -8
  313. package/dist/utils/adapters/nextjs.js +0 -61
  314. package/dist/utils/adapters/nitro.d.ts +0 -8
  315. package/dist/utils/adapters/nitro.js +0 -172
  316. package/dist/utils/adapters/vite.js +0 -31
  317. package/dist/utils/asset-collection.js +0 -144
  318. package/dist/utils/build-lambda-zip.js +0 -90
  319. package/dist/utils/fs-utils.d.ts +0 -12
  320. package/dist/utils/fs-utils.js +0 -55
@@ -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-alpha.0",
3
+ "version": "0.1.0-alpha.10",
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,6 +38,7 @@
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",
@@ -41,7 +52,10 @@
41
52
  "open": "^10.2.0",
42
53
  "openapi-fetch": "0.15.0",
43
54
  "picocolors": "1.1.1",
44
- "tar": "^7.5.13",
55
+ "qs-esm": "^8.0.1",
56
+ "sanitize-filename": "^1.6.4",
57
+ "skills": "1.4.4",
58
+ "tar": "^7.5.21",
45
59
  "terminal-link": "^5.0.0",
46
60
  "ts-morph": "^21.0.1",
47
61
  "uuid": "^10.0.0"
@@ -49,7 +63,11 @@
49
63
  "devDependencies": {
50
64
  "@payloadcms/eslint-config": "3.28.0",
51
65
  "@payloadcms/eslint-plugin": "3.28.0",
52
- "@payloadcms/next": "4.0.0-canary.17",
66
+ "@payloadcms/next": "4.0.0-canary.28",
67
+ "@payloadcms/plugin-cloud-storage": "4.0.0-canary.28",
68
+ "@payloadcms/richtext-lexical": "4.0.0-canary.28",
69
+ "@payloadcms/translations": "4.0.0-canary.28",
70
+ "@payloadcms/ui": "4.0.0-canary.28",
53
71
  "@swc/cli": "0.7.7",
54
72
  "@types/archiver": "7.0.0",
55
73
  "@types/cross-spawn": "6.0.6",
@@ -58,17 +76,21 @@
58
76
  "@types/uuid": "^8.3.4",
59
77
  "copyfiles": "^2.4.1",
60
78
  "eslint": "9.22.0",
61
- "next": "^16.2.6",
79
+ "next": "^16.3.3",
62
80
  "openapi-typescript": "^7.13.0",
81
+ "payload": "4.0.0-canary.28",
63
82
  "rimraf": "^6.1.3",
64
83
  "tsx": "4.20.6",
65
84
  "typescript": "5.7.3",
66
85
  "vitest": "4.0.15"
67
86
  },
68
87
  "peerDependencies": {
69
- "@payloadcms/plugin-cloud-storage": ">=4.0.0-canary.17 <4.0.0-internal",
70
- "@payloadcms/richtext-lexical": ">=4.0.0-canary.17 <4.0.0-internal",
71
- "payload": ">=4.0.0-canary.17 <4.0.0-internal"
88
+ "@payloadcms/plugin-cloud-storage": ">=4.0.0-canary.28 <4.0.0-internal",
89
+ "@payloadcms/richtext-lexical": ">=4.0.0-canary.28 <4.0.0-internal",
90
+ "@payloadcms/translations": ">=4.0.0-canary.28 <4.0.0-internal",
91
+ "@payloadcms/ui": ">=4.0.0-canary.28 <4.0.0-internal",
92
+ "payload": ">=4.0.0-canary.28 <4.0.0-internal",
93
+ "react": "^19.0.1 || ^19.1.2 || ^19.2.1"
72
94
  },
73
95
  "peerDependenciesMeta": {
74
96
  "@payloadcms/plugin-cloud-storage": {
@@ -97,12 +119,14 @@
97
119
  "generate:types": "tsx scripts/generate-types.ts",
98
120
  "lint": "eslint .",
99
121
  "lint:fix": "eslint . --fix",
122
+ "payload:cli": "tsx scripts/payload-cli.ts",
100
123
  "start": "pnpm build && node ./bin/cli.js",
101
124
  "test": "TEST_UNIT=true vitest run",
102
125
  "test:int": "TEST_INT=true vitest run --config vitest.config.int.ts",
103
126
  "test:int:watch": "TEST_INT=true vitest --config vitest.config.int.ts",
104
127
  "test:e2e": "TEST_E2E=true vitest run --config vitest.config.e2e.ts",
105
128
  "test:e2e:watch": "TEST_E2E=true vitest --config vitest.config.e2e.ts",
129
+ "test:types": "tsc --project tsconfig.imageSizeOptions.json",
106
130
  "test:watch": "TEST_UNIT=true vitest"
107
131
  }
108
132
  }
@@ -1,10 +0,0 @@
1
- import type { Payload } from 'payload';
2
- /**
3
- * Extracts all localized field paths from a collection's field configuration.
4
- * Recursively traverses nested structures (groups, arrays, blocks, tabs) to find fields marked as localized.
5
- *
6
- * @param payload - The Payload instance containing collection configurations
7
- * @param collectionSlug - The slug of the collection to extract localized paths from
8
- * @returns Array of dot-notation paths to localized fields (e.g., ['title', 'metadata.description'])
9
- */
10
- export declare function buildLocalizedPaths(payload: Payload, collectionSlug: string): string[];
@@ -1,71 +0,0 @@
1
- import { resolveBlocks } from '../resolveBlocks.js';
2
- /**
3
- * Extracts all localized field paths from a collection's field configuration.
4
- * Recursively traverses nested structures (groups, arrays, blocks, tabs) to find fields marked as localized.
5
- *
6
- * @param payload - The Payload instance containing collection configurations
7
- * @param collectionSlug - The slug of the collection to extract localized paths from
8
- * @returns Array of dot-notation paths to localized fields (e.g., ['title', 'metadata.description'])
9
- */ export function buildLocalizedPaths(payload, collectionSlug) {
10
- const collectionConfig = payload.config.collections.find((c)=>c.slug === collectionSlug);
11
- if (!collectionConfig) {
12
- return [];
13
- }
14
- const localizedPaths = [];
15
- traverseFields(collectionConfig.fields, localizedPaths, '', false, payload.config.blocks);
16
- // Add _status to localized paths if localizeStatus is enabled for this collection
17
- // _status is a base field added by Payload when versions.drafts is enabled,
18
- // and it becomes localized when versions.drafts.localizeStatus is true
19
- // localizeStatus requires both experimental flag AND collection-level config
20
- const experimentalLocalizeStatus = 'experimental' in payload.config && payload.config.experimental && typeof payload.config.experimental === 'object' && 'localizeStatus' in payload.config.experimental && payload.config.experimental.localizeStatus === true;
21
- const drafts = collectionConfig.versions && typeof collectionConfig.versions === 'object' ? collectionConfig.versions.drafts : false;
22
- const collectionLocalizeStatus = drafts && typeof drafts === 'object' && 'localizeStatus' in drafts && drafts.localizeStatus === true;
23
- const hasLocalizeStatus = payload.config.localization && experimentalLocalizeStatus && collectionLocalizeStatus;
24
- if (hasLocalizeStatus && !localizedPaths.includes('_status')) {
25
- localizedPaths.push('_status');
26
- }
27
- return localizedPaths;
28
- }
29
- /** Recursively traverses fields to find and collect localized paths */ function traverseFields(fields, localizedPaths, parentPath = '', parentIsLocalized = false, configBlocks) {
30
- for (const field of fields){
31
- // Unnamed layout fields (row, collapsible, unnamed group, unnamed tabs) don't store data
32
- // at their own level, but their child fields may be localized. Recurse into them with
33
- // the same parent path so localized fields bubble up correctly.
34
- if (!('name' in field)) {
35
- if ('fields' in field && Array.isArray(field.fields)) {
36
- traverseFields(field.fields, localizedPaths, parentPath, parentIsLocalized, configBlocks);
37
- }
38
- if ('tabs' in field && Array.isArray(field.tabs)) {
39
- for (const tab of field.tabs){
40
- if (tab.fields) {
41
- const tabPath = tab.name ? buildPath(parentPath, tab.name) : parentPath;
42
- traverseFields(tab.fields, localizedPaths, tabPath, parentIsLocalized, configBlocks);
43
- }
44
- }
45
- }
46
- continue;
47
- }
48
- const fieldPath = buildPath(parentPath, field.name);
49
- const isLocalized = 'localized' in field && field.localized === true;
50
- const includeNestedPaths = isLocalized || parentIsLocalized;
51
- // Add field to results if localized or parent is localized
52
- if (includeNestedPaths) {
53
- localizedPaths.push(fieldPath);
54
- }
55
- // Handle blocks field - has a special 'blocks' array structure and each block has its own nested fields
56
- if (field.type === 'blocks' && 'blocks' in field) {
57
- for (const block of resolveBlocks(field.blocks, configBlocks)){
58
- traverseFields(block.fields, localizedPaths, fieldPath, includeNestedPaths, configBlocks);
59
- }
60
- continue;
61
- }
62
- // Handle field type that support nested fields
63
- // Recursively handle nested structures (groups, arrays, tab, etc)
64
- if ('fields' in field) {
65
- traverseFields(field.fields, localizedPaths, fieldPath, includeNestedPaths, configBlocks);
66
- }
67
- }
68
- }
69
- /** Builds a dot-notation path from parent path and field name */ function buildPath(parentPath, fieldName) {
70
- return parentPath ? `${parentPath}.${fieldName}` : fieldName;
71
- }
@@ -1,41 +0,0 @@
1
- import type { Payload, Where } from 'payload';
2
- import type { components } from '../../generated/content-api-types.js';
3
- import type { PathTypesRecord } from '../../temp-utilities/types.js';
4
- /**
5
- * Metadata sent to Content API for query processing.
6
- *
7
- * TODO: This interface is defined here temporarily so Content API can test the integration.
8
- * Once Content API implements support for pathTypes with relationship info, this type
9
- * should be generated from openapi.json and ContentAPIMeta can be removed.
10
- */
11
- export interface ContentAPIMeta {
12
- localizedPaths?: string[];
13
- pathTypes?: PathTypesRecord;
14
- uniquePaths?: {
15
- paths: string[];
16
- }[];
17
- }
18
- /**
19
- * The type that Content API currently expects (from generated types).
20
- * This is more restrictive than ContentAPIMeta until Content API is updated.
21
- */
22
- type ContentAPIMetaGenerated = components['schemas']['RequestMeta'];
23
- export interface BuildMetaOptions {
24
- collection: string;
25
- /** Document data — when provided, unique field constraints are included in meta. */
26
- data?: Record<string, unknown>;
27
- locale: string | undefined;
28
- where?: Where;
29
- }
30
- /**
31
- * Builds the `meta` object for Content API requests.
32
- * Combines pathTypes (for array field handling) and localizedPaths (for locale queries).
33
- *
34
- * @param payload - The Payload instance
35
- * @param options - Options including collection slug, locale, and where clause
36
- * @returns Object with meta property ready to spread into request body, or empty object if no meta needed
37
- */
38
- export declare function buildMeta(payload: Payload, options: BuildMetaOptions): {
39
- meta?: ContentAPIMetaGenerated;
40
- };
41
- export {};
@@ -1,39 +0,0 @@
1
- import { buildLocalizedPaths } from './buildLocalizedPaths.js';
2
- import { buildPathTypes } from './buildPathTypes.js';
3
- import { buildUniquePaths } from './buildUniquePaths.js';
4
- /**
5
- * Builds the `meta` object for Content API requests.
6
- * Combines pathTypes (for array field handling) and localizedPaths (for locale queries).
7
- *
8
- * @param payload - The Payload instance
9
- * @param options - Options including collection slug, locale, and where clause
10
- * @returns Object with meta property ready to spread into request body, or empty object if no meta needed
11
- */ export function buildMeta(payload, options) {
12
- const { collection, data, locale, where } = options;
13
- const meta = {};
14
- // Add pathTypes if there are array fields in the where clause
15
- const pathTypes = buildPathTypes(payload, collection, where);
16
- if (Object.keys(pathTypes).length > 0) {
17
- meta.pathTypes = pathTypes;
18
- }
19
- // Add localizedPaths if locale is specified (but not 'all')
20
- if (locale && locale !== 'all') {
21
- const localizedPaths = buildLocalizedPaths(payload, collection);
22
- if (localizedPaths.length > 0) {
23
- meta.localizedPaths = localizedPaths;
24
- }
25
- }
26
- // Add uniquePaths when data is provided (create/upsert operations)
27
- if (data) {
28
- const uniquePaths = buildUniquePaths(payload, collection, data);
29
- if (uniquePaths.length > 0) {
30
- meta.uniquePaths = uniquePaths;
31
- }
32
- }
33
- // Cast to generated type - Content API will need to be updated to handle
34
- // the new pathTypes format with relationship info. Until then, it will
35
- // ignore the extra fields but still receive the data for testing.
36
- return Object.keys(meta).length > 0 ? {
37
- meta: meta
38
- } : {};
39
- }
@@ -1,16 +0,0 @@
1
- import type { Payload, Where } from 'payload';
2
- import type { PathTypesRecord } from '../../temp-utilities/types.js';
3
- /**
4
- * Builds pathTypes metadata for Content API request.
5
- * Returns a record of paths with their types for proper query generation.
6
- *
7
- * Includes:
8
- * - Array fields (type: "array")
9
- * - Relationship fields (type: { type: "relationship", collection, hasMany })
10
- * - Join fields (type: { type: "join", collection, hasMany, on })
11
- *
12
- * Localized array/blocks fields (stored as locale maps) are handled specially:
13
- * - The localized field itself is NOT marked as 'array' (it's a locale map object)
14
- * - The locale-specific path (e.g. "localizedBlocks.en") IS marked as 'array'
15
- */
16
- export declare function buildPathTypes(payload: Payload, collectionSlug: string, where: undefined | Where): PathTypesRecord;