@payloadcms/figma 0.0.1-alpha.9 → 0.1.0-alpha.1
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.
- package/dist/api/control-plane.d.ts +56 -7
- package/dist/api/control-plane.js +188 -74
- package/dist/api/error-response.d.ts +36 -0
- package/dist/api/error-response.js +66 -0
- package/dist/api/figma-api.d.ts +24 -3
- package/dist/api/figma-api.js +110 -34
- package/dist/auth/browser.d.ts +0 -1
- package/dist/auth/browser.js +0 -2
- package/dist/auth/callback-server.d.ts +19 -8
- package/dist/auth/callback-server.js +72 -32
- package/dist/auth/credentials.d.ts +20 -0
- package/dist/auth/credentials.js +19 -0
- package/dist/auth/crypto-utils.d.ts +28 -1
- package/dist/auth/crypto-utils.js +132 -23
- package/dist/auth/jwt-validator.d.ts +23 -6
- package/dist/auth/jwt-validator.js +35 -9
- package/dist/auth/oauth-flow.d.ts +19 -4
- package/dist/auth/oauth-flow.js +151 -34
- package/dist/auth/paste-code.d.ts +33 -0
- package/dist/auth/paste-code.js +87 -0
- package/dist/auth/pkce.d.ts +0 -1
- package/dist/auth/pkce.js +0 -2
- package/dist/auth/project-token.d.ts +32 -17
- package/dist/auth/project-token.js +176 -68
- package/dist/auth/refresh.d.ts +2 -2
- package/dist/auth/refresh.js +25 -14
- package/dist/auth/token-store-migration.d.ts +57 -0
- package/dist/auth/token-store-migration.js +154 -0
- package/dist/auth/token-store.d.ts +63 -98
- package/dist/auth/token-store.js +405 -124
- package/dist/auth/types.d.ts +40 -6
- package/dist/auth/types.js +1 -3
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +102 -8
- package/dist/commands/bootstrap.d.ts +17 -0
- package/dist/commands/bootstrap.js +88 -0
- package/dist/commands/build-lambda-zip.d.ts +4 -0
- package/dist/commands/build-lambda-zip.js +17 -0
- package/dist/commands/debug.d.ts +7 -0
- package/dist/commands/debug.js +178 -0
- package/dist/commands/deploy.d.ts +11 -1
- package/dist/commands/deploy.js +193 -153
- package/dist/commands/dump-tokens.d.ts +11 -0
- package/dist/commands/dump-tokens.js +67 -0
- package/dist/commands/env.d.ts +12 -0
- package/dist/commands/env.js +86 -0
- package/dist/commands/init.d.ts +9 -6
- package/dist/commands/init.js +232 -152
- package/dist/commands/list-tokens.d.ts +3 -4
- package/dist/commands/list-tokens.js +24 -11
- package/dist/commands/login.d.ts +8 -2
- package/dist/commands/login.js +34 -18
- package/dist/commands/logout.d.ts +5 -5
- package/dist/commands/logout.js +77 -17
- package/dist/commands/upgrade.d.ts +4 -0
- package/dist/commands/upgrade.js +329 -0
- package/dist/commands/upload-schema.d.ts +8 -0
- package/dist/commands/upload-schema.js +91 -0
- package/dist/config/oauth.d.ts +17 -12
- package/dist/config/oauth.js +38 -39
- package/dist/constants.d.ts +63 -19
- package/dist/constants.js +158 -20
- package/dist/db-content-api/generated/content-api-types.d.ts +8215 -0
- package/dist/db-content-api/generated/content-api-types.js +5 -0
- package/dist/db-content-api/index.d.ts +40 -0
- package/dist/db-content-api/index.js +883 -0
- package/dist/db-content-api/temp-utilities/slug.d.ts +1 -0
- package/dist/db-content-api/temp-utilities/slug.js +1 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts +2 -0
- package/dist/db-content-api/temp-utilities/sorting.js +37 -0
- package/dist/db-content-api/temp-utilities/types.d.ts +21 -0
- package/dist/db-content-api/temp-utilities/types.js +13 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +38 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.js +62 -0
- package/dist/db-content-api/utilities/auth.d.ts +29 -0
- package/dist/db-content-api/utilities/auth.js +82 -0
- package/dist/db-content-api/utilities/clientVersionHeaders.d.ts +7 -0
- package/dist/db-content-api/utilities/clientVersionHeaders.js +15 -0
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts +6 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js +75 -0
- package/dist/db-content-api/utilities/data/atomicOperations.d.ts +16 -0
- package/dist/db-content-api/utilities/data/atomicOperations.js +48 -0
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts +10 -0
- package/dist/db-content-api/utilities/data/castFieldValue.js +66 -0
- package/dist/db-content-api/utilities/data/convertRelationshipIds.d.ts +25 -0
- package/dist/db-content-api/utilities/data/convertRelationshipIds.js +109 -0
- package/dist/db-content-api/utilities/data/index.d.ts +48 -0
- package/dist/db-content-api/utilities/data/index.js +315 -0
- package/dist/db-content-api/utilities/data/isLocaleMap.d.ts +10 -0
- package/dist/db-content-api/utilities/data/isLocaleMap.js +13 -0
- package/dist/db-content-api/utilities/data/pointShape.d.ts +3 -0
- package/dist/db-content-api/utilities/data/pointShape.js +43 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +11 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +52 -0
- package/dist/db-content-api/utilities/data/resolveFieldLocalization.d.ts +18 -0
- package/dist/db-content-api/utilities/data/resolveFieldLocalization.js +21 -0
- package/dist/db-content-api/utilities/data/richTextShape.d.ts +3 -0
- package/dist/db-content-api/utilities/data/richTextShape.js +56 -0
- package/dist/db-content-api/utilities/data/stripFields.d.ts +47 -0
- package/dist/db-content-api/utilities/data/stripFields.js +170 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +22 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.js +40 -0
- package/dist/db-content-api/utilities/data/validateRelationships.d.ts +6 -0
- package/dist/db-content-api/utilities/data/validateRelationships.js +107 -0
- package/dist/db-content-api/utilities/joins.d.ts +50 -0
- package/dist/db-content-api/utilities/joins.js +124 -0
- package/dist/db-content-api/utilities/locale/index.d.ts +9 -0
- package/dist/db-content-api/utilities/locale/index.js +19 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.d.ts +9 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.js +100 -0
- package/dist/db-content-api/utilities/resolveBlocks.d.ts +19 -0
- package/dist/db-content-api/utilities/resolveBlocks.js +31 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +72 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +264 -0
- package/dist/db-content-api/utilities/where.d.ts +9 -0
- package/dist/db-content-api/utilities/where.js +95 -0
- package/dist/deploy/schedule-extract-plugin.d.ts +10 -0
- package/dist/deploy/schedule-extract-plugin.js +32 -0
- package/dist/endpoints/health.d.ts +2 -0
- package/dist/endpoints/health.js +9 -0
- package/dist/endpoints/schema.d.ts +2 -0
- package/dist/endpoints/schema.js +27 -0
- package/dist/exports/client.d.ts +2 -1
- package/dist/exports/client.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/lib/download-skill.d.ts +12 -0
- package/dist/lib/download-skill.js +77 -0
- package/dist/oauth/components/FigmaAvatar/index.d.ts +3 -0
- package/dist/oauth/components/FigmaAvatar/index.js +25 -0
- package/dist/oauth/components/FigmaAvatar/index.scss +12 -0
- package/dist/oauth/components/FigmaAvatarCell/index.d.ts +4 -0
- package/dist/oauth/components/FigmaAvatarCell/index.js +23 -0
- package/dist/oauth/components/FigmaAvatarCell/index.scss +5 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +8 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +35 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.scss +28 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.d.ts +81 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.js +168 -0
- package/dist/oauth/components/LoginButton/index.d.ts +0 -1
- package/dist/oauth/components/LoginButton/index.js +156 -18
- package/dist/oauth/components/LoginButton/index.scss +75 -3
- package/dist/oauth/components/LogoutButton/index.d.ts +0 -1
- package/dist/oauth/components/LogoutButton/index.js +20 -9
- package/dist/oauth/defaults.d.ts +3 -2
- package/dist/oauth/defaults.js +79 -12
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +87 -84
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -6
- package/dist/oauth/endpoints/getMetaEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.js +18 -5
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js +11 -4
- package/dist/oauth/exports/client.d.ts +0 -1
- package/dist/oauth/exports/client.js +0 -2
- package/dist/oauth/hooks/afterLogout.d.ts +0 -1
- package/dist/oauth/hooks/afterLogout.js +0 -2
- package/dist/oauth/hooks/me.d.ts +0 -1
- package/dist/oauth/hooks/me.js +0 -2
- package/dist/oauth/hooks/refresh.d.ts +0 -1
- package/dist/oauth/hooks/refresh.js +2 -3
- package/dist/oauth/index.d.ts +0 -1
- package/dist/oauth/index.js +27 -7
- package/dist/oauth/strategy/index.d.ts +0 -3
- package/dist/oauth/strategy/index.js +55 -34
- package/dist/oauth/types.d.ts +23 -7
- package/dist/oauth/types.js +0 -2
- package/dist/oauth/utilities/buildUnauthorizedRedirect.d.ts +14 -0
- package/dist/oauth/utilities/buildUnauthorizedRedirect.js +28 -0
- package/dist/oauth/utilities/clearCookie.d.ts +0 -1
- package/dist/oauth/utilities/clearCookie.js +5 -3
- package/dist/oauth/utilities/createCookieOptions.d.ts +0 -1
- package/dist/oauth/utilities/createCookieOptions.js +9 -4
- package/dist/oauth/utilities/createDebugLogger.d.ts +0 -1
- package/dist/oauth/utilities/createDebugLogger.js +0 -2
- package/dist/oauth/utilities/establishSession.d.ts +22 -0
- package/dist/oauth/utilities/establishSession.js +80 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.d.ts +23 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.js +26 -0
- package/dist/oauth/utilities/extractOrigin.d.ts +0 -1
- package/dist/oauth/utilities/extractOrigin.js +0 -2
- package/dist/oauth/utilities/figmaHostnames.d.ts +2 -0
- package/dist/oauth/utilities/figmaHostnames.js +24 -0
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.js +0 -2
- package/dist/oauth/utilities/getAuthorizeURL.d.ts +65 -2
- package/dist/oauth/utilities/getAuthorizeURL.js +57 -4
- package/dist/oauth/utilities/getCookieExpiration.d.ts +0 -1
- package/dist/oauth/utilities/getCookieExpiration.js +0 -2
- package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.js +0 -2
- package/dist/oauth/utilities/getTokenExp.d.ts +0 -1
- package/dist/oauth/utilities/getTokenExp.js +0 -2
- package/dist/oauth/utilities/getUsernameField.d.ts +0 -1
- package/dist/oauth/utilities/getUsernameField.js +0 -2
- package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.js +0 -2
- package/dist/oauth/utilities/isAbsoluteURL.d.ts +1 -0
- package/dist/oauth/utilities/isAbsoluteURL.js +1 -0
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts +6 -0
- package/dist/oauth/utilities/isDuplicateKeyError.js +12 -0
- package/dist/oauth/utilities/mergeHeaders.d.ts +0 -1
- package/dist/oauth/utilities/mergeHeaders.js +0 -2
- package/dist/oauth/utilities/refreshTokens.d.ts +0 -1
- package/dist/oauth/utilities/refreshTokens.js +21 -13
- package/dist/oauth/utilities/withPartitionedCookie.d.ts +19 -0
- package/dist/oauth/utilities/withPartitionedCookie.js +26 -0
- package/dist/oauth/utils/getSearchParam.d.ts +17 -0
- package/dist/oauth/utils/getSearchParam.js +22 -0
- package/dist/plugin/adapter.d.ts +0 -1
- package/dist/plugin/adapter.js +0 -2
- package/dist/plugin/auth-preflight.d.ts +7 -0
- package/dist/plugin/auth-preflight.js +18 -0
- package/dist/plugin/bootstrap-preflight.d.ts +22 -0
- package/dist/plugin/bootstrap-preflight.js +43 -0
- package/dist/plugin/build-config.d.ts +27 -15
- package/dist/plugin/build-config.js +380 -16
- package/dist/plugin/dev-cookie-names.d.ts +13 -0
- package/dist/plugin/dev-cookie-names.js +17 -0
- package/dist/scss.d.js +2 -0
- package/dist/storage-content-api/api-types.d.ts +183 -0
- package/dist/storage-content-api/api-types.js +4 -0
- package/dist/storage-content-api/client-uploads/generate.d.ts +14 -0
- package/dist/storage-content-api/client-uploads/generate.js +69 -0
- package/dist/storage-content-api/client.d.ts +5 -0
- package/dist/storage-content-api/client.js +37 -0
- package/dist/storage-content-api/generateURL.d.ts +6 -0
- package/dist/storage-content-api/generateURL.js +6 -0
- package/dist/storage-content-api/handleDelete.d.ts +7 -0
- package/dist/storage-content-api/handleDelete.js +15 -0
- package/dist/storage-content-api/handleUpload.d.ts +10 -0
- package/dist/storage-content-api/handleUpload.js +162 -0
- package/dist/storage-content-api/index.d.ts +4 -0
- package/dist/storage-content-api/index.js +37 -0
- package/dist/storage-content-api/staticHandler.d.ts +9 -0
- package/dist/storage-content-api/staticHandler.js +61 -0
- package/dist/storage-content-api/types.d.ts +9 -0
- package/dist/storage-content-api/types.js +1 -0
- package/dist/storage-content-api/utilities/getSafeFilename.d.ts +11 -0
- package/dist/storage-content-api/utilities/getSafeFilename.js +59 -0
- package/dist/storage-content-api/utilities/index.d.ts +2 -0
- package/dist/storage-content-api/utilities/index.js +2 -0
- package/dist/storage-content-api/utilities/parseUploadReference.d.ts +17 -0
- package/dist/storage-content-api/utilities/parseUploadReference.js +27 -0
- package/dist/templates/.env.example +5 -0
- package/dist/templates/README.md +19 -0
- package/dist/types/config.d.ts +2 -2
- package/dist/types/config.js +0 -4
- package/dist/types.d.ts +10 -2
- package/dist/types.js +0 -2
- package/dist/utils/adapters/nextjs.d.ts +8 -0
- package/dist/utils/adapters/nextjs.js +61 -0
- package/dist/utils/adapters/nitro.d.ts +8 -0
- package/dist/utils/adapters/nitro.js +172 -0
- package/dist/utils/adapters/vite.d.ts +9 -0
- package/dist/utils/adapters/vite.js +31 -0
- package/dist/utils/asset-collection.d.ts +27 -7
- package/dist/utils/asset-collection.js +59 -32
- package/dist/utils/build-detection.d.ts +5 -12
- package/dist/utils/build-detection.js +74 -13
- package/dist/utils/build-lambda-zip.d.ts +25 -0
- package/dist/utils/build-lambda-zip.js +90 -0
- package/dist/utils/cache-bootstrap.d.ts +7 -0
- package/dist/utils/cache-bootstrap.js +16 -0
- package/dist/utils/config.d.ts +0 -1
- package/dist/utils/config.js +1 -3
- package/dist/utils/deploy-adapter.d.ts +45 -0
- package/dist/utils/deploy-adapter.js +56 -0
- package/dist/utils/download-template.d.ts +9 -2
- package/dist/utils/download-template.js +24 -20
- package/dist/utils/env-management.d.ts +24 -8
- package/dist/utils/env-management.js +119 -66
- package/dist/utils/format-env-suffix.d.ts +11 -0
- package/dist/utils/format-env-suffix.js +11 -0
- package/dist/utils/format.d.ts +0 -1
- package/dist/utils/format.js +0 -2
- package/dist/utils/formatter.d.ts +0 -1
- package/dist/utils/formatter.js +23 -13
- package/dist/utils/fs-utils.d.ts +12 -0
- package/dist/utils/fs-utils.js +55 -0
- package/dist/utils/git.d.ts +0 -1
- package/dist/utils/git.js +0 -2
- package/dist/utils/handle-upgrade.d.ts +8 -0
- package/dist/utils/handle-upgrade.js +39 -0
- package/dist/utils/is-debug.d.ts +0 -1
- package/dist/utils/is-debug.js +0 -2
- package/dist/utils/lambda-config.d.ts +3 -2
- package/dist/utils/lambda-config.js +75 -80
- package/dist/utils/load-payload-config.d.ts +9 -0
- package/dist/utils/load-payload-config.js +27 -0
- package/dist/utils/log.d.ts +0 -1
- package/dist/utils/log.js +0 -2
- package/dist/utils/messages.d.ts +1 -3
- package/dist/utils/messages.js +47 -13
- package/dist/utils/package-manager.d.ts +24 -1
- package/dist/utils/package-manager.js +53 -2
- package/dist/utils/parse-template-spec.d.ts +11 -0
- package/dist/utils/parse-template-spec.js +60 -0
- package/dist/utils/payload-config-ast.d.ts +27 -7
- package/dist/utils/payload-config-ast.js +106 -60
- package/dist/utils/payload-config-finder.d.ts +2 -3
- package/dist/utils/payload-config-finder.js +48 -11
- package/dist/utils/payload-config-modifier.d.ts +1 -2
- package/dist/utils/payload-config-modifier.js +114 -68
- package/dist/utils/payload-package-check.d.ts +28 -3
- package/dist/utils/payload-package-check.js +90 -31
- package/dist/utils/project.d.ts +8 -4
- package/dist/utils/project.js +63 -37
- package/dist/utils/resolve-environment.d.ts +13 -0
- package/dist/utils/resolve-environment.js +29 -0
- package/dist/utils/s3-upload.d.ts +7 -3
- package/dist/utils/s3-upload.js +44 -9
- package/dist/utils/token-display.d.ts +5 -2
- package/dist/utils/token-display.js +49 -24
- package/dist/utils/typescript-validator.d.ts +0 -1
- package/dist/utils/typescript-validator.js +4 -8
- package/dist/utils/version-check.d.ts +2 -0
- package/dist/utils/version-check.js +43 -0
- package/package.json +47 -16
- package/dist/api/control-plane.d.ts.map +0 -1
- package/dist/api/control-plane.js.map +0 -1
- package/dist/api/figma-api.d.ts.map +0 -1
- package/dist/api/figma-api.js.map +0 -1
- package/dist/auth/browser.d.ts.map +0 -1
- package/dist/auth/browser.js.map +0 -1
- package/dist/auth/callback-server.d.ts.map +0 -1
- package/dist/auth/callback-server.js.map +0 -1
- package/dist/auth/crypto-utils.d.ts.map +0 -1
- package/dist/auth/crypto-utils.js.map +0 -1
- package/dist/auth/jwt-validator.d.ts.map +0 -1
- package/dist/auth/jwt-validator.js.map +0 -1
- package/dist/auth/oauth-flow.d.ts.map +0 -1
- package/dist/auth/oauth-flow.js.map +0 -1
- package/dist/auth/pkce.d.ts.map +0 -1
- package/dist/auth/pkce.js.map +0 -1
- package/dist/auth/project-token.d.ts.map +0 -1
- package/dist/auth/project-token.js.map +0 -1
- package/dist/auth/refresh.d.ts.map +0 -1
- package/dist/auth/refresh.js.map +0 -1
- package/dist/auth/token-store.d.ts.map +0 -1
- package/dist/auth/token-store.js.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list-tokens.d.ts.map +0 -1
- package/dist/commands/list-tokens.js.map +0 -1
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js.map +0 -1
- package/dist/config/oauth.d.ts.map +0 -1
- package/dist/config/oauth.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/exports/client.d.ts.map +0 -1
- package/dist/exports/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/oauth/components/LoginButton/index.d.ts.map +0 -1
- package/dist/oauth/components/LoginButton/index.js.map +0 -1
- package/dist/oauth/components/LogoutButton/index.d.ts.map +0 -1
- package/dist/oauth/components/LogoutButton/index.js.map +0 -1
- package/dist/oauth/defaults.d.ts.map +0 -1
- package/dist/oauth/defaults.js.map +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js.map +0 -1
- package/dist/oauth/exports/client.d.ts.map +0 -1
- package/dist/oauth/exports/client.js.map +0 -1
- package/dist/oauth/hooks/afterLogout.d.ts.map +0 -1
- package/dist/oauth/hooks/afterLogout.js.map +0 -1
- package/dist/oauth/hooks/me.d.ts.map +0 -1
- package/dist/oauth/hooks/me.js.map +0 -1
- package/dist/oauth/hooks/refresh.d.ts.map +0 -1
- package/dist/oauth/hooks/refresh.js.map +0 -1
- package/dist/oauth/index.d.ts.map +0 -1
- package/dist/oauth/index.js.map +0 -1
- package/dist/oauth/strategy/index.d.ts.map +0 -1
- package/dist/oauth/strategy/index.js.map +0 -1
- package/dist/oauth/types.d.ts.map +0 -1
- package/dist/oauth/types.js.map +0 -1
- package/dist/oauth/utilities/clearCookie.d.ts.map +0 -1
- package/dist/oauth/utilities/clearCookie.js.map +0 -1
- package/dist/oauth/utilities/createCookieOptions.d.ts.map +0 -1
- package/dist/oauth/utilities/createCookieOptions.js.map +0 -1
- package/dist/oauth/utilities/createDebugLogger.d.ts.map +0 -1
- package/dist/oauth/utilities/createDebugLogger.js.map +0 -1
- package/dist/oauth/utilities/extractOrigin.d.ts.map +0 -1
- package/dist/oauth/utilities/extractOrigin.js.map +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts.map +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.js.map +0 -1
- package/dist/oauth/utilities/getAdminPath.d.ts +0 -8
- package/dist/oauth/utilities/getAdminPath.d.ts.map +0 -1
- package/dist/oauth/utilities/getAdminPath.js +0 -9
- package/dist/oauth/utilities/getAdminPath.js.map +0 -1
- package/dist/oauth/utilities/getAuthorizeURL.d.ts.map +0 -1
- package/dist/oauth/utilities/getAuthorizeURL.js.map +0 -1
- package/dist/oauth/utilities/getCookieExpiration.d.ts.map +0 -1
- package/dist/oauth/utilities/getCookieExpiration.js.map +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts.map +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.js.map +0 -1
- package/dist/oauth/utilities/getTokenExp.d.ts.map +0 -1
- package/dist/oauth/utilities/getTokenExp.js.map +0 -1
- package/dist/oauth/utilities/getUsernameField.d.ts.map +0 -1
- package/dist/oauth/utilities/getUsernameField.js.map +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts.map +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.js.map +0 -1
- package/dist/oauth/utilities/mergeHeaders.d.ts.map +0 -1
- package/dist/oauth/utilities/mergeHeaders.js.map +0 -1
- package/dist/oauth/utilities/refreshTokens.d.ts.map +0 -1
- package/dist/oauth/utilities/refreshTokens.js.map +0 -1
- package/dist/plugin/adapter.d.ts.map +0 -1
- package/dist/plugin/adapter.js.map +0 -1
- package/dist/plugin/build-config.d.ts.map +0 -1
- package/dist/plugin/build-config.js.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/asset-collection.d.ts.map +0 -1
- package/dist/utils/asset-collection.js.map +0 -1
- package/dist/utils/build-detection.d.ts.map +0 -1
- package/dist/utils/build-detection.js.map +0 -1
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/download-template.d.ts.map +0 -1
- package/dist/utils/download-template.js.map +0 -1
- package/dist/utils/env-management.d.ts.map +0 -1
- package/dist/utils/env-management.js.map +0 -1
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/formatter.d.ts.map +0 -1
- package/dist/utils/formatter.js.map +0 -1
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/is-debug.d.ts.map +0 -1
- package/dist/utils/is-debug.js.map +0 -1
- package/dist/utils/lambda-config.d.ts.map +0 -1
- package/dist/utils/lambda-config.js.map +0 -1
- package/dist/utils/log.d.ts.map +0 -1
- package/dist/utils/log.js.map +0 -1
- package/dist/utils/messages.d.ts.map +0 -1
- package/dist/utils/messages.js.map +0 -1
- package/dist/utils/package-manager.d.ts.map +0 -1
- package/dist/utils/package-manager.js.map +0 -1
- package/dist/utils/payload-config-ast.d.ts.map +0 -1
- package/dist/utils/payload-config-ast.js.map +0 -1
- package/dist/utils/payload-config-finder.d.ts.map +0 -1
- package/dist/utils/payload-config-finder.js.map +0 -1
- package/dist/utils/payload-config-modifier.d.ts.map +0 -1
- package/dist/utils/payload-config-modifier.js.map +0 -1
- package/dist/utils/payload-package-check.d.ts.map +0 -1
- package/dist/utils/payload-package-check.js.map +0 -1
- package/dist/utils/project.d.ts.map +0 -1
- package/dist/utils/project.js.map +0 -1
- package/dist/utils/s3-upload.d.ts.map +0 -1
- package/dist/utils/s3-upload.js.map +0 -1
- package/dist/utils/token-display.d.ts.map +0 -1
- package/dist/utils/token-display.js.map +0 -1
- package/dist/utils/typescript-validator.d.ts.map +0 -1
- package/dist/utils/typescript-validator.js.map +0 -1
package/dist/utils/formatter.js
CHANGED
|
@@ -1,47 +1,57 @@
|
|
|
1
|
-
import
|
|
1
|
+
import spawn from 'cross-spawn';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import * as log from './log.js';
|
|
3
4
|
/**
|
|
4
5
|
* Format file with Prettier
|
|
5
6
|
* Returns warning if formatting fails but does not throw
|
|
6
7
|
*/ export async function formatFile(filePath, packageManager) {
|
|
8
|
+
const cmd = `${packageManager} exec prettier --write ${filePath}`;
|
|
9
|
+
const cwd = path.dirname(filePath);
|
|
10
|
+
log.debug(`Running formatter: ${cmd} (cwd: ${cwd})`);
|
|
7
11
|
return new Promise((resolve)=>{
|
|
8
12
|
try {
|
|
9
|
-
const
|
|
13
|
+
const child = spawn(packageManager, [
|
|
10
14
|
'exec',
|
|
11
15
|
'prettier',
|
|
12
16
|
'--write',
|
|
13
17
|
filePath
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
cwd: path.dirname(filePath),
|
|
17
|
-
shell: true,
|
|
18
|
+
], {
|
|
19
|
+
cwd,
|
|
18
20
|
stdio: 'pipe'
|
|
19
21
|
});
|
|
22
|
+
let stderr = '';
|
|
23
|
+
child.stderr?.on('data', (data)=>{
|
|
24
|
+
stderr += data.toString();
|
|
25
|
+
});
|
|
20
26
|
child.on('close', (code)=>{
|
|
21
27
|
if (code === 0) {
|
|
28
|
+
log.debug('Prettier formatting succeeded');
|
|
22
29
|
resolve({
|
|
23
30
|
success: true
|
|
24
31
|
});
|
|
25
32
|
} else {
|
|
33
|
+
const detail = stderr.trim();
|
|
34
|
+
log.debug(`Prettier exited with code ${code}${detail ? `: ${detail}` : ''}`);
|
|
26
35
|
resolve({
|
|
27
36
|
success: false,
|
|
28
|
-
warning:
|
|
37
|
+
warning: `Could not format file with Prettier (exit code ${code})${detail ? `: ${detail}` : ''}`
|
|
29
38
|
});
|
|
30
39
|
}
|
|
31
40
|
});
|
|
32
|
-
child.on('error', ()=>{
|
|
41
|
+
child.on('error', (err)=>{
|
|
42
|
+
log.debug(`Prettier spawn error: ${err.message}`);
|
|
33
43
|
resolve({
|
|
34
44
|
success: false,
|
|
35
|
-
warning:
|
|
45
|
+
warning: `Could not format file with Prettier: ${err.message}`
|
|
36
46
|
});
|
|
37
47
|
});
|
|
38
|
-
} catch
|
|
48
|
+
} catch (err) {
|
|
49
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
50
|
+
log.debug(`Prettier failed to spawn: ${message}`);
|
|
39
51
|
resolve({
|
|
40
52
|
success: false,
|
|
41
|
-
warning:
|
|
53
|
+
warning: `Could not format file with Prettier: ${message}`
|
|
42
54
|
});
|
|
43
55
|
}
|
|
44
56
|
});
|
|
45
57
|
}
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively collect all file paths under a directory,
|
|
3
|
+
* returned as forward-slash-separated paths relative to baseDir.
|
|
4
|
+
*/
|
|
5
|
+
export declare function collectFilesRecursive(dir: string, baseDir: string): Promise<string[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Recursively sum the byte size of all files under a directory.
|
|
8
|
+
* Returns 0 for a missing or unreadable directory. Symlinks are not
|
|
9
|
+
* followed. Files that disappear or become unreadable between readdir
|
|
10
|
+
* and stat are skipped (treated as 0 bytes).
|
|
11
|
+
*/
|
|
12
|
+
export declare function getDirectorySize(dir: string): Promise<number>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Recursively collect all file paths under a directory,
|
|
5
|
+
* returned as forward-slash-separated paths relative to baseDir.
|
|
6
|
+
*/ export async function collectFilesRecursive(dir, baseDir) {
|
|
7
|
+
const files = [];
|
|
8
|
+
try {
|
|
9
|
+
const entries = await fs.readdir(dir, {
|
|
10
|
+
withFileTypes: true
|
|
11
|
+
});
|
|
12
|
+
for (const entry of entries){
|
|
13
|
+
const fullPath = path.join(dir, entry.name);
|
|
14
|
+
if (entry.isDirectory()) {
|
|
15
|
+
const subFiles = await collectFilesRecursive(fullPath, baseDir);
|
|
16
|
+
files.push(...subFiles);
|
|
17
|
+
} else if (entry.isFile()) {
|
|
18
|
+
files.push(path.relative(baseDir, fullPath).split(path.sep).join('/'));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} catch {
|
|
22
|
+
// Not accessible
|
|
23
|
+
}
|
|
24
|
+
return files;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Recursively sum the byte size of all files under a directory.
|
|
28
|
+
* Returns 0 for a missing or unreadable directory. Symlinks are not
|
|
29
|
+
* followed. Files that disappear or become unreadable between readdir
|
|
30
|
+
* and stat are skipped (treated as 0 bytes).
|
|
31
|
+
*/ export async function getDirectorySize(dir) {
|
|
32
|
+
let entries;
|
|
33
|
+
try {
|
|
34
|
+
entries = await fs.readdir(dir, {
|
|
35
|
+
withFileTypes: true
|
|
36
|
+
});
|
|
37
|
+
} catch {
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
let total = 0;
|
|
41
|
+
for (const entry of entries){
|
|
42
|
+
const fullPath = path.join(dir, entry.name);
|
|
43
|
+
if (entry.isDirectory()) {
|
|
44
|
+
total += await getDirectorySize(fullPath);
|
|
45
|
+
} else if (entry.isFile()) {
|
|
46
|
+
try {
|
|
47
|
+
const stats = await fs.stat(fullPath);
|
|
48
|
+
total += stats.size;
|
|
49
|
+
} catch {
|
|
50
|
+
// File vanished or is unreadable between readdir and stat — skip it.
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return total;
|
|
55
|
+
}
|
package/dist/utils/git.d.ts
CHANGED
package/dist/utils/git.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walk up from a directory to find the nearest package.json with name "@payloadcms/figma".
|
|
3
|
+
*/
|
|
4
|
+
export declare function findPackageRoot(startDir: string): Promise<null | string>;
|
|
5
|
+
/**
|
|
6
|
+
* Build and pack the local @payloadcms/figma package, returning the tgz path.
|
|
7
|
+
*/
|
|
8
|
+
export declare function packLocalPackage(pkgDir: string): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
/**
|
|
5
|
+
* Walk up from a directory to find the nearest package.json with name "@payloadcms/figma".
|
|
6
|
+
*/ export async function findPackageRoot(startDir) {
|
|
7
|
+
let dir = startDir;
|
|
8
|
+
while(true){
|
|
9
|
+
const pkgPath = path.join(dir, 'package.json');
|
|
10
|
+
try {
|
|
11
|
+
const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'));
|
|
12
|
+
if (pkg.name === '@payloadcms/figma') {
|
|
13
|
+
return dir;
|
|
14
|
+
}
|
|
15
|
+
} catch {
|
|
16
|
+
// No package.json here
|
|
17
|
+
}
|
|
18
|
+
const parent = path.dirname(dir);
|
|
19
|
+
if (parent === dir) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
dir = parent;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Build and pack the local @payloadcms/figma package, returning the tgz path.
|
|
27
|
+
*/ export function packLocalPackage(pkgDir) {
|
|
28
|
+
execSync('pnpm build', {
|
|
29
|
+
cwd: pkgDir,
|
|
30
|
+
stdio: 'pipe'
|
|
31
|
+
});
|
|
32
|
+
const tgzOutput = execSync('pnpm pack', {
|
|
33
|
+
cwd: pkgDir,
|
|
34
|
+
stdio: 'pipe'
|
|
35
|
+
}).toString().trim();
|
|
36
|
+
const tgzName = tgzOutput.split('\n').pop();
|
|
37
|
+
const tgzPath = path.join(pkgDir, tgzName);
|
|
38
|
+
return tgzPath;
|
|
39
|
+
}
|
package/dist/utils/is-debug.d.ts
CHANGED
package/dist/utils/is-debug.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { PackageManager } from './package-manager.js';
|
|
1
2
|
/**
|
|
2
3
|
* Apply Lambda-specific modifications to a Payload project
|
|
3
4
|
*
|
|
4
5
|
* @param projectPath - Path to project directory
|
|
6
|
+
* @param packageManager - Package manager to use in scripts (defaults to 'npm')
|
|
5
7
|
*/
|
|
6
|
-
export declare function applyLambdaModifications(projectPath: string): Promise<void>;
|
|
7
|
-
//# sourceMappingURL=lambda-config.d.ts.map
|
|
8
|
+
export declare function applyLambdaModifications(projectPath: string, packageManager?: PackageManager): Promise<void>;
|
|
@@ -1,36 +1,25 @@
|
|
|
1
|
-
import { parseModule, Syntax } from 'esprima-next';
|
|
2
1
|
import fs from 'fs/promises';
|
|
3
2
|
import path from 'path';
|
|
3
|
+
import { IndentationText, Node, Project, SyntaxKind } from 'ts-morph';
|
|
4
4
|
const RUN_SH_CONTENT = `#!/bin/bash -x
|
|
5
5
|
|
|
6
6
|
[ ! -d '/tmp/cache' ] && mkdir -p /tmp/cache
|
|
7
7
|
|
|
8
8
|
NODE_ENV=production exec node server.js
|
|
9
9
|
`;
|
|
10
|
-
const BUILD_FOR_LAMBDA_SH_CONTENT = `#!/bin/bash
|
|
11
|
-
|
|
12
|
-
cp -r .next/static .next/standalone/.next/static
|
|
13
|
-
cp run.sh .next/standalone/run.sh
|
|
14
|
-
cd .next/standalone
|
|
15
|
-
zip -r --symlinks lambda.zip .
|
|
16
|
-
mv lambda.zip ../..
|
|
17
|
-
`;
|
|
18
10
|
/**
|
|
19
11
|
* Apply Lambda-specific modifications to a Payload project
|
|
20
12
|
*
|
|
21
13
|
* @param projectPath - Path to project directory
|
|
22
|
-
|
|
14
|
+
* @param packageManager - Package manager to use in scripts (defaults to 'npm')
|
|
15
|
+
*/ export async function applyLambdaModifications(projectPath, packageManager = 'npm') {
|
|
23
16
|
// 1. Create run.sh
|
|
24
17
|
const runShPath = path.join(projectPath, 'run.sh');
|
|
25
18
|
await fs.writeFile(runShPath, RUN_SH_CONTENT, 'utf-8');
|
|
26
|
-
await fs.chmod(runShPath, 0o755);
|
|
27
|
-
// 2.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
await fs.chmod(buildShPath, 0o755);
|
|
31
|
-
// 3. Modify next config to add standalone output
|
|
32
|
-
await addStandaloneToNextConfig(projectPath);
|
|
33
|
-
// 4. Create/update .npmrc
|
|
19
|
+
await fs.chmod(runShPath, 0o755);
|
|
20
|
+
// 2. Modify next config to add standalone output
|
|
21
|
+
await addNextConfigProperties(projectPath);
|
|
22
|
+
// 3. Create/update .npmrc
|
|
34
23
|
const npmrcPath = path.join(projectPath, '.npmrc');
|
|
35
24
|
let npmrcContent = '';
|
|
36
25
|
try {
|
|
@@ -43,15 +32,15 @@ mv lambda.zip ../..
|
|
|
43
32
|
npmrcContent += 'node-linker=hoisted\n';
|
|
44
33
|
await fs.writeFile(npmrcPath, npmrcContent, 'utf-8');
|
|
45
34
|
}
|
|
46
|
-
//
|
|
47
|
-
await addLambdaBuildScript(projectPath);
|
|
35
|
+
// 4. Add lambda:buildzip script to package.json
|
|
36
|
+
await addLambdaBuildScript(projectPath, packageManager);
|
|
48
37
|
}
|
|
49
38
|
/**
|
|
50
|
-
* Find the Next.js config file
|
|
51
|
-
*
|
|
52
|
-
* @todo Support TypeScript config files in future
|
|
39
|
+
* Find the Next.js config file, checking TS extensions first
|
|
53
40
|
*/ async function findNextConfigPath(projectPath) {
|
|
54
41
|
const configFiles = [
|
|
42
|
+
'next.config.ts',
|
|
43
|
+
'next.config.mts',
|
|
55
44
|
'next.config.js',
|
|
56
45
|
'next.config.mjs'
|
|
57
46
|
];
|
|
@@ -64,81 +53,87 @@ mv lambda.zip ../..
|
|
|
64
53
|
// File doesn't exist, try next one
|
|
65
54
|
}
|
|
66
55
|
}
|
|
67
|
-
throw new Error('Could not find next.config.js or next.config.mjs');
|
|
56
|
+
throw new Error('Could not find next.config.ts, next.config.mts, next.config.js, or next.config.mjs');
|
|
68
57
|
}
|
|
69
58
|
/**
|
|
70
|
-
* Add
|
|
71
|
-
|
|
59
|
+
* Add required Next.js config properties using ts-morph AST parsing
|
|
60
|
+
* - output: 'standalone' (for Lambda deployment)
|
|
61
|
+
*/ async function addNextConfigProperties(projectPath) {
|
|
72
62
|
const nextConfigPath = await findNextConfigPath(projectPath);
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
const project = new Project({
|
|
64
|
+
compilerOptions: {
|
|
65
|
+
allowJs: true
|
|
66
|
+
},
|
|
67
|
+
manipulationSettings: {
|
|
68
|
+
indentationText: IndentationText.TwoSpaces
|
|
69
|
+
},
|
|
70
|
+
skipAddingFilesFromTsConfig: true
|
|
71
|
+
});
|
|
72
|
+
const sourceFile = project.addSourceFileAtPath(nextConfigPath);
|
|
73
|
+
// Find the config object to modify
|
|
74
|
+
const configObject = findConfigObject(sourceFile);
|
|
75
|
+
if (!configObject) {
|
|
76
|
+
throw new Error(`Could not find Next.js config object in ${path.basename(nextConfigPath)}. ` + `Expected either 'export default { ... }' or 'export default wrapper(configVar, ...)'`);
|
|
77
|
+
}
|
|
78
|
+
const hasOutput = configObject.getProperty('output') !== undefined;
|
|
79
|
+
if (hasOutput) {
|
|
80
|
+
return;
|
|
77
81
|
}
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
configObject.addPropertyAssignment({
|
|
83
|
+
name: 'output',
|
|
84
|
+
initializer: "'standalone'"
|
|
80
85
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
await sourceFile.save();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Find the config object literal from either:
|
|
90
|
+
* - Direct export: `export default { ... }`
|
|
91
|
+
* - Wrapped export: `export default withPayload(configVar, ...)`
|
|
92
|
+
* where configVar is a variable declaration with an object literal
|
|
93
|
+
*/ function findConfigObject(sourceFile) {
|
|
94
|
+
const exportDefault = sourceFile.getFirstDescendantByKind(SyntaxKind.ExportAssignment);
|
|
95
|
+
if (!exportDefault) {
|
|
96
|
+
return undefined;
|
|
85
97
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
if (firstArg
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (declarator?.init?.type === 'ObjectExpression') {
|
|
108
|
-
targetObjectExpression = declarator.init;
|
|
98
|
+
const expression = exportDefault.getExpression();
|
|
99
|
+
// Direct export: export default { ... }
|
|
100
|
+
if (Node.isObjectLiteralExpression(expression)) {
|
|
101
|
+
return expression;
|
|
102
|
+
}
|
|
103
|
+
// Wrapped export: export default withPayload(configVar, ...)
|
|
104
|
+
if (Node.isCallExpression(expression)) {
|
|
105
|
+
const firstArg = expression.getArguments()[0];
|
|
106
|
+
// Variable reference: export default withPayload(configVar)
|
|
107
|
+
if (firstArg && Node.isIdentifier(firstArg)) {
|
|
108
|
+
const configVarName = firstArg.getText();
|
|
109
|
+
// Find the variable declaration
|
|
110
|
+
const varStatements = sourceFile.getVariableStatements();
|
|
111
|
+
for (const statement of varStatements){
|
|
112
|
+
for (const decl of statement.getDeclarations()){
|
|
113
|
+
if (decl.getName() === configVarName) {
|
|
114
|
+
const initializer = decl.getInitializer();
|
|
115
|
+
if (initializer && Node.isObjectLiteralExpression(initializer)) {
|
|
116
|
+
return initializer;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
109
119
|
}
|
|
110
120
|
}
|
|
111
121
|
}
|
|
112
122
|
}
|
|
113
|
-
|
|
114
|
-
throw new Error(`Could not find Next.js config object in ${path.basename(nextConfigPath)}. ` + `Expected either 'export default { ... }' or 'export default wrapper(configVar, ...)'`);
|
|
115
|
-
}
|
|
116
|
-
const { loc } = targetObjectExpression;
|
|
117
|
-
const lines = content.split('\n');
|
|
118
|
-
// Insert output: 'standalone' as first property
|
|
119
|
-
const insertLine = loc.start.line - 1;
|
|
120
|
-
const insertColumn = loc.start.column + 1 // After opening brace
|
|
121
|
-
;
|
|
122
|
-
// Find the content of the line with the opening brace
|
|
123
|
-
const targetLine = lines[insertLine];
|
|
124
|
-
if (!targetLine) {
|
|
125
|
-
throw new Error(`Could not find target line in ${path.basename(nextConfigPath)}`);
|
|
126
|
-
}
|
|
127
|
-
lines[insertLine] = targetLine.slice(0, insertColumn) + "\n output: 'standalone'," + targetLine.slice(insertColumn);
|
|
128
|
-
const modifiedContent = lines.join('\n');
|
|
129
|
-
await fs.writeFile(nextConfigPath, modifiedContent, 'utf-8');
|
|
123
|
+
return undefined;
|
|
130
124
|
}
|
|
131
125
|
/**
|
|
132
126
|
* Add lambda:buildzip script to package.json
|
|
133
|
-
*/ async function addLambdaBuildScript(projectPath) {
|
|
127
|
+
*/ async function addLambdaBuildScript(projectPath, packageManager) {
|
|
134
128
|
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
135
129
|
const content = await fs.readFile(packageJsonPath, 'utf-8');
|
|
136
130
|
const packageJson = JSON.parse(content);
|
|
137
131
|
if (!packageJson.scripts) {
|
|
138
132
|
packageJson.scripts = {};
|
|
139
133
|
}
|
|
140
|
-
|
|
134
|
+
// Use package manager's run and exec commands
|
|
135
|
+
const runCmd = packageManager === 'npm' ? 'npm run' : packageManager;
|
|
136
|
+
const execCmd = packageManager === 'npm' ? 'npx' : `${packageManager} exec`;
|
|
137
|
+
packageJson.scripts['lambda:buildzip'] = `${runCmd} build && ${execCmd} payloadcms-figma build-lambda-zip`;
|
|
141
138
|
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
|
|
142
139
|
}
|
|
143
|
-
|
|
144
|
-
//# sourceMappingURL=lambda-config.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SanitizedConfig } from 'payload';
|
|
2
|
+
/**
|
|
3
|
+
* Load a project's Payload config without initializing Payload or connecting to its database.
|
|
4
|
+
*
|
|
5
|
+
* Payload's CLI uses tsx to evaluate TypeScript config files. Resolve that same loader from the
|
|
6
|
+
* project's Payload installation so this also works with strict package-manager layouts where
|
|
7
|
+
* tsx is not a direct dependency of @payloadcms/figma.
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadPayloadConfig(projectPath: string): Promise<SanitizedConfig>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
import { findPayloadConfig } from './payload-config-finder.js';
|
|
5
|
+
/**
|
|
6
|
+
* Load a project's Payload config without initializing Payload or connecting to its database.
|
|
7
|
+
*
|
|
8
|
+
* Payload's CLI uses tsx to evaluate TypeScript config files. Resolve that same loader from the
|
|
9
|
+
* project's Payload installation so this also works with strict package-manager layouts where
|
|
10
|
+
* tsx is not a direct dependency of @payloadcms/figma.
|
|
11
|
+
*/ export async function loadPayloadConfig(projectPath) {
|
|
12
|
+
const configPath = await findPayloadConfig(projectPath);
|
|
13
|
+
if (!configPath) {
|
|
14
|
+
throw new Error('Payload config not found.');
|
|
15
|
+
}
|
|
16
|
+
const absoluteConfigPath = path.resolve(projectPath, configPath);
|
|
17
|
+
const { loadEnv } = await import('payload/node');
|
|
18
|
+
loadEnv();
|
|
19
|
+
const requireFromProject = createRequire(path.join(projectPath, 'package.json'));
|
|
20
|
+
const payloadEntryPath = requireFromProject.resolve('payload');
|
|
21
|
+
const requireFromPayload = createRequire(payloadEntryPath);
|
|
22
|
+
const tsxApiPath = requireFromPayload.resolve('tsx/esm/api');
|
|
23
|
+
const { tsImport } = await import(pathToFileURL(tsxApiPath).href);
|
|
24
|
+
const parentURL = pathToFileURL(`${projectPath}${path.sep}`).href;
|
|
25
|
+
const imported = await tsImport(absoluteConfigPath, parentURL);
|
|
26
|
+
return await (imported.default ?? imported);
|
|
27
|
+
}
|
package/dist/utils/log.d.ts
CHANGED
package/dist/utils/log.js
CHANGED
package/dist/utils/messages.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PackageManager } from '
|
|
1
|
+
import type { PackageManager } from './package-manager.js';
|
|
2
2
|
export declare function helpMessage(): void;
|
|
3
3
|
export declare function successMessage(projectDir: string, packageManager: PackageManager): string;
|
|
4
4
|
export declare function successfulNextInit(): string;
|
|
@@ -6,5 +6,3 @@ export declare function moveMessage(args: {
|
|
|
6
6
|
nextAppDir: string;
|
|
7
7
|
projectDir: string;
|
|
8
8
|
}): string;
|
|
9
|
-
export declare function feedbackOutro(): string;
|
|
10
|
-
//# sourceMappingURL=messages.d.ts.map
|
package/dist/utils/messages.js
CHANGED
|
@@ -14,31 +14,70 @@ export function helpMessage() {
|
|
|
14
14
|
${pc.cyan('logout')} Clear all stored tokens
|
|
15
15
|
${pc.cyan('list-tokens')} Show stored token information
|
|
16
16
|
${pc.cyan('init')} Initialize a Figma CMS project
|
|
17
|
+
${pc.cyan('bootstrap')} Print bootstrap info (tenant IDs, OAuth creds) for a project
|
|
18
|
+
${pc.cyan('debug')} Show debug info for troubleshooting
|
|
19
|
+
${pc.cyan('env')} Switch active environment
|
|
17
20
|
${pc.cyan('deploy')} Deploy your project to Figma
|
|
21
|
+
${pc.cyan('upgrade')} Run upgrade migrations
|
|
22
|
+
${pc.cyan('upload-schema')} Upload collection schema to the Content API
|
|
23
|
+
${pc.cyan('build-lambda-zip')} Build Lambda deployment zip
|
|
18
24
|
|
|
19
25
|
${pc.bold('OPTIONS')}
|
|
20
26
|
|
|
21
27
|
${pc.dim('-h, --help Show help')}
|
|
28
|
+
${pc.dim('-v, --version Show CLI version')}
|
|
22
29
|
${pc.dim('--debug Enable debug logging')}
|
|
23
30
|
|
|
24
31
|
${pc.bold('AUTHENTICATION')}
|
|
25
32
|
|
|
26
33
|
${pc.cyan('@payloadcms/figma login')} Authenticate with Figma
|
|
27
|
-
${pc.cyan('@payloadcms/figma logout')} Clear
|
|
34
|
+
${pc.cyan('@payloadcms/figma logout')} Clear tokens for current environment
|
|
28
35
|
${pc.cyan('@payloadcms/figma list-tokens')} Display stored OAuth and project tokens
|
|
29
36
|
|
|
30
37
|
${pc.bold('INIT COMMAND')}
|
|
31
38
|
|
|
32
|
-
${pc.cyan('@payloadcms/figma init --id <cms-id>')}
|
|
33
|
-
${pc.cyan('@payloadcms/figma init')}
|
|
34
|
-
${pc.
|
|
35
|
-
${pc.
|
|
36
|
-
${pc.
|
|
39
|
+
${pc.cyan('@payloadcms/figma init --id <cms-resource-id>')} Initialize project
|
|
40
|
+
${pc.cyan('@payloadcms/figma init --id <id> --env staging')} Initialize for specific environment
|
|
41
|
+
${pc.dim('--name, -n <name>')} Set project directory name (skips prompt)
|
|
42
|
+
${pc.dim('--force')} Force reconfiguration of existing project
|
|
43
|
+
${pc.dim('--no-skill')} Skip installing the Payload skill into .claude/skills/payload/
|
|
44
|
+
${pc.dim('--template, -t <spec>')} Override scaffold template (e.g. main:website, owner/repo#ref:path)
|
|
45
|
+
${pc.dim('--payload-version <tag|version>')} Core Payload npm dist-tag or version (default canary; e.g. latest, 4.0.0-canary.16)
|
|
46
|
+
|
|
47
|
+
${pc.bold('BOOTSTRAP COMMAND')}
|
|
48
|
+
|
|
49
|
+
${pc.cyan('@payloadcms/figma bootstrap --id <cms-resource-id>')} Print bootstrap info
|
|
50
|
+
${pc.dim('--env <environment>')} Filter to a single environment
|
|
51
|
+
${pc.dim('--json')} Output JSON instead of styled note
|
|
52
|
+
|
|
53
|
+
${pc.bold('ENV COMMAND')}
|
|
54
|
+
|
|
55
|
+
${pc.cyan('@payloadcms/figma env')} List and switch environments
|
|
56
|
+
${pc.cyan('@payloadcms/figma env production')} Switch to a named environment
|
|
37
57
|
|
|
38
58
|
${pc.bold('DEPLOY COMMAND')}
|
|
39
59
|
|
|
40
|
-
${pc.cyan('@payloadcms/figma deploy')}
|
|
41
|
-
${pc.dim('--
|
|
60
|
+
${pc.cyan('@payloadcms/figma deploy')} Deploy your project to Figma
|
|
61
|
+
${pc.dim('--id <project-id>')} Override FIGMA_PROJECT_ID
|
|
62
|
+
${pc.dim('--env <environment>')} Override FIGMA_ENVIRONMENT_NAME
|
|
63
|
+
${pc.dim('--yes, -y')} Skip confirmation prompts
|
|
64
|
+
${pc.dim('--skip-build')} Skip building and use existing build
|
|
65
|
+
${pc.dim('--skip-size-check')} Skip the client-side bundle size check
|
|
66
|
+
|
|
67
|
+
${pc.bold('UPGRADE COMMAND')}
|
|
68
|
+
|
|
69
|
+
${pc.cyan('@payloadcms/figma upgrade')} Run all upgrade migrations
|
|
70
|
+
${pc.dim('--dry-run')} Preview changes without applying
|
|
71
|
+
|
|
72
|
+
${pc.bold('UPLOAD SCHEMA COMMAND')}
|
|
73
|
+
|
|
74
|
+
${pc.cyan('@payloadcms/figma upload-schema')} Upload collection schema for the active environment
|
|
75
|
+
${pc.dim('--id <project-id>')} Override FIGMA_PROJECT_ID
|
|
76
|
+
${pc.dim('--env <environment>')} Override FIGMA_ENVIRONMENT_NAME
|
|
77
|
+
|
|
78
|
+
${pc.bold('GLOBAL OPTIONS')}
|
|
79
|
+
|
|
80
|
+
${pc.dim('--infra-env <env>')} Target infrastructure (production, staging, or devbox)
|
|
42
81
|
|
|
43
82
|
${pc.bold('DOCUMENTATION')}
|
|
44
83
|
|
|
@@ -89,8 +128,3 @@ It is recommended to do this from your IDE if your app has existing file referen
|
|
|
89
128
|
Once moved, rerun the @payloadcms/figma command again.
|
|
90
129
|
`;
|
|
91
130
|
}
|
|
92
|
-
export function feedbackOutro() {
|
|
93
|
-
return `${pc.bgCyan(pc.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
//# sourceMappingURL=messages.js.map
|
|
@@ -9,4 +9,27 @@ export type PackageManager = 'npm' | 'pnpm' | 'yarn';
|
|
|
9
9
|
* @returns Detected package manager, defaults to npm
|
|
10
10
|
*/
|
|
11
11
|
export declare function getPackageManager(projectDir: string): Promise<PackageManager>;
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Resolve package manager for a project directory.
|
|
14
|
+
* Checks lockfiles first, falls back to environment detection.
|
|
15
|
+
*
|
|
16
|
+
* @param projectDir - Project directory to check
|
|
17
|
+
* @returns Resolved package manager
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolvePackageManager(projectDir: string): Promise<PackageManager>;
|
|
20
|
+
/**
|
|
21
|
+
* Detect package manager from npm_config_user_agent environment variable.
|
|
22
|
+
* Set automatically by npm/pnpm/yarn when running via npx/pnpm dlx/yarn dlx.
|
|
23
|
+
*
|
|
24
|
+
* @returns Detected package manager, defaults to npm
|
|
25
|
+
*/
|
|
26
|
+
export declare function detectPackageManagerFromEnvironment(): PackageManager;
|
|
27
|
+
/**
|
|
28
|
+
* Get the run command prefix for a package manager.
|
|
29
|
+
* npm needs "npm run", pnpm/yarn can run scripts directly.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getRunCommand(packageManager: PackageManager): string;
|
|
32
|
+
/**
|
|
33
|
+
* Get the add/install command for a package manager.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getAddCommand(packageManager: PackageManager): string;
|