@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.
- 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 +7574 -0
- package/dist/db-content-api/generated/content-api-types.js +5 -0
- package/dist/db-content-api/index.d.ts +37 -0
- package/dist/db-content-api/index.js +938 -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/data/applyDefaults.d.ts +6 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js +75 -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/index.d.ts +48 -0
- package/dist/db-content-api/utilities/data/index.js +299 -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/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 +100 -0
- package/dist/db-content-api/utilities/joins.d.ts +52 -0
- package/dist/db-content-api/utilities/joins.js +137 -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/buildLocalizedPaths.d.ts +10 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +71 -0
- package/dist/db-content-api/utilities/meta/buildMeta.d.ts +41 -0
- package/dist/db-content-api/utilities/meta/buildMeta.js +39 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +16 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.js +243 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +12 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.js +60 -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 +55 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +182 -0
- package/dist/db-content-api/utilities/where.d.ts +19 -0
- package/dist/db-content-api/utilities/where.js +106 -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
|
@@ -23,6 +23,59 @@ import path from 'path';
|
|
|
23
23
|
return 'npm';
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolve package manager for a project directory.
|
|
28
|
+
* Checks lockfiles first, falls back to environment detection.
|
|
29
|
+
*
|
|
30
|
+
* @param projectDir - Project directory to check
|
|
31
|
+
* @returns Resolved package manager
|
|
32
|
+
*/ export async function resolvePackageManager(projectDir) {
|
|
33
|
+
const fromLockfile = await getPackageManager(projectDir);
|
|
34
|
+
if (fromLockfile !== 'npm') {
|
|
35
|
+
return fromLockfile;
|
|
36
|
+
}
|
|
37
|
+
// Check if there's actually a package-lock.json (explicit npm choice)
|
|
38
|
+
if (await fileExists(path.join(projectDir, 'package-lock.json'))) {
|
|
39
|
+
return 'npm';
|
|
40
|
+
}
|
|
41
|
+
// No lockfile found — check environment
|
|
42
|
+
return detectPackageManagerFromEnvironment();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Detect package manager from npm_config_user_agent environment variable.
|
|
46
|
+
* Set automatically by npm/pnpm/yarn when running via npx/pnpm dlx/yarn dlx.
|
|
47
|
+
*
|
|
48
|
+
* @returns Detected package manager, defaults to npm
|
|
49
|
+
*/ export function detectPackageManagerFromEnvironment() {
|
|
50
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
51
|
+
if (!userAgent) {
|
|
52
|
+
return 'npm';
|
|
53
|
+
}
|
|
54
|
+
if (userAgent.startsWith('pnpm/')) {
|
|
55
|
+
return 'pnpm';
|
|
56
|
+
}
|
|
57
|
+
if (userAgent.startsWith('yarn/')) {
|
|
58
|
+
return 'yarn';
|
|
59
|
+
}
|
|
60
|
+
return 'npm';
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the run command prefix for a package manager.
|
|
64
|
+
* npm needs "npm run", pnpm/yarn can run scripts directly.
|
|
65
|
+
*/ export function getRunCommand(packageManager) {
|
|
66
|
+
return packageManager === 'npm' ? 'npm run' : packageManager;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get the add/install command for a package manager.
|
|
70
|
+
*/ export function getAddCommand(packageManager) {
|
|
71
|
+
if (packageManager === 'npm') {
|
|
72
|
+
return 'npm install';
|
|
73
|
+
}
|
|
74
|
+
if (packageManager === 'pnpm') {
|
|
75
|
+
return 'pnpm add';
|
|
76
|
+
}
|
|
77
|
+
return 'yarn add';
|
|
78
|
+
}
|
|
26
79
|
/**
|
|
27
80
|
* Check if file exists
|
|
28
81
|
*/ async function fileExists(filePath) {
|
|
@@ -33,5 +86,3 @@ import path from 'path';
|
|
|
33
86
|
return false;
|
|
34
87
|
}
|
|
35
88
|
}
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=package-manager.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TemplateSource } from './download-template.js';
|
|
2
|
+
export declare class TemplateSpecParseError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Parse a --template spec string into a partial TemplateSource override.
|
|
7
|
+
*
|
|
8
|
+
* Format: [<owner>/<repo>#]<ref>:<template-path>
|
|
9
|
+
* Shorthand: a bare token with no `#` and no `:` is treated as the template path.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseTemplateSpec(spec: string): Partial<TemplateSource>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export class TemplateSpecParseError extends Error {
|
|
2
|
+
constructor(message){
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'TemplateSpecParseError';
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Parse a --template spec string into a partial TemplateSource override.
|
|
9
|
+
*
|
|
10
|
+
* Format: [<owner>/<repo>#]<ref>:<template-path>
|
|
11
|
+
* Shorthand: a bare token with no `#` and no `:` is treated as the template path.
|
|
12
|
+
*/ export function parseTemplateSpec(spec) {
|
|
13
|
+
const trimmed = spec.trim();
|
|
14
|
+
if (!trimmed) {
|
|
15
|
+
throw new TemplateSpecParseError('Template spec is empty');
|
|
16
|
+
}
|
|
17
|
+
let rest = trimmed;
|
|
18
|
+
const result = {};
|
|
19
|
+
const hashIndex = rest.indexOf('#');
|
|
20
|
+
if (hashIndex !== -1) {
|
|
21
|
+
const repoPart = rest.slice(0, hashIndex);
|
|
22
|
+
rest = rest.slice(hashIndex + 1);
|
|
23
|
+
const slashCount = (repoPart.match(/\//g) ?? []).length;
|
|
24
|
+
if (slashCount !== 1) {
|
|
25
|
+
throw new TemplateSpecParseError(`Expected "<owner>/<repo>" before "#", got "${repoPart}"`);
|
|
26
|
+
}
|
|
27
|
+
const [owner, repo] = repoPart.split('/');
|
|
28
|
+
if (!owner || !repo) {
|
|
29
|
+
throw new TemplateSpecParseError(`Invalid owner/repo: "${repoPart}"`);
|
|
30
|
+
}
|
|
31
|
+
result.owner = owner;
|
|
32
|
+
result.repo = repo;
|
|
33
|
+
} else {
|
|
34
|
+
// Check for slash only in the portion before the first colon (the ref part).
|
|
35
|
+
// Slashes after the colon are valid multi-segment template paths.
|
|
36
|
+
const beforeColon = rest.includes(':') ? rest.slice(0, rest.indexOf(':')) : rest;
|
|
37
|
+
if (beforeColon.includes('/')) {
|
|
38
|
+
throw new TemplateSpecParseError(`"<owner>/<repo>" must be followed by "#<ref>" (got "${trimmed}")`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const colonIndex = rest.indexOf(':');
|
|
42
|
+
if (colonIndex !== -1) {
|
|
43
|
+
const ref = rest.slice(0, colonIndex);
|
|
44
|
+
const templatePath = rest.slice(colonIndex + 1);
|
|
45
|
+
if (!ref) {
|
|
46
|
+
throw new TemplateSpecParseError('Ref before ":" is empty');
|
|
47
|
+
}
|
|
48
|
+
if (!templatePath) {
|
|
49
|
+
throw new TemplateSpecParseError('Template path after ":" is empty');
|
|
50
|
+
}
|
|
51
|
+
result.ref = ref;
|
|
52
|
+
result.templatePath = templatePath;
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
if (hashIndex !== -1) {
|
|
56
|
+
throw new TemplateSpecParseError('Spec with "<owner>/<repo>#<ref>" must include ":<template-path>"');
|
|
57
|
+
}
|
|
58
|
+
result.templatePath = rest;
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
@@ -1,19 +1,39 @@
|
|
|
1
1
|
import type { SourceFile } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Result of detecting what changes are needed in a payload config file
|
|
4
|
+
*/
|
|
2
5
|
export type DetectionResult = {
|
|
6
|
+
/** Database adapter configuration if present */
|
|
3
7
|
dbProperty?: {
|
|
8
|
+
/** Name of the adapter function (e.g., 'mongooseAdapter', 'postgresAdapter') */
|
|
4
9
|
adapter: string;
|
|
10
|
+
/** NPM package the adapter is imported from (e.g., '@payloadcms/db-mongodb') */
|
|
5
11
|
importSource: string;
|
|
6
12
|
};
|
|
13
|
+
/** Editor configuration if present */
|
|
7
14
|
editorProperty?: {
|
|
15
|
+
/** NPM package the editor is imported from (e.g., '@payloadcms/richtext-lexical') */
|
|
8
16
|
importSource: string;
|
|
17
|
+
/** Whether this is a default editor with no custom configuration */
|
|
9
18
|
isDefault: boolean;
|
|
10
19
|
};
|
|
20
|
+
/** Whether the config already has a `figma` property */
|
|
11
21
|
figmaObjectExists: boolean;
|
|
22
|
+
/** Whether buildConfig/buildFigmaConfig uses an import alias (e.g., 'buildConfig as createConfig') */
|
|
12
23
|
hasAlias: boolean;
|
|
24
|
+
/** Whether a buildConfig or buildFigmaConfig call was found (undefined if not checked) */
|
|
13
25
|
hasBuildConfig?: boolean;
|
|
26
|
+
/** Whether there are other imports from 'payload' besides buildConfig (e.g., types) */
|
|
14
27
|
hasOtherPayloadImports: boolean;
|
|
28
|
+
/** Whether the import needs to be changed from 'payload' to '@payloadcms/figma' */
|
|
15
29
|
needsImportChange: boolean;
|
|
30
|
+
/** Whether a `secret` property exists in the config */
|
|
16
31
|
secretProperty?: boolean;
|
|
32
|
+
/** Sharp configuration if present */
|
|
33
|
+
sharpProperty?: {
|
|
34
|
+
/** NPM package sharp is imported from (always 'sharp') */
|
|
35
|
+
importSource: string;
|
|
36
|
+
};
|
|
17
37
|
};
|
|
18
38
|
/**
|
|
19
39
|
* Detect what changes are needed in the payload config file
|
|
@@ -29,9 +49,8 @@ export type ASTModificationResult = {
|
|
|
29
49
|
*/
|
|
30
50
|
export declare function applyModifications(sourceFile: SourceFile, detection: DetectionResult): ASTModificationResult;
|
|
31
51
|
export type FigmaPropertyConfig = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
useContentSystem: boolean;
|
|
52
|
+
contentSystemId: string;
|
|
53
|
+
useContentSystem?: boolean;
|
|
35
54
|
};
|
|
36
55
|
/**
|
|
37
56
|
* Add figma property to buildConfig if it doesn't exist
|
|
@@ -39,8 +58,9 @@ export type FigmaPropertyConfig = {
|
|
|
39
58
|
*/
|
|
40
59
|
export declare function addFigmaProperty(sourceFile: SourceFile, config: FigmaPropertyConfig): ASTModificationResult;
|
|
41
60
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
61
|
+
* Remove the contentSystemId property from figma config object.
|
|
62
|
+
* Used during upgrade migration — contentSystemId is now resolved from bootstrap data.
|
|
63
|
+
*
|
|
64
|
+
* @returns true if the property was found and removed
|
|
44
65
|
*/
|
|
45
|
-
export declare function
|
|
46
|
-
//# sourceMappingURL=payload-config-ast.d.ts.map
|
|
66
|
+
export declare function removeFigmaContentSystemId(sourceFile: SourceFile): boolean;
|
|
@@ -9,9 +9,9 @@ import * as log from './log.js';
|
|
|
9
9
|
hasOtherPayloadImports: false,
|
|
10
10
|
needsImportChange: false
|
|
11
11
|
};
|
|
12
|
-
// Find buildConfig import
|
|
12
|
+
// Find buildConfig import — prefer @payloadcms/figma (already migrated) over payload
|
|
13
13
|
const imports = sourceFile.getImportDeclarations();
|
|
14
|
-
const payloadImport = imports.find((imp)=>imp.getModuleSpecifierValue() === '
|
|
14
|
+
const payloadImport = imports.find((imp)=>imp.getModuleSpecifierValue() === '@payloadcms/figma') || imports.find((imp)=>imp.getModuleSpecifierValue() === 'payload');
|
|
15
15
|
if (!payloadImport) {
|
|
16
16
|
log.debug('No payload or @payloadcms/figma import found');
|
|
17
17
|
result.hasBuildConfig = false;
|
|
@@ -20,15 +20,18 @@ import * as log from './log.js';
|
|
|
20
20
|
log.debug(`Found import from: ${payloadImport.getModuleSpecifierValue()}`);
|
|
21
21
|
const moduleSpecifier = payloadImport.getModuleSpecifierValue();
|
|
22
22
|
const namedImports = payloadImport.getNamedImports();
|
|
23
|
-
//
|
|
24
|
-
|
|
23
|
+
// Determine which function name to look for based on the import source
|
|
24
|
+
// - From 'payload': look for buildConfig (needs migration)
|
|
25
|
+
// - From '@payloadcms/figma': look for buildFigmaConfig (already migrated)
|
|
26
|
+
const expectedFunctionName = moduleSpecifier === 'payload' ? 'buildConfig' : 'buildFigmaConfig';
|
|
27
|
+
const buildConfigImport = namedImports.find((ni)=>ni.getName() === expectedFunctionName);
|
|
25
28
|
if (!buildConfigImport) {
|
|
26
29
|
result.hasBuildConfig = false;
|
|
27
30
|
return result;
|
|
28
31
|
}
|
|
29
32
|
// Check for alias and get the actual name used in code
|
|
30
33
|
const aliasNode = buildConfigImport.getAliasNode();
|
|
31
|
-
const buildConfigName = aliasNode ? aliasNode.getText() :
|
|
34
|
+
const buildConfigName = aliasNode ? aliasNode.getText() : expectedFunctionName;
|
|
32
35
|
if (aliasNode) {
|
|
33
36
|
result.hasAlias = true;
|
|
34
37
|
}
|
|
@@ -109,6 +112,15 @@ import * as log from './log.js';
|
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
}
|
|
115
|
+
// Check for sharp property
|
|
116
|
+
const sharpProperty = configArg.getProperty('sharp');
|
|
117
|
+
if (sharpProperty) {
|
|
118
|
+
// Find the import source for sharp
|
|
119
|
+
const sharpImport = imports.find((imp)=>imp.getModuleSpecifierValue() === 'sharp' || imp.getNamedImports().some((ni)=>ni.getName() === 'sharp'));
|
|
120
|
+
result.sharpProperty = {
|
|
121
|
+
importSource: sharpImport?.getModuleSpecifierValue() || 'sharp'
|
|
122
|
+
};
|
|
123
|
+
}
|
|
112
124
|
// Check for figma property
|
|
113
125
|
const figmaProperty = configArg.getProperty('figma');
|
|
114
126
|
if (figmaProperty) {
|
|
@@ -145,9 +157,27 @@ import * as log from './log.js';
|
|
|
145
157
|
// Remove duplicates and sort in reverse order to avoid position shifts
|
|
146
158
|
const uniqueRanges = Array.from(new Set(ranges.map((r)=>JSON.stringify(r)))).map((r)=>JSON.parse(r));
|
|
147
159
|
uniqueRanges.sort((a, b)=>b[0] - a[0]);
|
|
148
|
-
// Remove each comment range
|
|
160
|
+
// Remove each comment range, extending to the full line when the comment is the only content
|
|
149
161
|
for (const [pos, end] of uniqueRanges){
|
|
150
|
-
sourceFile.
|
|
162
|
+
const fullText = sourceFile.getFullText();
|
|
163
|
+
let removeStart = pos;
|
|
164
|
+
let removeEnd = end;
|
|
165
|
+
// Find the start of the line containing this comment
|
|
166
|
+
let lineStart = pos;
|
|
167
|
+
while(lineStart > 0 && fullText[lineStart - 1] !== '\n'){
|
|
168
|
+
lineStart--;
|
|
169
|
+
}
|
|
170
|
+
const beforeComment = fullText.substring(lineStart, pos);
|
|
171
|
+
const nextNewline = fullText.indexOf('\n', end);
|
|
172
|
+
const afterComment = fullText.substring(end, nextNewline === -1 ? fullText.length : nextNewline);
|
|
173
|
+
// If the comment is the only content on this line, remove the entire line
|
|
174
|
+
if (beforeComment.trim() === '' && afterComment.trim() === '') {
|
|
175
|
+
removeStart = lineStart > 0 ? lineStart - 1 : lineStart;
|
|
176
|
+
if (nextNewline !== -1) {
|
|
177
|
+
removeEnd = nextNewline + 1;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
sourceFile.removeText(removeStart, removeEnd);
|
|
151
181
|
}
|
|
152
182
|
return true;
|
|
153
183
|
}
|
|
@@ -240,7 +270,16 @@ import * as log from './log.js';
|
|
|
240
270
|
modified = true;
|
|
241
271
|
}
|
|
242
272
|
}
|
|
243
|
-
// 4.
|
|
273
|
+
// 4. Remove sharp property
|
|
274
|
+
if (detection.sharpProperty) {
|
|
275
|
+
const sharpProperty = configArg.getProperty('sharp');
|
|
276
|
+
if (sharpProperty) {
|
|
277
|
+
sharpProperty.remove();
|
|
278
|
+
changes.push('Removed sharp property');
|
|
279
|
+
modified = true;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// 5. Update buildConfig import
|
|
244
283
|
if (detection.needsImportChange) {
|
|
245
284
|
if (payloadImport) {
|
|
246
285
|
if (detection.hasOtherPayloadImports) {
|
|
@@ -258,19 +297,38 @@ import * as log from './log.js';
|
|
|
258
297
|
sourceFile.addImportDeclaration({
|
|
259
298
|
moduleSpecifier: '@payloadcms/figma',
|
|
260
299
|
namedImports: [
|
|
261
|
-
'
|
|
300
|
+
'buildFigmaConfig'
|
|
262
301
|
]
|
|
263
302
|
});
|
|
303
|
+
// Rename all usages of 'buildConfig' to 'buildFigmaConfig'
|
|
304
|
+
const identifiers = sourceFile.getDescendantsOfKind(SyntaxKind.Identifier);
|
|
305
|
+
identifiers.forEach((identifier)=>{
|
|
306
|
+
if (identifier.getText() === 'buildConfig') {
|
|
307
|
+
identifier.replaceWithText('buildFigmaConfig');
|
|
308
|
+
}
|
|
309
|
+
});
|
|
264
310
|
changes.push('Split buildConfig import to @payloadcms/figma');
|
|
265
311
|
} else {
|
|
266
|
-
// Replace entire import
|
|
312
|
+
// Replace entire import: change module specifier and rename all references
|
|
313
|
+
const buildConfigImport = payloadImport.getNamedImports().find((ni)=>ni.getName() === 'buildConfig');
|
|
314
|
+
if (buildConfigImport) {
|
|
315
|
+
// Change the import name
|
|
316
|
+
buildConfigImport.setName('buildFigmaConfig');
|
|
317
|
+
// Find and rename all usages of 'buildConfig' in the file
|
|
318
|
+
const identifiers = sourceFile.getDescendantsOfKind(SyntaxKind.Identifier);
|
|
319
|
+
identifiers.forEach((identifier)=>{
|
|
320
|
+
if (identifier.getText() === 'buildConfig') {
|
|
321
|
+
identifier.replaceWithText('buildFigmaConfig');
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
267
325
|
payloadImport.setModuleSpecifier('@payloadcms/figma');
|
|
268
326
|
changes.push('Changed buildConfig import to @payloadcms/figma');
|
|
269
327
|
}
|
|
270
328
|
modified = true;
|
|
271
329
|
}
|
|
272
330
|
}
|
|
273
|
-
//
|
|
331
|
+
// 6. Remove orphaned imports
|
|
274
332
|
// Re-fetch imports after each removal to avoid stale references
|
|
275
333
|
if (detection.dbProperty) {
|
|
276
334
|
const currentImports = sourceFile.getImportDeclarations();
|
|
@@ -290,6 +348,15 @@ import * as log from './log.js';
|
|
|
290
348
|
modified = true;
|
|
291
349
|
}
|
|
292
350
|
}
|
|
351
|
+
if (detection.sharpProperty) {
|
|
352
|
+
const currentImports = sourceFile.getImportDeclarations();
|
|
353
|
+
const sharpImport = currentImports.find((imp)=>imp.getModuleSpecifierValue() === 'sharp');
|
|
354
|
+
if (sharpImport) {
|
|
355
|
+
sharpImport.remove();
|
|
356
|
+
changes.push('Removed sharp import');
|
|
357
|
+
modified = true;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
293
360
|
return {
|
|
294
361
|
changes,
|
|
295
362
|
modified
|
|
@@ -301,15 +368,15 @@ import * as log from './log.js';
|
|
|
301
368
|
*/ export function addFigmaProperty(sourceFile, config) {
|
|
302
369
|
const changes = [];
|
|
303
370
|
let modified = false;
|
|
304
|
-
// Find
|
|
371
|
+
// Find buildFigmaConfig call (this function is only used with Figma configs)
|
|
305
372
|
const callExpressions = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression);
|
|
306
373
|
const buildConfigCall = callExpressions.find((ce)=>{
|
|
307
374
|
const expr = ce.getExpression();
|
|
308
375
|
const text = expr.getText();
|
|
309
|
-
return text === '
|
|
376
|
+
return text === 'buildFigmaConfig' || text.endsWith('.buildFigmaConfig');
|
|
310
377
|
});
|
|
311
378
|
if (!buildConfigCall) {
|
|
312
|
-
log.debug('No
|
|
379
|
+
log.debug('No buildFigmaConfig call found');
|
|
313
380
|
return {
|
|
314
381
|
changes: [],
|
|
315
382
|
modified: false
|
|
@@ -336,15 +403,14 @@ import * as log from './log.js';
|
|
|
336
403
|
};
|
|
337
404
|
}
|
|
338
405
|
// Add figma property
|
|
406
|
+
// contentSystemId is resolved automatically by buildFigmaConfig from env vars or bootstrap cache.
|
|
407
|
+
// useContentSystem defaults to true, so we only generate it when explicitly false.
|
|
408
|
+
const figmaObj = config.useContentSystem === false ? `{\nuseContentSystem: false,\n}` : '{}';
|
|
339
409
|
configArg.addPropertyAssignment({
|
|
340
410
|
name: 'figma',
|
|
341
|
-
initializer:
|
|
342
|
-
region: '${config.region}',
|
|
343
|
-
tenantId: '${config.tenantId}',
|
|
344
|
-
useContentSystem: ${config.useContentSystem},
|
|
345
|
-
}`
|
|
411
|
+
initializer: figmaObj
|
|
346
412
|
});
|
|
347
|
-
changes.push(`Added figma property (
|
|
413
|
+
changes.push(`Added figma property (contentSystemId: ${config.contentSystemId})`);
|
|
348
414
|
modified = true;
|
|
349
415
|
return {
|
|
350
416
|
changes,
|
|
@@ -352,60 +418,40 @@ import * as log from './log.js';
|
|
|
352
418
|
};
|
|
353
419
|
}
|
|
354
420
|
/**
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
|
|
358
|
-
|
|
421
|
+
* Remove the contentSystemId property from figma config object.
|
|
422
|
+
* Used during upgrade migration — contentSystemId is now resolved from bootstrap data.
|
|
423
|
+
*
|
|
424
|
+
* @returns true if the property was found and removed
|
|
425
|
+
*/ export function removeFigmaContentSystemId(sourceFile) {
|
|
359
426
|
const callExpressions = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression);
|
|
360
427
|
const buildConfigCall = callExpressions.find((ce)=>{
|
|
361
428
|
const expr = ce.getExpression();
|
|
362
429
|
const text = expr.getText();
|
|
363
|
-
return text === '
|
|
430
|
+
return text === 'buildFigmaConfig' || text.endsWith('.buildFigmaConfig');
|
|
364
431
|
});
|
|
365
432
|
if (!buildConfigCall) {
|
|
366
|
-
|
|
367
|
-
return null;
|
|
433
|
+
return false;
|
|
368
434
|
}
|
|
369
|
-
// Get config object argument
|
|
370
435
|
const configArg = buildConfigCall.getArguments()[0];
|
|
371
436
|
if (!configArg || !Node.isObjectLiteralExpression(configArg)) {
|
|
372
|
-
|
|
373
|
-
return null;
|
|
437
|
+
return false;
|
|
374
438
|
}
|
|
375
|
-
// Find figma property
|
|
376
439
|
const figmaProperty = configArg.getProperty('figma');
|
|
377
440
|
if (!figmaProperty || !Node.isPropertyAssignment(figmaProperty)) {
|
|
378
|
-
|
|
379
|
-
return null;
|
|
441
|
+
return false;
|
|
380
442
|
}
|
|
381
|
-
// Get initializer (the object value)
|
|
382
443
|
const initializer = figmaProperty.getInitializer();
|
|
383
444
|
if (!initializer || !Node.isObjectLiteralExpression(initializer)) {
|
|
384
|
-
|
|
385
|
-
return null;
|
|
386
|
-
}
|
|
387
|
-
// Extract values
|
|
388
|
-
const regionProp = initializer.getProperty('region');
|
|
389
|
-
const tenantIdProp = initializer.getProperty('tenantId');
|
|
390
|
-
const useContentSystemProp = initializer.getProperty('useContentSystem');
|
|
391
|
-
if (!regionProp || !tenantIdProp) {
|
|
392
|
-
log.debug('Missing required figma properties (region or tenantId)');
|
|
393
|
-
return null;
|
|
394
|
-
}
|
|
395
|
-
// Extract string values (remove quotes)
|
|
396
|
-
const region = Node.isPropertyAssignment(regionProp) ? regionProp.getInitializer()?.getText().replace(/['"]/g, '') : undefined;
|
|
397
|
-
const tenantId = Node.isPropertyAssignment(tenantIdProp) ? tenantIdProp.getInitializer()?.getText().replace(/['"]/g, '') : undefined;
|
|
398
|
-
const useContentSystem = Node.isPropertyAssignment(useContentSystemProp) ? useContentSystemProp.getInitializer()?.getText() === 'true' : true // Default to true if not specified
|
|
399
|
-
;
|
|
400
|
-
if (!region || !tenantId) {
|
|
401
|
-
log.debug('Could not extract region or tenantId values');
|
|
402
|
-
return null;
|
|
445
|
+
return false;
|
|
403
446
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
447
|
+
const contentSystemIdProp = initializer.getProperty('contentSystemId');
|
|
448
|
+
if (!contentSystemIdProp) {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
contentSystemIdProp.remove();
|
|
452
|
+
// Collapse empty object to avoid ts-morph whitespace artifacts
|
|
453
|
+
if (initializer.getProperties().length === 0) {
|
|
454
|
+
initializer.replaceWithText('{}');
|
|
455
|
+
}
|
|
456
|
+
return true;
|
|
409
457
|
}
|
|
410
|
-
|
|
411
|
-
//# sourceMappingURL=payload-config-ast.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Find the Payload config file using Payload's built-in finder
|
|
3
|
-
*
|
|
2
|
+
* Find the Payload config file using Payload's built-in finder when available,
|
|
3
|
+
* with fallback to simple file search for npx environments where payload isn't installed.
|
|
4
4
|
*
|
|
5
5
|
* @param projectPath - Absolute path to project directory
|
|
6
6
|
* @returns Absolute path to config file, or null if not found
|
|
7
7
|
*/
|
|
8
8
|
export declare function findPayloadConfig(projectPath: string): Promise<null | string>;
|
|
9
|
-
//# sourceMappingURL=payload-config-finder.d.ts.map
|
|
@@ -1,26 +1,63 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import * as log from './log.js';
|
|
4
|
+
// Standard Payload config file names in priority order
|
|
5
|
+
const CONFIG_FILES = [
|
|
6
|
+
'payload.config.ts',
|
|
7
|
+
'payload.config.js',
|
|
8
|
+
'src/payload.config.ts',
|
|
9
|
+
'src/payload.config.js'
|
|
10
|
+
];
|
|
2
11
|
/**
|
|
3
|
-
* Find the Payload config file using Payload's built-in finder
|
|
4
|
-
*
|
|
12
|
+
* Find the Payload config file using Payload's built-in finder when available,
|
|
13
|
+
* with fallback to simple file search for npx environments where payload isn't installed.
|
|
5
14
|
*
|
|
6
15
|
* @param projectPath - Absolute path to project directory
|
|
7
16
|
* @returns Absolute path to config file, or null if not found
|
|
8
17
|
*/ export async function findPayloadConfig(projectPath) {
|
|
18
|
+
// First, try using Payload's official config finder (if payload is installed)
|
|
19
|
+
const configFromPayload = await findConfigWithPayload(projectPath);
|
|
20
|
+
if (configFromPayload) {
|
|
21
|
+
return configFromPayload;
|
|
22
|
+
}
|
|
23
|
+
// Fallback: Simple file search for standard config locations
|
|
24
|
+
// This works when running via npx before payload is installed
|
|
25
|
+
log.debug('Payload not available, using fallback config finder');
|
|
26
|
+
return findConfigFallback(projectPath);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Try to find config using Payload's findConfig function.
|
|
30
|
+
* Returns null if payload is not installed (dynamic import fails).
|
|
31
|
+
*/ async function findConfigWithPayload(projectPath) {
|
|
9
32
|
const originalCwd = process.cwd();
|
|
10
33
|
try {
|
|
34
|
+
// Dynamic import - will fail gracefully if payload is not installed
|
|
35
|
+
const { findConfig } = await import('payload/node');
|
|
11
36
|
// findConfig requires being in the project directory
|
|
12
37
|
process.chdir(projectPath);
|
|
13
|
-
// Use Payload's official config finder
|
|
14
38
|
const configPath = findConfig();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
39
|
+
return configPath || null;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
// payload not installed or other error - return null to use fallback
|
|
42
|
+
log.debug(`Could not use Payload findConfig: ${error instanceof Error ? error.message : 'unknown'}`);
|
|
19
43
|
return null;
|
|
20
44
|
} finally{
|
|
21
|
-
// Always restore original working directory
|
|
22
45
|
process.chdir(originalCwd);
|
|
23
46
|
}
|
|
24
47
|
}
|
|
25
|
-
|
|
26
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Fallback config finder that checks standard locations.
|
|
50
|
+
* Used when payload is not installed (e.g., running via npx).
|
|
51
|
+
*/ async function findConfigFallback(projectPath) {
|
|
52
|
+
for (const configFile of CONFIG_FILES){
|
|
53
|
+
const fullPath = path.join(projectPath, configFile);
|
|
54
|
+
try {
|
|
55
|
+
await fs.access(fullPath);
|
|
56
|
+
log.debug(`Found config at: ${fullPath}`);
|
|
57
|
+
return fullPath;
|
|
58
|
+
} catch {
|
|
59
|
+
// File doesn't exist, try next
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
@@ -15,5 +15,4 @@ export declare function ensurePayloadFigmaConfig(projectPath: string, packageMan
|
|
|
15
15
|
/**
|
|
16
16
|
* Display manual configuration instructions
|
|
17
17
|
*/
|
|
18
|
-
export declare function displayManualInstructions(reason: string): void;
|
|
19
|
-
//# sourceMappingURL=payload-config-modifier.d.ts.map
|
|
18
|
+
export declare function displayManualInstructions(reason: string, packageManager?: PackageManager): void;
|