@payloadcms/figma 0.0.1-alpha.9 → 0.1.0-alpha.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 (470) hide show
  1. package/dist/api/control-plane.d.ts +56 -7
  2. package/dist/api/control-plane.js +188 -74
  3. package/dist/api/error-response.d.ts +36 -0
  4. package/dist/api/error-response.js +66 -0
  5. package/dist/api/figma-api.d.ts +24 -3
  6. package/dist/api/figma-api.js +110 -34
  7. package/dist/auth/browser.d.ts +0 -1
  8. package/dist/auth/browser.js +0 -2
  9. package/dist/auth/callback-server.d.ts +19 -8
  10. package/dist/auth/callback-server.js +72 -32
  11. package/dist/auth/credentials.d.ts +20 -0
  12. package/dist/auth/credentials.js +19 -0
  13. package/dist/auth/crypto-utils.d.ts +28 -1
  14. package/dist/auth/crypto-utils.js +132 -23
  15. package/dist/auth/jwt-validator.d.ts +23 -6
  16. package/dist/auth/jwt-validator.js +35 -9
  17. package/dist/auth/oauth-flow.d.ts +19 -4
  18. package/dist/auth/oauth-flow.js +151 -34
  19. package/dist/auth/paste-code.d.ts +33 -0
  20. package/dist/auth/paste-code.js +87 -0
  21. package/dist/auth/pkce.d.ts +0 -1
  22. package/dist/auth/pkce.js +0 -2
  23. package/dist/auth/project-token.d.ts +32 -17
  24. package/dist/auth/project-token.js +176 -68
  25. package/dist/auth/refresh.d.ts +2 -2
  26. package/dist/auth/refresh.js +25 -14
  27. package/dist/auth/token-store-migration.d.ts +57 -0
  28. package/dist/auth/token-store-migration.js +154 -0
  29. package/dist/auth/token-store.d.ts +63 -98
  30. package/dist/auth/token-store.js +405 -124
  31. package/dist/auth/types.d.ts +40 -6
  32. package/dist/auth/types.js +1 -3
  33. package/dist/cli.d.ts +0 -1
  34. package/dist/cli.js +102 -8
  35. package/dist/commands/bootstrap.d.ts +17 -0
  36. package/dist/commands/bootstrap.js +88 -0
  37. package/dist/commands/build-lambda-zip.d.ts +4 -0
  38. package/dist/commands/build-lambda-zip.js +17 -0
  39. package/dist/commands/debug.d.ts +7 -0
  40. package/dist/commands/debug.js +178 -0
  41. package/dist/commands/deploy.d.ts +11 -1
  42. package/dist/commands/deploy.js +193 -153
  43. package/dist/commands/dump-tokens.d.ts +11 -0
  44. package/dist/commands/dump-tokens.js +67 -0
  45. package/dist/commands/env.d.ts +12 -0
  46. package/dist/commands/env.js +86 -0
  47. package/dist/commands/init.d.ts +9 -6
  48. package/dist/commands/init.js +232 -152
  49. package/dist/commands/list-tokens.d.ts +3 -4
  50. package/dist/commands/list-tokens.js +24 -11
  51. package/dist/commands/login.d.ts +8 -2
  52. package/dist/commands/login.js +34 -18
  53. package/dist/commands/logout.d.ts +5 -5
  54. package/dist/commands/logout.js +77 -17
  55. package/dist/commands/upgrade.d.ts +4 -0
  56. package/dist/commands/upgrade.js +329 -0
  57. package/dist/commands/upload-schema.d.ts +8 -0
  58. package/dist/commands/upload-schema.js +91 -0
  59. package/dist/config/oauth.d.ts +17 -12
  60. package/dist/config/oauth.js +38 -39
  61. package/dist/constants.d.ts +63 -19
  62. package/dist/constants.js +158 -20
  63. package/dist/db-content-api/generated/content-api-types.d.ts +7574 -0
  64. package/dist/db-content-api/generated/content-api-types.js +5 -0
  65. package/dist/db-content-api/index.d.ts +37 -0
  66. package/dist/db-content-api/index.js +938 -0
  67. package/dist/db-content-api/temp-utilities/slug.d.ts +1 -0
  68. package/dist/db-content-api/temp-utilities/slug.js +1 -0
  69. package/dist/db-content-api/temp-utilities/sorting.d.ts +2 -0
  70. package/dist/db-content-api/temp-utilities/sorting.js +37 -0
  71. package/dist/db-content-api/temp-utilities/types.d.ts +21 -0
  72. package/dist/db-content-api/temp-utilities/types.js +13 -0
  73. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +38 -0
  74. package/dist/db-content-api/temp-utilities/unwrapDocument.js +62 -0
  75. package/dist/db-content-api/utilities/auth.d.ts +29 -0
  76. package/dist/db-content-api/utilities/auth.js +82 -0
  77. package/dist/db-content-api/utilities/data/applyDefaults.d.ts +6 -0
  78. package/dist/db-content-api/utilities/data/applyDefaults.js +75 -0
  79. package/dist/db-content-api/utilities/data/castFieldValue.d.ts +10 -0
  80. package/dist/db-content-api/utilities/data/castFieldValue.js +66 -0
  81. package/dist/db-content-api/utilities/data/index.d.ts +48 -0
  82. package/dist/db-content-api/utilities/data/index.js +299 -0
  83. package/dist/db-content-api/utilities/data/pointShape.d.ts +3 -0
  84. package/dist/db-content-api/utilities/data/pointShape.js +43 -0
  85. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +11 -0
  86. package/dist/db-content-api/utilities/data/removeVirtualFields.js +52 -0
  87. package/dist/db-content-api/utilities/data/richTextShape.d.ts +3 -0
  88. package/dist/db-content-api/utilities/data/richTextShape.js +56 -0
  89. package/dist/db-content-api/utilities/data/stripFields.d.ts +47 -0
  90. package/dist/db-content-api/utilities/data/stripFields.js +170 -0
  91. package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +22 -0
  92. package/dist/db-content-api/utilities/data/transformPublishedLocale.js +40 -0
  93. package/dist/db-content-api/utilities/data/validateRelationships.d.ts +6 -0
  94. package/dist/db-content-api/utilities/data/validateRelationships.js +100 -0
  95. package/dist/db-content-api/utilities/joins.d.ts +52 -0
  96. package/dist/db-content-api/utilities/joins.js +137 -0
  97. package/dist/db-content-api/utilities/locale/index.d.ts +9 -0
  98. package/dist/db-content-api/utilities/locale/index.js +19 -0
  99. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +10 -0
  100. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +71 -0
  101. package/dist/db-content-api/utilities/meta/buildMeta.d.ts +41 -0
  102. package/dist/db-content-api/utilities/meta/buildMeta.js +39 -0
  103. package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +16 -0
  104. package/dist/db-content-api/utilities/meta/buildPathTypes.js +243 -0
  105. package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +12 -0
  106. package/dist/db-content-api/utilities/meta/buildUniquePaths.js +60 -0
  107. package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.d.ts +9 -0
  108. package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.js +100 -0
  109. package/dist/db-content-api/utilities/resolveBlocks.d.ts +19 -0
  110. package/dist/db-content-api/utilities/resolveBlocks.js +31 -0
  111. package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +55 -0
  112. package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +182 -0
  113. package/dist/db-content-api/utilities/where.d.ts +19 -0
  114. package/dist/db-content-api/utilities/where.js +106 -0
  115. package/dist/deploy/schedule-extract-plugin.d.ts +10 -0
  116. package/dist/deploy/schedule-extract-plugin.js +32 -0
  117. package/dist/endpoints/health.d.ts +2 -0
  118. package/dist/endpoints/health.js +9 -0
  119. package/dist/endpoints/schema.d.ts +2 -0
  120. package/dist/endpoints/schema.js +27 -0
  121. package/dist/exports/client.d.ts +2 -1
  122. package/dist/exports/client.js +2 -2
  123. package/dist/index.d.ts +2 -2
  124. package/dist/index.js +3 -3
  125. package/dist/lib/download-skill.d.ts +12 -0
  126. package/dist/lib/download-skill.js +77 -0
  127. package/dist/oauth/components/FigmaAvatar/index.d.ts +3 -0
  128. package/dist/oauth/components/FigmaAvatar/index.js +25 -0
  129. package/dist/oauth/components/FigmaAvatar/index.scss +12 -0
  130. package/dist/oauth/components/FigmaAvatarCell/index.d.ts +4 -0
  131. package/dist/oauth/components/FigmaAvatarCell/index.js +23 -0
  132. package/dist/oauth/components/FigmaAvatarCell/index.scss +5 -0
  133. package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +8 -0
  134. package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +35 -0
  135. package/dist/oauth/components/FigmaAvatarPlaceholder/index.scss +28 -0
  136. package/dist/oauth/components/LoginButton/iframeAutoLogin.d.ts +81 -0
  137. package/dist/oauth/components/LoginButton/iframeAutoLogin.js +168 -0
  138. package/dist/oauth/components/LoginButton/index.d.ts +0 -1
  139. package/dist/oauth/components/LoginButton/index.js +156 -18
  140. package/dist/oauth/components/LoginButton/index.scss +75 -3
  141. package/dist/oauth/components/LogoutButton/index.d.ts +0 -1
  142. package/dist/oauth/components/LogoutButton/index.js +20 -9
  143. package/dist/oauth/defaults.d.ts +3 -2
  144. package/dist/oauth/defaults.js +79 -12
  145. package/dist/oauth/endpoints/getLoginEndpoint.d.ts +0 -1
  146. package/dist/oauth/endpoints/getLoginEndpoint.js +87 -84
  147. package/dist/oauth/endpoints/getLogoutEndpoint.d.ts +0 -1
  148. package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -6
  149. package/dist/oauth/endpoints/getMetaEndpoint.d.ts +0 -1
  150. package/dist/oauth/endpoints/getMetaEndpoint.js +18 -5
  151. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts +0 -1
  152. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js +11 -4
  153. package/dist/oauth/exports/client.d.ts +0 -1
  154. package/dist/oauth/exports/client.js +0 -2
  155. package/dist/oauth/hooks/afterLogout.d.ts +0 -1
  156. package/dist/oauth/hooks/afterLogout.js +0 -2
  157. package/dist/oauth/hooks/me.d.ts +0 -1
  158. package/dist/oauth/hooks/me.js +0 -2
  159. package/dist/oauth/hooks/refresh.d.ts +0 -1
  160. package/dist/oauth/hooks/refresh.js +2 -3
  161. package/dist/oauth/index.d.ts +0 -1
  162. package/dist/oauth/index.js +27 -7
  163. package/dist/oauth/strategy/index.d.ts +0 -3
  164. package/dist/oauth/strategy/index.js +55 -34
  165. package/dist/oauth/types.d.ts +23 -7
  166. package/dist/oauth/types.js +0 -2
  167. package/dist/oauth/utilities/buildUnauthorizedRedirect.d.ts +14 -0
  168. package/dist/oauth/utilities/buildUnauthorizedRedirect.js +28 -0
  169. package/dist/oauth/utilities/clearCookie.d.ts +0 -1
  170. package/dist/oauth/utilities/clearCookie.js +5 -3
  171. package/dist/oauth/utilities/createCookieOptions.d.ts +0 -1
  172. package/dist/oauth/utilities/createCookieOptions.js +9 -4
  173. package/dist/oauth/utilities/createDebugLogger.d.ts +0 -1
  174. package/dist/oauth/utilities/createDebugLogger.js +0 -2
  175. package/dist/oauth/utilities/establishSession.d.ts +22 -0
  176. package/dist/oauth/utilities/establishSession.js +80 -0
  177. package/dist/oauth/utilities/exchangeCodeForAccessToken.d.ts +23 -0
  178. package/dist/oauth/utilities/exchangeCodeForAccessToken.js +26 -0
  179. package/dist/oauth/utilities/extractOrigin.d.ts +0 -1
  180. package/dist/oauth/utilities/extractOrigin.js +0 -2
  181. package/dist/oauth/utilities/figmaHostnames.d.ts +2 -0
  182. package/dist/oauth/utilities/figmaHostnames.js +24 -0
  183. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +0 -1
  184. package/dist/oauth/utilities/getAdminCollectionSlug.js +0 -2
  185. package/dist/oauth/utilities/getAuthorizeURL.d.ts +65 -2
  186. package/dist/oauth/utilities/getAuthorizeURL.js +57 -4
  187. package/dist/oauth/utilities/getCookieExpiration.d.ts +0 -1
  188. package/dist/oauth/utilities/getCookieExpiration.js +0 -2
  189. package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts +0 -1
  190. package/dist/oauth/utilities/getSecondsFromTokenExp.js +0 -2
  191. package/dist/oauth/utilities/getTokenExp.d.ts +0 -1
  192. package/dist/oauth/utilities/getTokenExp.js +0 -2
  193. package/dist/oauth/utilities/getUsernameField.d.ts +0 -1
  194. package/dist/oauth/utilities/getUsernameField.js +0 -2
  195. package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts +0 -1
  196. package/dist/oauth/utilities/hasUserTokenPropsChanged.js +0 -2
  197. package/dist/oauth/utilities/isAbsoluteURL.d.ts +1 -0
  198. package/dist/oauth/utilities/isAbsoluteURL.js +1 -0
  199. package/dist/oauth/utilities/isDuplicateKeyError.d.ts +6 -0
  200. package/dist/oauth/utilities/isDuplicateKeyError.js +12 -0
  201. package/dist/oauth/utilities/mergeHeaders.d.ts +0 -1
  202. package/dist/oauth/utilities/mergeHeaders.js +0 -2
  203. package/dist/oauth/utilities/refreshTokens.d.ts +0 -1
  204. package/dist/oauth/utilities/refreshTokens.js +21 -13
  205. package/dist/oauth/utilities/withPartitionedCookie.d.ts +19 -0
  206. package/dist/oauth/utilities/withPartitionedCookie.js +26 -0
  207. package/dist/oauth/utils/getSearchParam.d.ts +17 -0
  208. package/dist/oauth/utils/getSearchParam.js +22 -0
  209. package/dist/plugin/adapter.d.ts +0 -1
  210. package/dist/plugin/adapter.js +0 -2
  211. package/dist/plugin/auth-preflight.d.ts +7 -0
  212. package/dist/plugin/auth-preflight.js +18 -0
  213. package/dist/plugin/bootstrap-preflight.d.ts +22 -0
  214. package/dist/plugin/bootstrap-preflight.js +43 -0
  215. package/dist/plugin/build-config.d.ts +27 -15
  216. package/dist/plugin/build-config.js +380 -16
  217. package/dist/plugin/dev-cookie-names.d.ts +13 -0
  218. package/dist/plugin/dev-cookie-names.js +17 -0
  219. package/dist/scss.d.js +2 -0
  220. package/dist/storage-content-api/api-types.d.ts +183 -0
  221. package/dist/storage-content-api/api-types.js +4 -0
  222. package/dist/storage-content-api/client-uploads/generate.d.ts +14 -0
  223. package/dist/storage-content-api/client-uploads/generate.js +69 -0
  224. package/dist/storage-content-api/client.d.ts +5 -0
  225. package/dist/storage-content-api/client.js +37 -0
  226. package/dist/storage-content-api/generateURL.d.ts +6 -0
  227. package/dist/storage-content-api/generateURL.js +6 -0
  228. package/dist/storage-content-api/handleDelete.d.ts +7 -0
  229. package/dist/storage-content-api/handleDelete.js +15 -0
  230. package/dist/storage-content-api/handleUpload.d.ts +10 -0
  231. package/dist/storage-content-api/handleUpload.js +162 -0
  232. package/dist/storage-content-api/index.d.ts +4 -0
  233. package/dist/storage-content-api/index.js +37 -0
  234. package/dist/storage-content-api/staticHandler.d.ts +9 -0
  235. package/dist/storage-content-api/staticHandler.js +61 -0
  236. package/dist/storage-content-api/types.d.ts +9 -0
  237. package/dist/storage-content-api/types.js +1 -0
  238. package/dist/storage-content-api/utilities/getSafeFilename.d.ts +11 -0
  239. package/dist/storage-content-api/utilities/getSafeFilename.js +59 -0
  240. package/dist/storage-content-api/utilities/index.d.ts +2 -0
  241. package/dist/storage-content-api/utilities/index.js +2 -0
  242. package/dist/storage-content-api/utilities/parseUploadReference.d.ts +17 -0
  243. package/dist/storage-content-api/utilities/parseUploadReference.js +27 -0
  244. package/dist/templates/.env.example +5 -0
  245. package/dist/templates/README.md +19 -0
  246. package/dist/types/config.d.ts +2 -2
  247. package/dist/types/config.js +0 -4
  248. package/dist/types.d.ts +10 -2
  249. package/dist/types.js +0 -2
  250. package/dist/utils/adapters/nextjs.d.ts +8 -0
  251. package/dist/utils/adapters/nextjs.js +61 -0
  252. package/dist/utils/adapters/nitro.d.ts +8 -0
  253. package/dist/utils/adapters/nitro.js +172 -0
  254. package/dist/utils/adapters/vite.d.ts +9 -0
  255. package/dist/utils/adapters/vite.js +31 -0
  256. package/dist/utils/asset-collection.d.ts +27 -7
  257. package/dist/utils/asset-collection.js +59 -32
  258. package/dist/utils/build-detection.d.ts +5 -12
  259. package/dist/utils/build-detection.js +74 -13
  260. package/dist/utils/build-lambda-zip.d.ts +25 -0
  261. package/dist/utils/build-lambda-zip.js +90 -0
  262. package/dist/utils/cache-bootstrap.d.ts +7 -0
  263. package/dist/utils/cache-bootstrap.js +16 -0
  264. package/dist/utils/config.d.ts +0 -1
  265. package/dist/utils/config.js +1 -3
  266. package/dist/utils/deploy-adapter.d.ts +45 -0
  267. package/dist/utils/deploy-adapter.js +56 -0
  268. package/dist/utils/download-template.d.ts +9 -2
  269. package/dist/utils/download-template.js +24 -20
  270. package/dist/utils/env-management.d.ts +24 -8
  271. package/dist/utils/env-management.js +119 -66
  272. package/dist/utils/format-env-suffix.d.ts +11 -0
  273. package/dist/utils/format-env-suffix.js +11 -0
  274. package/dist/utils/format.d.ts +0 -1
  275. package/dist/utils/format.js +0 -2
  276. package/dist/utils/formatter.d.ts +0 -1
  277. package/dist/utils/formatter.js +23 -13
  278. package/dist/utils/fs-utils.d.ts +12 -0
  279. package/dist/utils/fs-utils.js +55 -0
  280. package/dist/utils/git.d.ts +0 -1
  281. package/dist/utils/git.js +0 -2
  282. package/dist/utils/handle-upgrade.d.ts +8 -0
  283. package/dist/utils/handle-upgrade.js +39 -0
  284. package/dist/utils/is-debug.d.ts +0 -1
  285. package/dist/utils/is-debug.js +0 -2
  286. package/dist/utils/lambda-config.d.ts +3 -2
  287. package/dist/utils/lambda-config.js +75 -80
  288. package/dist/utils/load-payload-config.d.ts +9 -0
  289. package/dist/utils/load-payload-config.js +27 -0
  290. package/dist/utils/log.d.ts +0 -1
  291. package/dist/utils/log.js +0 -2
  292. package/dist/utils/messages.d.ts +1 -3
  293. package/dist/utils/messages.js +47 -13
  294. package/dist/utils/package-manager.d.ts +24 -1
  295. package/dist/utils/package-manager.js +53 -2
  296. package/dist/utils/parse-template-spec.d.ts +11 -0
  297. package/dist/utils/parse-template-spec.js +60 -0
  298. package/dist/utils/payload-config-ast.d.ts +27 -7
  299. package/dist/utils/payload-config-ast.js +106 -60
  300. package/dist/utils/payload-config-finder.d.ts +2 -3
  301. package/dist/utils/payload-config-finder.js +48 -11
  302. package/dist/utils/payload-config-modifier.d.ts +1 -2
  303. package/dist/utils/payload-config-modifier.js +114 -68
  304. package/dist/utils/payload-package-check.d.ts +28 -3
  305. package/dist/utils/payload-package-check.js +90 -31
  306. package/dist/utils/project.d.ts +8 -4
  307. package/dist/utils/project.js +63 -37
  308. package/dist/utils/resolve-environment.d.ts +13 -0
  309. package/dist/utils/resolve-environment.js +29 -0
  310. package/dist/utils/s3-upload.d.ts +7 -3
  311. package/dist/utils/s3-upload.js +44 -9
  312. package/dist/utils/token-display.d.ts +5 -2
  313. package/dist/utils/token-display.js +49 -24
  314. package/dist/utils/typescript-validator.d.ts +0 -1
  315. package/dist/utils/typescript-validator.js +4 -8
  316. package/dist/utils/version-check.d.ts +2 -0
  317. package/dist/utils/version-check.js +43 -0
  318. package/package.json +47 -16
  319. package/dist/api/control-plane.d.ts.map +0 -1
  320. package/dist/api/control-plane.js.map +0 -1
  321. package/dist/api/figma-api.d.ts.map +0 -1
  322. package/dist/api/figma-api.js.map +0 -1
  323. package/dist/auth/browser.d.ts.map +0 -1
  324. package/dist/auth/browser.js.map +0 -1
  325. package/dist/auth/callback-server.d.ts.map +0 -1
  326. package/dist/auth/callback-server.js.map +0 -1
  327. package/dist/auth/crypto-utils.d.ts.map +0 -1
  328. package/dist/auth/crypto-utils.js.map +0 -1
  329. package/dist/auth/jwt-validator.d.ts.map +0 -1
  330. package/dist/auth/jwt-validator.js.map +0 -1
  331. package/dist/auth/oauth-flow.d.ts.map +0 -1
  332. package/dist/auth/oauth-flow.js.map +0 -1
  333. package/dist/auth/pkce.d.ts.map +0 -1
  334. package/dist/auth/pkce.js.map +0 -1
  335. package/dist/auth/project-token.d.ts.map +0 -1
  336. package/dist/auth/project-token.js.map +0 -1
  337. package/dist/auth/refresh.d.ts.map +0 -1
  338. package/dist/auth/refresh.js.map +0 -1
  339. package/dist/auth/token-store.d.ts.map +0 -1
  340. package/dist/auth/token-store.js.map +0 -1
  341. package/dist/auth/types.d.ts.map +0 -1
  342. package/dist/auth/types.js.map +0 -1
  343. package/dist/cli.d.ts.map +0 -1
  344. package/dist/cli.js.map +0 -1
  345. package/dist/commands/deploy.d.ts.map +0 -1
  346. package/dist/commands/deploy.js.map +0 -1
  347. package/dist/commands/init.d.ts.map +0 -1
  348. package/dist/commands/init.js.map +0 -1
  349. package/dist/commands/list-tokens.d.ts.map +0 -1
  350. package/dist/commands/list-tokens.js.map +0 -1
  351. package/dist/commands/login.d.ts.map +0 -1
  352. package/dist/commands/login.js.map +0 -1
  353. package/dist/commands/logout.d.ts.map +0 -1
  354. package/dist/commands/logout.js.map +0 -1
  355. package/dist/config/oauth.d.ts.map +0 -1
  356. package/dist/config/oauth.js.map +0 -1
  357. package/dist/constants.d.ts.map +0 -1
  358. package/dist/constants.js.map +0 -1
  359. package/dist/exports/client.d.ts.map +0 -1
  360. package/dist/exports/client.js.map +0 -1
  361. package/dist/index.d.ts.map +0 -1
  362. package/dist/index.js.map +0 -1
  363. package/dist/oauth/components/LoginButton/index.d.ts.map +0 -1
  364. package/dist/oauth/components/LoginButton/index.js.map +0 -1
  365. package/dist/oauth/components/LogoutButton/index.d.ts.map +0 -1
  366. package/dist/oauth/components/LogoutButton/index.js.map +0 -1
  367. package/dist/oauth/defaults.d.ts.map +0 -1
  368. package/dist/oauth/defaults.js.map +0 -1
  369. package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +0 -1
  370. package/dist/oauth/endpoints/getLoginEndpoint.js.map +0 -1
  371. package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +0 -1
  372. package/dist/oauth/endpoints/getLogoutEndpoint.js.map +0 -1
  373. package/dist/oauth/endpoints/getMetaEndpoint.d.ts.map +0 -1
  374. package/dist/oauth/endpoints/getMetaEndpoint.js.map +0 -1
  375. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts.map +0 -1
  376. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js.map +0 -1
  377. package/dist/oauth/exports/client.d.ts.map +0 -1
  378. package/dist/oauth/exports/client.js.map +0 -1
  379. package/dist/oauth/hooks/afterLogout.d.ts.map +0 -1
  380. package/dist/oauth/hooks/afterLogout.js.map +0 -1
  381. package/dist/oauth/hooks/me.d.ts.map +0 -1
  382. package/dist/oauth/hooks/me.js.map +0 -1
  383. package/dist/oauth/hooks/refresh.d.ts.map +0 -1
  384. package/dist/oauth/hooks/refresh.js.map +0 -1
  385. package/dist/oauth/index.d.ts.map +0 -1
  386. package/dist/oauth/index.js.map +0 -1
  387. package/dist/oauth/strategy/index.d.ts.map +0 -1
  388. package/dist/oauth/strategy/index.js.map +0 -1
  389. package/dist/oauth/types.d.ts.map +0 -1
  390. package/dist/oauth/types.js.map +0 -1
  391. package/dist/oauth/utilities/clearCookie.d.ts.map +0 -1
  392. package/dist/oauth/utilities/clearCookie.js.map +0 -1
  393. package/dist/oauth/utilities/createCookieOptions.d.ts.map +0 -1
  394. package/dist/oauth/utilities/createCookieOptions.js.map +0 -1
  395. package/dist/oauth/utilities/createDebugLogger.d.ts.map +0 -1
  396. package/dist/oauth/utilities/createDebugLogger.js.map +0 -1
  397. package/dist/oauth/utilities/extractOrigin.d.ts.map +0 -1
  398. package/dist/oauth/utilities/extractOrigin.js.map +0 -1
  399. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts.map +0 -1
  400. package/dist/oauth/utilities/getAdminCollectionSlug.js.map +0 -1
  401. package/dist/oauth/utilities/getAdminPath.d.ts +0 -8
  402. package/dist/oauth/utilities/getAdminPath.d.ts.map +0 -1
  403. package/dist/oauth/utilities/getAdminPath.js +0 -9
  404. package/dist/oauth/utilities/getAdminPath.js.map +0 -1
  405. package/dist/oauth/utilities/getAuthorizeURL.d.ts.map +0 -1
  406. package/dist/oauth/utilities/getAuthorizeURL.js.map +0 -1
  407. package/dist/oauth/utilities/getCookieExpiration.d.ts.map +0 -1
  408. package/dist/oauth/utilities/getCookieExpiration.js.map +0 -1
  409. package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts.map +0 -1
  410. package/dist/oauth/utilities/getSecondsFromTokenExp.js.map +0 -1
  411. package/dist/oauth/utilities/getTokenExp.d.ts.map +0 -1
  412. package/dist/oauth/utilities/getTokenExp.js.map +0 -1
  413. package/dist/oauth/utilities/getUsernameField.d.ts.map +0 -1
  414. package/dist/oauth/utilities/getUsernameField.js.map +0 -1
  415. package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts.map +0 -1
  416. package/dist/oauth/utilities/hasUserTokenPropsChanged.js.map +0 -1
  417. package/dist/oauth/utilities/mergeHeaders.d.ts.map +0 -1
  418. package/dist/oauth/utilities/mergeHeaders.js.map +0 -1
  419. package/dist/oauth/utilities/refreshTokens.d.ts.map +0 -1
  420. package/dist/oauth/utilities/refreshTokens.js.map +0 -1
  421. package/dist/plugin/adapter.d.ts.map +0 -1
  422. package/dist/plugin/adapter.js.map +0 -1
  423. package/dist/plugin/build-config.d.ts.map +0 -1
  424. package/dist/plugin/build-config.js.map +0 -1
  425. package/dist/types/config.d.ts.map +0 -1
  426. package/dist/types/config.js.map +0 -1
  427. package/dist/types.d.ts.map +0 -1
  428. package/dist/types.js.map +0 -1
  429. package/dist/utils/asset-collection.d.ts.map +0 -1
  430. package/dist/utils/asset-collection.js.map +0 -1
  431. package/dist/utils/build-detection.d.ts.map +0 -1
  432. package/dist/utils/build-detection.js.map +0 -1
  433. package/dist/utils/config.d.ts.map +0 -1
  434. package/dist/utils/config.js.map +0 -1
  435. package/dist/utils/download-template.d.ts.map +0 -1
  436. package/dist/utils/download-template.js.map +0 -1
  437. package/dist/utils/env-management.d.ts.map +0 -1
  438. package/dist/utils/env-management.js.map +0 -1
  439. package/dist/utils/format.d.ts.map +0 -1
  440. package/dist/utils/format.js.map +0 -1
  441. package/dist/utils/formatter.d.ts.map +0 -1
  442. package/dist/utils/formatter.js.map +0 -1
  443. package/dist/utils/git.d.ts.map +0 -1
  444. package/dist/utils/git.js.map +0 -1
  445. package/dist/utils/is-debug.d.ts.map +0 -1
  446. package/dist/utils/is-debug.js.map +0 -1
  447. package/dist/utils/lambda-config.d.ts.map +0 -1
  448. package/dist/utils/lambda-config.js.map +0 -1
  449. package/dist/utils/log.d.ts.map +0 -1
  450. package/dist/utils/log.js.map +0 -1
  451. package/dist/utils/messages.d.ts.map +0 -1
  452. package/dist/utils/messages.js.map +0 -1
  453. package/dist/utils/package-manager.d.ts.map +0 -1
  454. package/dist/utils/package-manager.js.map +0 -1
  455. package/dist/utils/payload-config-ast.d.ts.map +0 -1
  456. package/dist/utils/payload-config-ast.js.map +0 -1
  457. package/dist/utils/payload-config-finder.d.ts.map +0 -1
  458. package/dist/utils/payload-config-finder.js.map +0 -1
  459. package/dist/utils/payload-config-modifier.d.ts.map +0 -1
  460. package/dist/utils/payload-config-modifier.js.map +0 -1
  461. package/dist/utils/payload-package-check.d.ts.map +0 -1
  462. package/dist/utils/payload-package-check.js.map +0 -1
  463. package/dist/utils/project.d.ts.map +0 -1
  464. package/dist/utils/project.js.map +0 -1
  465. package/dist/utils/s3-upload.d.ts.map +0 -1
  466. package/dist/utils/s3-upload.js.map +0 -1
  467. package/dist/utils/token-display.d.ts.map +0 -1
  468. package/dist/utils/token-display.js.map +0 -1
  469. package/dist/utils/typescript-validator.d.ts.map +0 -1
  470. package/dist/utils/typescript-validator.js.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,13 +1,23 @@
1
1
  import type arg from 'arg';
2
2
  export interface Args extends arg.Spec {
3
3
  '--debug': BooleanConstructor;
4
+ '--dry-run': BooleanConstructor;
5
+ '--env': StringConstructor;
6
+ '--environment': string;
4
7
  '--force': BooleanConstructor;
5
8
  '--help': BooleanConstructor;
9
+ '--id': StringConstructor;
10
+ '--infra-env': StringConstructor;
6
11
  '--list': BooleanConstructor;
7
12
  '--logout': BooleanConstructor;
13
+ '--name': StringConstructor;
14
+ '--template': StringConstructor;
8
15
  '--yes': BooleanConstructor;
16
+ '-e': string;
9
17
  '-f': string;
10
18
  '-h': string;
19
+ '-n': string;
20
+ '-t': string;
11
21
  '-y': string;
12
22
  }
13
23
  export type CliArgs = arg.Result<Args>;
@@ -37,7 +47,6 @@ interface Template {
37
47
  name: string;
38
48
  type: ProjectTemplate['type'];
39
49
  }
40
- export type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
41
50
  export type DbType = 'd1-sqlite' | 'mongodb' | 'postgres' | 'sqlite' | 'vercel-postgres';
42
51
  export type DbDetails = {
43
52
  dbUri?: string;
@@ -57,4 +66,3 @@ export type NextAppDetails = {
57
66
  export type NextConfigType = 'cjs' | 'esm' | 'ts';
58
67
  export type StorageAdapterType = 'localDisk' | 'r2Storage' | 'vercelBlobStorage';
59
68
  export {};
60
- //# sourceMappingURL=types.d.ts.map
package/dist/types.js CHANGED
@@ -1,3 +1 @@
1
1
  export { };
2
-
3
- //# sourceMappingURL=types.js.map
@@ -0,0 +1,8 @@
1
+ import type { AssetCollection, DeployAdapter, LambdaBundle, PageCollection } from '../deploy-adapter.js';
2
+ export declare class NextjsAdapter implements DeployAdapter {
3
+ name: "nextjs";
4
+ collectAssets(projectPath: string): Promise<AssetCollection>;
5
+ collectPages(projectPath: string): Promise<PageCollection>;
6
+ prepareLambdaBundle(projectPath: string): Promise<LambdaBundle>;
7
+ }
8
+ export declare const nextjsAdapter: NextjsAdapter;
@@ -0,0 +1,61 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ import { collectSSGAssets, collectStaticAssets } from '../asset-collection.js';
4
+ import { buildLambdaZip } from '../build-lambda-zip.js';
5
+ import { collectFilesRecursive } from '../fs-utils.js';
6
+ export class NextjsAdapter {
7
+ name = 'nextjs';
8
+ async collectAssets(projectPath) {
9
+ // Bundle assets: .next/static/ → _next/static/
10
+ const staticAssets = await collectStaticAssets(projectPath);
11
+ // Public assets: public/ directory
12
+ const publicDir = path.join(projectPath, 'public');
13
+ let publicAssets = [];
14
+ try {
15
+ await fs.stat(publicDir);
16
+ publicAssets = await collectFilesRecursive(publicDir, publicDir);
17
+ } catch {
18
+ // No public directory
19
+ }
20
+ const allKeys = [
21
+ ...staticAssets,
22
+ ...publicAssets
23
+ ];
24
+ const pathMap = {};
25
+ for (const key of staticAssets){
26
+ pathMap[key] = key.replace(/^_next\//, '.next/');
27
+ }
28
+ for (const key of publicAssets){
29
+ pathMap[key] = path.join('public', key);
30
+ }
31
+ return {
32
+ pathMap,
33
+ routes: allKeys.map((k)=>`/${k}`),
34
+ uploadKeys: allKeys
35
+ };
36
+ }
37
+ async collectPages(projectPath) {
38
+ const ssg = await collectSSGAssets(projectPath);
39
+ // Build route → asset keys mapping and extract unique routes
40
+ const routeAssetMap = {};
41
+ for (const key of ssg.keys){
42
+ // Strip extension to get the base, then derive the route
43
+ const base = key.replace(/\.(?:html|rsc|meta)$/, '');
44
+ const route = base === 'index' ? '/' : `/${base}`;
45
+ if (!routeAssetMap[route]) {
46
+ routeAssetMap[route] = [];
47
+ }
48
+ routeAssetMap[route].push(key);
49
+ }
50
+ return {
51
+ pathMap: ssg.pathMap,
52
+ routeAssetMap,
53
+ routes: Object.keys(routeAssetMap),
54
+ uploadKeys: ssg.keys
55
+ };
56
+ }
57
+ async prepareLambdaBundle(projectPath) {
58
+ return buildLambdaZip(projectPath);
59
+ }
60
+ }
61
+ export const nextjsAdapter = new NextjsAdapter();
@@ -0,0 +1,8 @@
1
+ import type { AssetCollection, DeployAdapter, LambdaBundle, PageCollection } from '../deploy-adapter.js';
2
+ export declare class NitroAdapter implements DeployAdapter {
3
+ name: "nitro";
4
+ collectAssets(projectPath: string): Promise<AssetCollection>;
5
+ collectPages(projectPath: string): Promise<PageCollection>;
6
+ prepareLambdaBundle(projectPath: string): Promise<LambdaBundle>;
7
+ }
8
+ export declare const nitroAdapter: NitroAdapter;
@@ -0,0 +1,172 @@
1
+ import archiver from 'archiver';
2
+ import { createWriteStream, statSync } from 'fs';
3
+ import fs from 'fs/promises';
4
+ import path from 'path';
5
+ import { collectFilesRecursive, getDirectorySize } from '../fs-utils.js';
6
+ const RUN_SCRIPT = `#!/bin/bash -x
7
+ [ ! -d '/tmp/cache' ] && mkdir -p /tmp/cache
8
+ NODE_ENV=production exec node server/index.mjs
9
+ `;
10
+ /** Directories in .output/public/ that are NOT pre-rendered pages */ const NON_PAGE_DIRS = new Set([
11
+ '_next',
12
+ 'assets'
13
+ ]);
14
+ export class NitroAdapter {
15
+ name = 'nitro';
16
+ async collectAssets(projectPath) {
17
+ const publicDir = path.join(projectPath, '.output', 'public');
18
+ const assets = [];
19
+ const pathMap = {};
20
+ // Collect flat files in .output/public/ (public dir assets)
21
+ try {
22
+ const entries = await fs.readdir(publicDir, {
23
+ withFileTypes: true
24
+ });
25
+ for (const entry of entries){
26
+ if (entry.isFile()) {
27
+ assets.push(entry.name);
28
+ pathMap[entry.name] = path.join('.output', 'public', entry.name);
29
+ }
30
+ }
31
+ } catch {
32
+ // No public directory
33
+ }
34
+ // Collect bundle assets from .output/public/_next/static/
35
+ const bundleDir = path.join(publicDir, '_next', 'static');
36
+ try {
37
+ const bundleFiles = await collectFilesRecursive(bundleDir, bundleDir);
38
+ for (const file of bundleFiles){
39
+ const key = `_next/static/${file}`;
40
+ assets.push(key);
41
+ pathMap[key] = path.join('.output', 'public', '_next', 'static', file);
42
+ }
43
+ } catch {
44
+ // No bundle directory
45
+ }
46
+ return {
47
+ pathMap,
48
+ routes: assets.map((k)=>`/${k}`),
49
+ uploadKeys: assets
50
+ };
51
+ }
52
+ async collectPages(projectPath) {
53
+ const publicDir = path.join(projectPath, '.output', 'public');
54
+ const pages = await scanForPages(publicDir, publicDir);
55
+ const routes = pages.map((p)=>p === 'index' ? '/' : `/${p}`);
56
+ const uploadKeys = pages.map((p)=>p === 'index' ? 'index.html' : `${p}/index.html`);
57
+ const pathMap = {};
58
+ const routeAssetMap = {};
59
+ for(let i = 0; i < uploadKeys.length; i++){
60
+ pathMap[uploadKeys[i]] = path.join('.output', 'public', uploadKeys[i]);
61
+ routeAssetMap[routes[i]] = [
62
+ uploadKeys[i]
63
+ ];
64
+ }
65
+ return {
66
+ pathMap,
67
+ routeAssetMap,
68
+ routes,
69
+ uploadKeys
70
+ };
71
+ }
72
+ async prepareLambdaBundle(projectPath) {
73
+ const zipPath = path.join(projectPath, 'lambda.zip');
74
+ const serverDir = path.join(projectPath, '.output', 'server');
75
+ const publicDir = path.join(projectPath, '.output', 'public');
76
+ // Verify server directory exists
77
+ try {
78
+ await fs.stat(serverDir);
79
+ } catch {
80
+ throw new Error('Nitro server build not found at .output/server. Run build first.');
81
+ }
82
+ // Write run.sh to a temp location
83
+ const runShPath = path.join(projectPath, '.output', 'run.sh');
84
+ await fs.writeFile(runShPath, RUN_SCRIPT, {
85
+ mode: 0o755
86
+ });
87
+ // Create zip: server/ + public/ + run.sh
88
+ await createZip(zipPath, [
89
+ {
90
+ prefix: 'server/',
91
+ source: serverDir
92
+ },
93
+ {
94
+ prefix: 'public/',
95
+ source: publicDir
96
+ },
97
+ {
98
+ prefix: '',
99
+ source: runShPath
100
+ }
101
+ ]);
102
+ const runShStat = await fs.stat(runShPath);
103
+ const unzippedBytes = await getDirectorySize(serverDir) + await getDirectorySize(publicDir) + runShStat.size;
104
+ // Clean up temp run.sh
105
+ await fs.rm(runShPath, {
106
+ force: true
107
+ });
108
+ return {
109
+ unzippedBytes,
110
+ zipPath
111
+ };
112
+ }
113
+ }
114
+ export const nitroAdapter = new NitroAdapter();
115
+ /**
116
+ * Recursively scan for pre-rendered pages (directories containing index.html).
117
+ * Skips known non-page directories (_next/, assets/).
118
+ */ async function scanForPages(dir, baseDir) {
119
+ const pages = [];
120
+ // Check if this directory has an index.html (it's a page)
121
+ const indexPath = path.join(dir, 'index.html');
122
+ try {
123
+ await fs.stat(indexPath);
124
+ const relative = path.relative(baseDir, dir);
125
+ pages.push(relative || 'index'); // root dir -> 'index'
126
+ } catch {
127
+ // Not a page directory
128
+ }
129
+ // Recurse into subdirectories
130
+ try {
131
+ const entries = await fs.readdir(dir, {
132
+ withFileTypes: true
133
+ });
134
+ for (const entry of entries){
135
+ if (entry.isDirectory() && !NON_PAGE_DIRS.has(entry.name)) {
136
+ const subPages = await scanForPages(path.join(dir, entry.name), baseDir);
137
+ pages.push(...subPages);
138
+ }
139
+ }
140
+ } catch {
141
+ // Directory not readable
142
+ }
143
+ return pages;
144
+ }
145
+ async function createZip(zipPath, entries) {
146
+ return new Promise((resolve, reject)=>{
147
+ const output = createWriteStream(zipPath);
148
+ const archive = archiver('zip', {
149
+ zlib: {
150
+ level: 9
151
+ }
152
+ });
153
+ output.on('close', ()=>resolve());
154
+ archive.on('error', (err)=>reject(err));
155
+ archive.pipe(output);
156
+ for (const entry of entries){
157
+ try {
158
+ const stat = statSync(entry.source);
159
+ if (stat.isDirectory()) {
160
+ archive.directory(entry.source, entry.prefix.replace(/\/$/, '') || false);
161
+ } else {
162
+ archive.file(entry.source, {
163
+ name: entry.prefix + path.basename(entry.source)
164
+ });
165
+ }
166
+ } catch {
167
+ // Skip missing entries
168
+ }
169
+ }
170
+ void archive.finalize();
171
+ });
172
+ }
@@ -0,0 +1,9 @@
1
+ import type { AssetCollection, DeployAdapter, LambdaBundle, PageCollection } from '../deploy-adapter.js';
2
+ export declare class ViteAdapter implements DeployAdapter {
3
+ fallback: string;
4
+ name: "vite";
5
+ collectAssets(projectPath: string): Promise<AssetCollection>;
6
+ collectPages(): Promise<PageCollection>;
7
+ prepareLambdaBundle(): Promise<LambdaBundle | null>;
8
+ }
9
+ export declare const viteAdapter: ViteAdapter;
@@ -0,0 +1,31 @@
1
+ import path from 'path';
2
+ import { collectFilesRecursive } from '../fs-utils.js';
3
+ export class ViteAdapter {
4
+ fallback = '/index.html';
5
+ name = 'vite';
6
+ async collectAssets(projectPath) {
7
+ const distDir = path.join(projectPath, 'dist');
8
+ const files = await collectFilesRecursive(distDir, distDir);
9
+ const pathMap = {};
10
+ for (const file of files){
11
+ pathMap[file] = path.join('dist', file);
12
+ }
13
+ return {
14
+ pathMap,
15
+ routes: files.map((k)=>`/${k}`),
16
+ uploadKeys: files
17
+ };
18
+ }
19
+ collectPages() {
20
+ return Promise.resolve({
21
+ pathMap: {},
22
+ routeAssetMap: {},
23
+ routes: [],
24
+ uploadKeys: []
25
+ });
26
+ }
27
+ prepareLambdaBundle() {
28
+ return Promise.resolve(null);
29
+ }
30
+ }
31
+ export const viteAdapter = new ViteAdapter();
@@ -16,15 +16,35 @@ export declare function getFileSize(filePath: string): Promise<number>;
16
16
  */
17
17
  export declare function collectStaticAssets(projectPath: string): Promise<string[]>;
18
18
  /**
19
- * Create Lambda deployment zip using build_for_lambda.sh
19
+ * Result from collecting SSG assets
20
+ */
21
+ export type SSGAssets = {
22
+ /** S3 keys for all SSG files (route-path based, no leading slash) */
23
+ keys: string[];
24
+ /** Map of S3 key → relative filesystem path from project root */
25
+ pathMap: Record<string, string>;
26
+ };
27
+ /**
28
+ * Collect SSG asset paths by parsing .next/prerender-manifest.json
29
+ *
30
+ * For each route in the manifest's `routes` object, collects three files:
31
+ * - {route}.html (full HTML)
32
+ * - {route}.rsc (React Server Components payload)
33
+ * - {route}.meta (response headers JSON)
34
+ *
35
+ * S3 keys use the route path without leading slash.
36
+ * Filesystem paths point to .next/server/app/{route}.{ext}
37
+ *
38
+ * @param projectPath - Path to project root
39
+ * @returns SSG asset keys and a pathMap for filesystem resolution
40
+ */
41
+ export declare function collectSSGAssets(projectPath: string): Promise<SSGAssets>;
42
+ /**
43
+ * Create Lambda deployment zip
20
44
  *
21
- * This script:
22
- * - Copies static files to standalone build
23
- * - Creates lambda.zip from .next/standalone/
24
- * - Places zip at project root
45
+ * Uses cross-platform Node.js implementation instead of shell script.
25
46
  *
26
47
  * @param projectPath - Path to project root
27
- * @throws Error if script missing or execution fails
48
+ * @throws Error if build missing or zip creation fails
28
49
  */
29
50
  export declare function createLambdaZip(projectPath: string): Promise<void>;
30
- //# sourceMappingURL=asset-collection.d.ts.map
@@ -1,9 +1,7 @@
1
- import { exec } from 'child_process';
2
1
  import fs from 'fs/promises';
3
2
  import path from 'path';
4
- import { promisify } from 'util';
3
+ import { buildLambdaZip } from './build-lambda-zip.js';
5
4
  import * as log from './log.js';
6
- const execAsync = promisify(exec);
7
5
  // Maximum file size for static assets (S3 limitation)
8
6
  const MAX_ASSET_SIZE = 50 * 1024 * 1024 // 50MB
9
7
  ;
@@ -75,43 +73,72 @@ const MAX_ASSET_SIZE = 50 * 1024 * 1024 // 50MB
75
73
  return [];
76
74
  }
77
75
  const files = await collectFiles(staticDir, projectPath);
78
- // Convert .next/static to _next/static (Next.js convention)
79
- return files.map((file)=>file.replace(/^\.next\//, '_next/'));
76
+ // Normalize paths to forward slashes (cross-platform) and convert prefix
77
+ return files.map((file)=>{
78
+ const normalized = file.split(path.sep).join('/');
79
+ return normalized.replace(/^\.next\//, '_next/');
80
+ });
80
81
  }
81
82
  /**
82
- * Create Lambda deployment zip using build_for_lambda.sh
83
+ * Collect SSG asset paths by parsing .next/prerender-manifest.json
83
84
  *
84
- * This script:
85
- * - Copies static files to standalone build
86
- * - Creates lambda.zip from .next/standalone/
87
- * - Places zip at project root
85
+ * For each route in the manifest's `routes` object, collects three files:
86
+ * - {route}.html (full HTML)
87
+ * - {route}.rsc (React Server Components payload)
88
+ * - {route}.meta (response headers JSON)
89
+ *
90
+ * S3 keys use the route path without leading slash.
91
+ * Filesystem paths point to .next/server/app/{route}.{ext}
88
92
  *
89
93
  * @param projectPath - Path to project root
90
- * @throws Error if script missing or execution fails
91
- */ export async function createLambdaZip(projectPath) {
92
- const scriptPath = path.join(projectPath, 'build_for_lambda.sh');
93
- // Check if script exists
94
+ * @returns SSG asset keys and a pathMap for filesystem resolution
95
+ */ export async function collectSSGAssets(projectPath) {
96
+ const manifestPath = path.join(projectPath, '.next', 'prerender-manifest.json');
97
+ let manifest;
94
98
  try {
95
- await fs.stat(scriptPath);
99
+ const raw = await fs.readFile(manifestPath, 'utf-8');
100
+ manifest = JSON.parse(raw);
96
101
  } catch {
97
- throw new Error('build_for_lambda.sh not found. Run init command to set up project.');
102
+ return {
103
+ keys: [],
104
+ pathMap: {}
105
+ };
98
106
  }
99
- // Execute script
100
- try {
101
- await execAsync('./build_for_lambda.sh', {
102
- cwd: projectPath
103
- });
104
- } catch (error) {
105
- const message = error instanceof Error ? error.message : 'Unknown error';
106
- throw new Error(`Failed to create Lambda zip: ${message}`);
107
+ if (!manifest.routes || typeof manifest.routes !== 'object') {
108
+ return {
109
+ keys: [],
110
+ pathMap: {}
111
+ };
107
112
  }
108
- // Verify zip was created
109
- const zipPath = path.join(projectPath, 'lambda.zip');
110
- try {
111
- await fs.stat(zipPath);
112
- } catch {
113
- throw new Error('lambda.zip was not created by build_for_lambda.sh');
113
+ const keys = [];
114
+ const pathMap = {};
115
+ const extensions = [
116
+ '.html',
117
+ '.rsc',
118
+ '.meta'
119
+ ];
120
+ for (const routeKey of Object.keys(manifest.routes)){
121
+ // Strip leading slash for S3 key; handle root "/" → "index"
122
+ const stripped = routeKey === '/' ? 'index' : routeKey.replace(/^\//, '');
123
+ for (const ext of extensions){
124
+ const s3Key = `${stripped}${ext}`;
125
+ const fsPath = path.join('.next', 'server', 'app', `${stripped}${ext}`);
126
+ keys.push(s3Key);
127
+ pathMap[s3Key] = fsPath;
128
+ }
114
129
  }
130
+ return {
131
+ keys,
132
+ pathMap
133
+ };
134
+ }
135
+ /**
136
+ * Create Lambda deployment zip
137
+ *
138
+ * Uses cross-platform Node.js implementation instead of shell script.
139
+ *
140
+ * @param projectPath - Path to project root
141
+ * @throws Error if build missing or zip creation fails
142
+ */ export async function createLambdaZip(projectPath) {
143
+ await buildLambdaZip(projectPath);
115
144
  }
116
-
117
- //# sourceMappingURL=asset-collection.js.map
@@ -2,24 +2,18 @@
2
2
  * Information about a detected build
3
3
  */
4
4
  export interface BuildInfo {
5
- /** Build ID from .next/BUILD_ID */
5
+ /** Build identifier */
6
6
  buildId: string;
7
7
  /** Whether lambda.zip already exists */
8
8
  hasLambdaZip: boolean;
9
- /** Path to .next/standalone */
9
+ /** Path to build output directory */
10
10
  path: string;
11
- /** Build timestamp from server.js mtime */
11
+ /** Build timestamp */
12
12
  timestamp: Date;
13
13
  }
14
14
  /**
15
- * Detect if a valid Lambda-ready build exists
16
- *
17
- * Checks for:
18
- * - .next/standalone/server.js (required for Lambda)
19
- * - .next/BUILD_ID (Next.js build identifier)
20
- *
21
- * @param projectPath - Path to project root
22
- * @returns Build info if valid build found, null otherwise
15
+ * Detect a valid build across supported frameworks.
16
+ * Tries NextJS, then Nitro, then Vite. Returns the first match.
23
17
  */
24
18
  export declare function detectBuild(projectPath: string): Promise<BuildInfo | null>;
25
19
  /**
@@ -29,4 +23,3 @@ export declare function detectBuild(projectPath: string): Promise<BuildInfo | nu
29
23
  * @returns Build command string if found, null otherwise
30
24
  */
31
25
  export declare function getBuildCommand(projectPath: string): Promise<null | string>;
32
- //# sourceMappingURL=build-detection.d.ts.map
@@ -1,23 +1,34 @@
1
1
  import fs from 'fs/promises';
2
2
  import path from 'path';
3
3
  /**
4
- * Detect if a valid Lambda-ready build exists
5
- *
6
- * Checks for:
7
- * - .next/standalone/server.js (required for Lambda)
8
- * - .next/BUILD_ID (Next.js build identifier)
9
- *
10
- * @param projectPath - Path to project root
11
- * @returns Build info if valid build found, null otherwise
4
+ * Detect a valid build across supported frameworks.
5
+ * Tries NextJS, then Nitro, then Vite. Returns the first match.
12
6
  */ export async function detectBuild(projectPath) {
7
+ // Try NextJS first
8
+ const nextjsBuild = await detectNextjsBuild(projectPath);
9
+ if (nextjsBuild) {
10
+ return nextjsBuild;
11
+ }
12
+ // Try Nitro
13
+ const nitroBuild = await detectNitroBuild(projectPath);
14
+ if (nitroBuild) {
15
+ return nitroBuild;
16
+ }
17
+ // Try Vite
18
+ const viteBuild = await detectViteBuild(projectPath);
19
+ if (viteBuild) {
20
+ return viteBuild;
21
+ }
22
+ return null;
23
+ }
24
+ /**
25
+ * Detect NextJS standalone build (.next/standalone/server.js + .next/BUILD_ID)
26
+ */ async function detectNextjsBuild(projectPath) {
13
27
  try {
14
- // Check for .next/standalone/server.js
15
28
  const serverPath = path.join(projectPath, '.next', 'standalone', 'server.js');
16
29
  const serverStat = await fs.stat(serverPath);
17
- // Check for .next/BUILD_ID
18
30
  const buildIdPath = path.join(projectPath, '.next', 'BUILD_ID');
19
31
  const buildId = (await fs.readFile(buildIdPath, 'utf-8')).trim();
20
- // Check for lambda.zip
21
32
  const lambdaZipPath = path.join(projectPath, 'lambda.zip');
22
33
  let hasLambdaZip = false;
23
34
  try {
@@ -36,6 +47,58 @@ import path from 'path';
36
47
  return null;
37
48
  }
38
49
  }
50
+ /**
51
+ * Detect Nitro build (.output/server/index.mjs)
52
+ * Build ID parsed from .output/nitro.json date field, or mtime of index.mjs
53
+ */ async function detectNitroBuild(projectPath) {
54
+ try {
55
+ const indexPath = path.join(projectPath, '.output', 'server', 'index.mjs');
56
+ const indexStat = await fs.stat(indexPath);
57
+ let buildId = indexStat.mtime.toISOString();
58
+ try {
59
+ const nitroJsonPath = path.join(projectPath, '.output', 'nitro.json');
60
+ const nitroJson = JSON.parse(await fs.readFile(nitroJsonPath, 'utf-8'));
61
+ if (nitroJson.date) {
62
+ buildId = nitroJson.date;
63
+ }
64
+ } catch {
65
+ // nitro.json missing or unparseable — fall back to mtime
66
+ }
67
+ const lambdaZipPath = path.join(projectPath, 'lambda.zip');
68
+ let hasLambdaZip = false;
69
+ try {
70
+ await fs.stat(lambdaZipPath);
71
+ hasLambdaZip = true;
72
+ } catch {
73
+ hasLambdaZip = false;
74
+ }
75
+ return {
76
+ buildId,
77
+ hasLambdaZip,
78
+ path: '.output',
79
+ timestamp: indexStat.mtime
80
+ };
81
+ } catch {
82
+ return null;
83
+ }
84
+ }
85
+ /**
86
+ * Detect Vite build (dist/index.html)
87
+ * Build ID is mtime of index.html as ISO string. No server, so hasLambdaZip is always false.
88
+ */ async function detectViteBuild(projectPath) {
89
+ try {
90
+ const indexPath = path.join(projectPath, 'dist', 'index.html');
91
+ const indexStat = await fs.stat(indexPath);
92
+ return {
93
+ buildId: indexStat.mtime.toISOString(),
94
+ hasLambdaZip: false,
95
+ path: 'dist',
96
+ timestamp: indexStat.mtime
97
+ };
98
+ } catch {
99
+ return null;
100
+ }
101
+ }
39
102
  /**
40
103
  * Get the build command from package.json
41
104
  *
@@ -51,5 +114,3 @@ import path from 'path';
51
114
  return null;
52
115
  }
53
116
  }
54
-
55
- //# sourceMappingURL=build-detection.js.map
@@ -0,0 +1,25 @@
1
+ import type { LambdaBundle } from './deploy-adapter.js';
2
+ /**
3
+ * AWS Lambda's hard limit on unzipped deployment code size (250 MB). The unzipped
4
+ * total must be strictly less than this value, so a bundle exactly equal to it is
5
+ * rejected. The server enforces this too and now returns a clear message, so a
6
+ * client-side check against this value is an early-exit convenience, not the
7
+ * source of truth.
8
+ */
9
+ export declare const LAMBDA_MAX_UNZIPPED_BYTES: number;
10
+ /**
11
+ * Build Lambda deployment zip using pure Node.js
12
+ *
13
+ * Cross-platform replacement for build_for_lambda.sh:
14
+ * 1. Copies .next/static to .next/standalone/.next/static
15
+ * 2. Copies run.sh to .next/standalone/run.sh
16
+ * 3. Creates lambda.zip from .next/standalone/
17
+ *
18
+ * Note: public/ is NOT included in the zip — those files are uploaded
19
+ * as static assets and served via CDN, not from the Lambda function.
20
+ *
21
+ * @param projectPath - Path to project root
22
+ * @returns The built bundle: its unzipped byte size and the absolute zip path.
23
+ * @throws Error if standalone directory missing or zip creation fails
24
+ */
25
+ export declare function buildLambdaZip(projectPath: string): Promise<LambdaBundle>;