studiocms 0.2.0 → 0.4.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/CHANGELOG.md +122 -0
- package/dist/cli/add/index.d.ts +2 -2
- package/dist/cli/add/index.js +4 -3
- package/dist/cli/add/npm-utils.d.ts +6 -6
- package/dist/cli/add/tryToInstallPlugins.d.ts +1 -1
- package/dist/cli/add/tryToInstallPlugins.js +6 -5
- package/dist/cli/add/updateStudioCMSConfig.d.ts +1 -1
- package/dist/cli/add/updateStudioCMSConfig.js +3 -4
- package/dist/cli/add/validatePlugins.d.ts +1 -2
- package/dist/cli/add/validatePlugins.js +15 -9
- package/dist/cli/crypto/genJWT/index.d.ts +1 -1
- package/dist/cli/crypto/genJWT/index.js +8 -9
- package/dist/cli/crypto/index.d.ts +1 -1
- package/dist/cli/init/steps/env.js +14 -4
- package/dist/cli/init/steps/next.d.ts +1 -1
- package/dist/cli/init/steps/next.js +6 -5
- package/dist/cli/migrator/index.d.ts +1 -1
- package/dist/cli/migrator/index.js +2 -2
- package/dist/cli/users/index.d.ts +1 -1
- package/dist/cli/users/shared.js +2 -2
- package/dist/cli/users/steps/createUsers.js +7 -7
- package/dist/cli/users/steps/modifyUsers.js +2 -2
- package/dist/cli/users/steps/next.d.ts +1 -1
- package/dist/cli/utils/checkRequiredEnvVars.js +2 -2
- package/dist/cli/utils/context.d.ts +2 -4
- package/dist/cli/utils/context.js +1 -3
- package/dist/cli/utils/getCliDbClient.d.ts +1 -1
- package/dist/cli/utils/intro.d.ts +1 -1
- package/dist/cli/utils/loadConfig.d.ts +54 -49
- package/dist/cli/utils/loadConfig.js +5 -8
- package/dist/cli/utils/logger.js +3 -3
- package/dist/cli/utils/user-utils.d.ts +1 -1
- package/dist/cli/utils/user-utils.js +4 -3
- package/dist/client/apiClient.d.ts +4923 -0
- package/dist/client/apiClient.js +72 -0
- package/dist/config.d.ts +1734 -1
- package/dist/consts.d.ts +5 -5
- package/dist/consts.js +3 -2
- package/dist/db/plugins.d.ts +1 -1
- package/dist/db/plugins.js +5 -8
- package/dist/handlers/frontend/routes.d.ts +4 -18
- package/dist/handlers/frontend/routes.js +13 -152
- package/dist/handlers/frontend/types.d.ts +1 -1
- package/dist/handlers/frontend/utils.js +0 -18
- package/dist/handlers/pluginHandler.d.ts +34 -257
- package/dist/handlers/pluginHandler.js +92 -46
- package/dist/handlers/routeHandler.js +32 -11
- package/dist/handlers/setupDbStudio.d.ts +3 -1
- package/dist/handlers/setupDbStudio.js +19 -10
- package/dist/handlers/storage-manager/core/effectify-astro-context.d.ts +25 -0
- package/dist/handlers/storage-manager/core/effectify-astro-context.js +78 -0
- package/dist/handlers/storage-manager/no-op.d.ts +2 -2
- package/dist/handlers/storage-manager/no-op.js +2 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +10 -20
- package/dist/integrations/robots/index.d.ts +2 -2
- package/dist/integrations/robots/index.js +1 -3
- package/dist/integrations/robots/schema.d.ts +102 -273
- package/dist/integrations/robots/schema.js +220 -209
- package/dist/plugins/analytics/assets/schemas.d.ts +14 -9
- package/dist/plugins/analytics/assets/schemas.js +25 -17
- package/dist/plugins/analytics/db-client.d.ts +1 -1
- package/dist/plugins/analytics/index.d.ts +823 -3
- package/dist/plugins/analytics/index.js +4 -5
- package/dist/plugins/analytics/schemas.d.ts +54 -62
- package/dist/plugins/analytics/schemas.js +64 -13
- package/dist/plugins/analytics/table.d.ts +1 -1
- package/dist/plugins.d.ts +0 -1
- package/dist/schemas/config/api.d.ts +17 -0
- package/dist/schemas/config/api.js +14 -0
- package/dist/schemas/config/auth.d.ts +55 -59
- package/dist/schemas/config/auth.js +34 -11
- package/dist/schemas/config/dashboard.d.ts +43 -79
- package/dist/schemas/config/dashboard.js +43 -12
- package/dist/schemas/config/db.d.ts +15 -17
- package/dist/schemas/config/db.js +13 -5
- package/dist/schemas/config/developer.d.ts +33 -45
- package/dist/schemas/config/developer.js +22 -5
- package/dist/schemas/config/index.d.ts +398 -521
- package/dist/schemas/config/index.js +115 -57
- package/dist/schemas/config/sdk.d.ts +50 -196
- package/dist/schemas/config/sdk.js +61 -73
- package/dist/schemas/custom.d.ts +40 -0
- package/dist/schemas/custom.js +41 -0
- package/dist/schemas/external-schemas.d.ts +171 -0
- package/dist/schemas/external-schemas.js +179 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/plugins/i18n.d.ts +59 -39
- package/dist/schemas/plugins/i18n.js +42 -5
- package/dist/schemas/plugins/index.d.ts +7126 -10296
- package/dist/schemas/plugins/index.js +260 -276
- package/dist/schemas/plugins/shared.d.ts +1293 -3718
- package/dist/schemas/plugins/shared.js +320 -329
- package/dist/test-utils.d.ts +15 -4
- package/dist/test-utils.js +27 -11
- package/dist/toolbar/db-viewer/db-shared-types.d.ts +6 -6
- package/dist/toolbar/db-viewer/studio/connection.d.ts +8 -4
- package/dist/toolbar/db-viewer/studio/connection.js +2 -28
- package/dist/toolbar/db-viewer/studio/env/libsql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/libsql.js +17 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/mysql.js +23 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.d.ts +7 -0
- package/dist/toolbar/db-viewer/studio/env/postgres.js +23 -0
- package/dist/toolbar/db-viewer/studio/index.js +20 -56
- package/dist/toolbar/db-viewer/studio/type.d.ts +1 -2
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/libsql.js +24 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/mysql.js +9 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.d.ts +3 -0
- package/dist/toolbar/db-viewer/studio/virtual-connection/postgres.js +9 -0
- package/dist/toolbar/db-viewer/viewer.js +20 -21
- package/dist/types.d.ts +30 -0
- package/dist/utils/effects/smtp.d.ts +1 -1
- package/dist/utils/lang-helper.d.ts +10 -2
- package/dist/virtual.d.ts +35 -28
- package/dist/virtuals/auth/core.d.ts +5 -5
- package/dist/virtuals/auth/verify-email.d.ts +6 -6
- package/dist/virtuals/components/Generator.astro +2 -2
- package/dist/virtuals/components/Renderer.astro +9 -1
- package/dist/virtuals/components/renderFn.d.ts +3 -1
- package/dist/virtuals/components/renderFn.js +18 -0
- package/dist/virtuals/lib/headDefaults.d.ts +4 -2
- package/dist/virtuals/lib/headDefaults.js +0 -2
- package/dist/virtuals/lib/routeMap.d.ts +0 -12
- package/dist/virtuals/lib/routeMap.js +2 -14
- package/dist/virtuals/mailer/index.d.ts +3 -3
- package/dist/virtuals/notifier/index.d.ts +5 -5
- package/dist/virtuals/plugins/dashboard-pages.d.ts +2 -64
- package/dist/virtuals/scripts/StorageFileBrowser.d.ts +1 -172
- package/dist/virtuals/scripts/StorageFileBrowser.js +216 -119
- package/dist/virtuals/template-engine/index.d.ts +4 -4
- package/frontend/components/dashboard/configuration/ConfigForm.astro +218 -110
- package/frontend/components/dashboard/content-mgmt/ContentSearch.astro +21 -22
- package/frontend/components/dashboard/content-mgmt/CreateFolder.astro +66 -54
- package/frontend/components/dashboard/content-mgmt/CreatePage.astro +58 -104
- package/frontend/components/dashboard/content-mgmt/EditFolder.astro +65 -67
- package/frontend/components/dashboard/content-mgmt/EditPage.astro +86 -134
- package/frontend/components/dashboard/content-mgmt/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/content-mgmt/PageHeader.astro +33 -52
- package/frontend/components/dashboard/content-mgmt/PageTypeHandler.astro +2 -2
- package/frontend/components/dashboard/profile/APITokens.astro +219 -158
- package/frontend/components/dashboard/profile/BasicInfo.astro +165 -106
- package/frontend/components/dashboard/profile/Notifications.astro +27 -18
- package/frontend/components/dashboard/profile/UpdatePassword.astro +134 -94
- package/frontend/components/dashboard/sidebar/VersionCheck.astro +31 -16
- package/frontend/components/dashboard/sidebar/VersionCheckChangelog.astro +18 -11
- package/frontend/components/dashboard/sidebar-modals/VersionModal.astro +2 -2
- package/frontend/components/dashboard/smtp-config/TemplateEditor.astro +14 -14
- package/frontend/components/dashboard/taxonomy/InnerSidebarElement.astro +0 -1
- package/frontend/components/dashboard/taxonomy/MetaContainer.astro +0 -2
- package/frontend/components/dashboard/taxonomy/PageHeader.astro +16 -24
- package/frontend/components/dashboard/taxonomy/TaxonomySearch.astro +23 -27
- package/frontend/components/dashboard/user-mgmt/InnerSidebarElement.astro +111 -104
- package/frontend/components/dashboard/user-mgmt/UserListItem.astro +9 -22
- package/frontend/components/dashboard/user-mgmt/UserListItems.astro +18 -0
- package/frontend/components/first-time-setup/snippets/{opt2-studiocms.config.diff → studiocms.config.diff} +1 -0
- package/frontend/components/shared/Code.astro +1 -4
- package/frontend/components/shared/DynamicSettingsRenderer.astro +1 -1
- package/frontend/components/shared/SSRUser.astro +2 -4
- package/frontend/components/shared/foldertree/FolderTreeNode.astro +0 -6
- package/frontend/components/shared/storage-manager/StorageCopyOutput.astro +0 -1
- package/frontend/components/shared/taxonomy/TaxonomyTreeNode.astro +0 -6
- package/frontend/layouts/DashboardLayout.astro +1 -10
- package/frontend/layouts/TaxonomyLayout.astro +0 -1
- package/frontend/middleware/index.ts +102 -61
- package/frontend/pages/404.astro +5 -9
- package/frontend/pages/[dashboard]/[...pluginPage].astro +10 -1
- package/frontend/pages/[dashboard]/configuration.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/createpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/diff.astro +39 -14
- package/frontend/pages/[dashboard]/content-management/editfolder.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/editpage.astro +10 -1
- package/frontend/pages/[dashboard]/content-management/index.astro +10 -1
- package/frontend/pages/[dashboard]/index.astro +10 -1
- package/frontend/pages/[dashboard]/login.astro +86 -25
- package/frontend/pages/[dashboard]/password-reset.astro +22 -16
- package/frontend/pages/[dashboard]/plugins/[plugin].astro +10 -1
- package/frontend/pages/[dashboard]/profile.astro +10 -1
- package/frontend/pages/[dashboard]/signup.astro +153 -52
- package/frontend/pages/[dashboard]/smtp-configuration.astro +77 -75
- package/frontend/pages/[dashboard]/system-management.astro +10 -1
- package/frontend/pages/[dashboard]/taxonomy/categories.astro +30 -41
- package/frontend/pages/[dashboard]/taxonomy/index.astro +10 -0
- package/frontend/pages/[dashboard]/taxonomy/tags.astro +33 -43
- package/frontend/pages/[dashboard]/unverified-email.astro +29 -21
- package/frontend/pages/[dashboard]/user-management/edit.astro +170 -90
- package/frontend/pages/[dashboard]/user-management/index.astro +10 -1
- package/frontend/pages/studiocms_api/[...all].ts +106 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/auth.ts +26 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/changelog.ts +147 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/db-studio-driver.ts +46 -0
- package/frontend/pages/studiocms_api/_handlers/_utils/parseLogLevel.ts +27 -0
- package/frontend/pages/studiocms_api/_handlers/auth/auth.ts +459 -0
- package/frontend/pages/studiocms_api/_handlers/auth/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/auth/oauth.ts +91 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/_shared.ts +57 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/apiTokens.ts +134 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/config.ts +64 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/content.ts +741 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/create.ts +480 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/emailNotifications.ts +49 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/index.ts +45 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/mailer.ts +136 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/plugins.ts +80 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/profile.ts +275 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/resetPassword.ts +140 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/search.ts +63 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/taxonomy.ts +285 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/templates.ts +75 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/users.ts +312 -0
- package/frontend/pages/studiocms_api/_handlers/dashboard/verifyEndpoints.ts +307 -0
- package/frontend/pages/studiocms_api/_handlers/integration/dbStudio.ts +98 -0
- package/frontend/pages/studiocms_api/_handlers/integration/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/integration/storageManager.ts +107 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/index.ts +8 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/_shared.ts +41 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/index.ts +17 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/public.ts +195 -0
- package/frontend/pages/studiocms_api/_handlers/rest-api/v1/secure.ts +1726 -0
- package/frontend/pages/studiocms_api/_handlers/sdk.ts +129 -0
- package/frontend/pages/studiocms_api/_middleware/astroLocals.ts +36 -0
- package/frontend/pages/studiocms_api/_middleware/restApi.ts +56 -0
- package/frontend/pages/studiocms_api/integrations/[...all].ts +8 -0
- package/frontend/scripts/formdata.ts +219 -0
- package/frontend/setup-pages/3-done.astro +4 -20
- package/frontend/setup-pages/studiocms_api/dashboard/step-2.ts +3 -6
- package/frontend/styles/dashboard-base.css +0 -1
- package/frontend/web-vitals/endpoint.ts +2 -1
- package/package.json +35 -31
- package/dist/global.d.ts +0 -9
- package/frontend/components/dashboard/LoginChecker.astro +0 -68
- package/frontend/components/dashboard/user-mgmt/RankCheck.astro +0 -57
- package/frontend/components/first-time-setup/snippets/opt1-astro.config.diff +0 -14
- package/frontend/components/first-time-setup/snippets/opt2-astro.config.diff +0 -9
- package/frontend/middleware/_authmap.ts +0 -63
- package/frontend/pages/studiocms_api/auth/[path].ts +0 -390
- package/frontend/pages/studiocms_api/auth/[provider]/[...id].ts +0 -64
- package/frontend/pages/studiocms_api/auth/[provider]/_effects/index.ts +0 -101
- package/frontend/pages/studiocms_api/auth/_shared.ts +0 -52
- package/frontend/pages/studiocms_api/dashboard/api-tokens.ts +0 -115
- package/frontend/pages/studiocms_api/dashboard/config.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/content/diff.ts +0 -73
- package/frontend/pages/studiocms_api/dashboard/content/folder.ts +0 -220
- package/frontend/pages/studiocms_api/dashboard/content/page.ts +0 -359
- package/frontend/pages/studiocms_api/dashboard/create-reset-link.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/create-user-invite.ts +0 -231
- package/frontend/pages/studiocms_api/dashboard/create-user.ts +0 -186
- package/frontend/pages/studiocms_api/dashboard/email-notification-settings-site.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/mailer/check-email.ts +0 -75
- package/frontend/pages/studiocms_api/dashboard/mailer/config.ts +0 -136
- package/frontend/pages/studiocms_api/dashboard/plugins/[plugin].ts +0 -80
- package/frontend/pages/studiocms_api/dashboard/profile.ts +0 -245
- package/frontend/pages/studiocms_api/dashboard/resend-verify-email.ts +0 -77
- package/frontend/pages/studiocms_api/dashboard/reset-password.ts +0 -124
- package/frontend/pages/studiocms_api/dashboard/search-list.ts +0 -59
- package/frontend/pages/studiocms_api/dashboard/taxonomy-search.ts +0 -47
- package/frontend/pages/studiocms_api/dashboard/taxonomy.ts +0 -230
- package/frontend/pages/studiocms_api/dashboard/templates.ts +0 -74
- package/frontend/pages/studiocms_api/dashboard/update-user-notifications.ts +0 -86
- package/frontend/pages/studiocms_api/dashboard/users.ts +0 -236
- package/frontend/pages/studiocms_api/dashboard/verify-email.ts +0 -83
- package/frontend/pages/studiocms_api/dashboard/verify-session.ts +0 -187
- package/frontend/pages/studiocms_api/integrations/[type]/[...id].ts +0 -15
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/db-studio.ts +0 -173
- package/frontend/pages/studiocms_api/integrations/[type]/_routes/storage.ts +0 -88
- package/frontend/pages/studiocms_api/partials/editor.astro +0 -74
- package/frontend/pages/studiocms_api/partials/render.astro +0 -39
- package/frontend/pages/studiocms_api/partials/user-list-items.astro +0 -43
- package/frontend/pages/studiocms_api/rest/utils/auth-token.ts +0 -59
- package/frontend/pages/studiocms_api/rest/v1/[type]/[...id].ts +0 -23
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/categories.ts +0 -267
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/folders.ts +0 -283
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/pages.ts +0 -505
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/settings.ts +0 -100
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/tags.ts +0 -229
- package/frontend/pages/studiocms_api/rest/v1/[type]/_routes/users.ts +0 -553
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/[...id].ts +0 -19
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/categories.ts +0 -74
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/folders.ts +0 -85
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/pages.ts +0 -103
- package/frontend/pages/studiocms_api/rest/v1/public/[type]/_routes/tags.ts +0 -67
- package/frontend/pages/studiocms_api/sdk/[...path].ts +0 -97
- package/frontend/pages/studiocms_api/sdk/utils/changelog.ts +0 -119
- package/frontend/scripts/auth/formListener.ts +0 -81
- package/frontend/scripts/formdata-utils.ts +0 -116
- package/frontend/utils/build-partial-schema.ts +0 -46
- package/frontend/utils/errors.ts +0 -6
- package/frontend/utils/param-extractor.ts +0 -83
- package/frontend/utils/rest-router.ts +0 -444
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type Messages } from '@withstudiocms/internal_helpers/astro-integration';
|
|
2
2
|
import type { AstroIntegration, InjectedRoute } from 'astro';
|
|
3
|
-
import { type
|
|
4
|
-
import type { StudioCMSConfig, StudioCMSPlugin, StudioCMSStorageManager } from '../schemas/index.js';
|
|
5
|
-
import type { PluginAugmentsTranslationCollection, PluginTranslationCollection } from '../schemas/plugins/i18n.js';
|
|
3
|
+
import { type StudioCMSConfig, type StudioCMSPlugin, type StudioCMSStorageManager } from '../schemas/index.js';
|
|
6
4
|
/**
|
|
7
5
|
* **Default StudioCMS Plugin**
|
|
8
6
|
*
|
|
@@ -28,10 +26,9 @@ type Options = {
|
|
|
28
26
|
dbStartPage: boolean;
|
|
29
27
|
verbose: boolean;
|
|
30
28
|
name: string;
|
|
31
|
-
pkgVersion: string;
|
|
32
29
|
plugins: StudioCMSPlugin[] | undefined;
|
|
33
30
|
storageManager: StudioCMSStorageManager | undefined;
|
|
34
|
-
robotsTXTConfig: boolean |
|
|
31
|
+
robotsTXTConfig: boolean | StudioCMSConfig['features']['robotsTXT'];
|
|
35
32
|
dashboardRoute: (path: string) => string;
|
|
36
33
|
webVitals: boolean;
|
|
37
34
|
dialect: StudioCMSConfig['db']['dialect'];
|
|
@@ -65,263 +62,43 @@ export declare const pluginHandler: import("astro-integration-kit").HookUtility<
|
|
|
65
62
|
}[];
|
|
66
63
|
extraRoutes: InjectedRoute[];
|
|
67
64
|
safePluginList: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
settingsPage?: {
|
|
71
|
-
fields: (
|
|
72
|
-
|
|
73
|
-
label: string;
|
|
74
|
-
input: "checkbox";
|
|
75
|
-
required?: boolean | undefined;
|
|
76
|
-
readOnly?: boolean | undefined;
|
|
77
|
-
color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined;
|
|
78
|
-
defaultChecked?: boolean | undefined;
|
|
79
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
80
|
-
} | {
|
|
81
|
-
name: string;
|
|
82
|
-
label: string;
|
|
83
|
-
input: "input";
|
|
84
|
-
type?: "number" | "password" | "text" | "email" | "tel" | "url" | "search" | undefined;
|
|
85
|
-
required?: boolean | undefined;
|
|
86
|
-
readOnly?: boolean | undefined;
|
|
87
|
-
placeholder?: string | undefined;
|
|
88
|
-
defaultValue?: string | undefined;
|
|
89
|
-
} | {
|
|
90
|
-
name: string;
|
|
91
|
-
label: string;
|
|
92
|
-
input: "textarea";
|
|
93
|
-
required?: boolean | undefined;
|
|
94
|
-
readOnly?: boolean | undefined;
|
|
95
|
-
placeholder?: string | undefined;
|
|
96
|
-
defaultValue?: string | undefined;
|
|
97
|
-
} | {
|
|
98
|
-
options: {
|
|
99
|
-
value: string;
|
|
100
|
-
label: string;
|
|
101
|
-
disabled?: boolean | undefined;
|
|
102
|
-
}[];
|
|
103
|
-
name: string;
|
|
104
|
-
label: string;
|
|
105
|
-
input: "radio";
|
|
106
|
-
required?: boolean | undefined;
|
|
107
|
-
readOnly?: boolean | undefined;
|
|
108
|
-
color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined;
|
|
109
|
-
defaultValue?: string | undefined;
|
|
110
|
-
direction?: "horizontal" | "vertical" | undefined;
|
|
111
|
-
} | {
|
|
112
|
-
options: {
|
|
113
|
-
value: string;
|
|
114
|
-
label: string;
|
|
115
|
-
disabled?: boolean | undefined;
|
|
116
|
-
}[];
|
|
117
|
-
name: string;
|
|
118
|
-
label: string;
|
|
119
|
-
input: "select";
|
|
120
|
-
type?: "search" | "basic" | undefined;
|
|
121
|
-
required?: boolean | undefined;
|
|
122
|
-
readOnly?: boolean | undefined;
|
|
123
|
-
placeholder?: string | undefined;
|
|
124
|
-
defaultValue?: string | undefined;
|
|
125
|
-
} | {
|
|
126
|
-
name: string;
|
|
127
|
-
label: string;
|
|
128
|
-
input: "row";
|
|
129
|
-
fields: ({
|
|
130
|
-
name: string;
|
|
131
|
-
label: string;
|
|
132
|
-
input: "checkbox";
|
|
133
|
-
required?: boolean | undefined;
|
|
134
|
-
readOnly?: boolean | undefined;
|
|
135
|
-
color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined;
|
|
136
|
-
defaultChecked?: boolean | undefined;
|
|
137
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
138
|
-
} | {
|
|
139
|
-
name: string;
|
|
140
|
-
label: string;
|
|
141
|
-
input: "input";
|
|
142
|
-
type?: "number" | "password" | "text" | "email" | "tel" | "url" | "search" | undefined;
|
|
143
|
-
required?: boolean | undefined;
|
|
144
|
-
readOnly?: boolean | undefined;
|
|
145
|
-
placeholder?: string | undefined;
|
|
146
|
-
defaultValue?: string | undefined;
|
|
147
|
-
} | {
|
|
148
|
-
name: string;
|
|
149
|
-
label: string;
|
|
150
|
-
input: "textarea";
|
|
151
|
-
required?: boolean | undefined;
|
|
152
|
-
readOnly?: boolean | undefined;
|
|
153
|
-
placeholder?: string | undefined;
|
|
154
|
-
defaultValue?: string | undefined;
|
|
155
|
-
} | {
|
|
156
|
-
options: {
|
|
157
|
-
value: string;
|
|
158
|
-
label: string;
|
|
159
|
-
disabled?: boolean | undefined;
|
|
160
|
-
}[];
|
|
161
|
-
name: string;
|
|
162
|
-
label: string;
|
|
163
|
-
input: "radio";
|
|
164
|
-
required?: boolean | undefined;
|
|
165
|
-
readOnly?: boolean | undefined;
|
|
166
|
-
color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined;
|
|
167
|
-
defaultValue?: string | undefined;
|
|
168
|
-
direction?: "horizontal" | "vertical" | undefined;
|
|
169
|
-
} | {
|
|
170
|
-
options: {
|
|
171
|
-
value: string;
|
|
172
|
-
label: string;
|
|
173
|
-
disabled?: boolean | undefined;
|
|
174
|
-
}[];
|
|
175
|
-
name: string;
|
|
176
|
-
label: string;
|
|
177
|
-
input: "select";
|
|
178
|
-
type?: "search" | "basic" | undefined;
|
|
179
|
-
required?: boolean | undefined;
|
|
180
|
-
readOnly?: boolean | undefined;
|
|
181
|
-
placeholder?: string | undefined;
|
|
182
|
-
defaultValue?: string | undefined;
|
|
183
|
-
})[];
|
|
184
|
-
required?: boolean | undefined;
|
|
185
|
-
readOnly?: boolean | undefined;
|
|
186
|
-
alignCenter?: boolean | undefined;
|
|
187
|
-
gapSize?: "sm" | "md" | "lg" | undefined;
|
|
188
|
-
})[];
|
|
189
|
-
endpoint: string;
|
|
65
|
+
readonly identifier: string;
|
|
66
|
+
readonly name: string;
|
|
67
|
+
readonly settingsPage?: {
|
|
68
|
+
readonly fields: readonly (import("../schemas/plugins/shared.js").CheckboxFieldSchema | import("../schemas/plugins/shared.js").TextInputFieldSchema | import("../schemas/plugins/shared.js").TextAreaFieldSchema | import("../schemas/plugins/shared.js").RadioGroupFieldSchema | import("../schemas/plugins/shared.js").SelectFieldSchema | import("../schemas/plugins/shared.js").RowFieldSchema)[];
|
|
69
|
+
readonly endpoint: string;
|
|
190
70
|
} | undefined;
|
|
191
|
-
frontendNavigationLinks?: {
|
|
192
|
-
label: string;
|
|
193
|
-
href: string;
|
|
71
|
+
readonly frontendNavigationLinks?: readonly {
|
|
72
|
+
readonly label: string;
|
|
73
|
+
readonly href: string;
|
|
194
74
|
}[] | undefined;
|
|
195
|
-
pageTypes?: {
|
|
196
|
-
|
|
197
|
-
identifier: string;
|
|
198
|
-
fields?: (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
readOnly?: boolean | undefined;
|
|
204
|
-
color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined;
|
|
205
|
-
defaultChecked?: boolean | undefined;
|
|
206
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
207
|
-
} | {
|
|
208
|
-
name: string;
|
|
209
|
-
label: string;
|
|
210
|
-
input: "input";
|
|
211
|
-
type?: "number" | "password" | "text" | "email" | "tel" | "url" | "search" | undefined;
|
|
212
|
-
required?: boolean | undefined;
|
|
213
|
-
readOnly?: boolean | undefined;
|
|
214
|
-
placeholder?: string | undefined;
|
|
215
|
-
defaultValue?: string | undefined;
|
|
216
|
-
} | {
|
|
217
|
-
name: string;
|
|
218
|
-
label: string;
|
|
219
|
-
input: "textarea";
|
|
220
|
-
required?: boolean | undefined;
|
|
221
|
-
readOnly?: boolean | undefined;
|
|
222
|
-
placeholder?: string | undefined;
|
|
223
|
-
defaultValue?: string | undefined;
|
|
224
|
-
} | {
|
|
225
|
-
options: {
|
|
226
|
-
value: string;
|
|
227
|
-
label: string;
|
|
228
|
-
disabled?: boolean | undefined;
|
|
229
|
-
}[];
|
|
230
|
-
name: string;
|
|
231
|
-
label: string;
|
|
232
|
-
input: "radio";
|
|
233
|
-
required?: boolean | undefined;
|
|
234
|
-
readOnly?: boolean | undefined;
|
|
235
|
-
color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined;
|
|
236
|
-
defaultValue?: string | undefined;
|
|
237
|
-
direction?: "horizontal" | "vertical" | undefined;
|
|
238
|
-
} | {
|
|
239
|
-
options: {
|
|
240
|
-
value: string;
|
|
241
|
-
label: string;
|
|
242
|
-
disabled?: boolean | undefined;
|
|
243
|
-
}[];
|
|
244
|
-
name: string;
|
|
245
|
-
label: string;
|
|
246
|
-
input: "select";
|
|
247
|
-
type?: "search" | "basic" | undefined;
|
|
248
|
-
required?: boolean | undefined;
|
|
249
|
-
readOnly?: boolean | undefined;
|
|
250
|
-
placeholder?: string | undefined;
|
|
251
|
-
defaultValue?: string | undefined;
|
|
252
|
-
} | {
|
|
253
|
-
name: string;
|
|
254
|
-
label: string;
|
|
255
|
-
input: "row";
|
|
256
|
-
fields: ({
|
|
257
|
-
name: string;
|
|
258
|
-
label: string;
|
|
259
|
-
input: "checkbox";
|
|
260
|
-
required?: boolean | undefined;
|
|
261
|
-
readOnly?: boolean | undefined;
|
|
262
|
-
color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined;
|
|
263
|
-
defaultChecked?: boolean | undefined;
|
|
264
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
265
|
-
} | {
|
|
266
|
-
name: string;
|
|
267
|
-
label: string;
|
|
268
|
-
input: "input";
|
|
269
|
-
type?: "number" | "password" | "text" | "email" | "tel" | "url" | "search" | undefined;
|
|
270
|
-
required?: boolean | undefined;
|
|
271
|
-
readOnly?: boolean | undefined;
|
|
272
|
-
placeholder?: string | undefined;
|
|
273
|
-
defaultValue?: string | undefined;
|
|
274
|
-
} | {
|
|
275
|
-
name: string;
|
|
276
|
-
label: string;
|
|
277
|
-
input: "textarea";
|
|
278
|
-
required?: boolean | undefined;
|
|
279
|
-
readOnly?: boolean | undefined;
|
|
280
|
-
placeholder?: string | undefined;
|
|
281
|
-
defaultValue?: string | undefined;
|
|
282
|
-
} | {
|
|
283
|
-
options: {
|
|
284
|
-
value: string;
|
|
285
|
-
label: string;
|
|
286
|
-
disabled?: boolean | undefined;
|
|
287
|
-
}[];
|
|
288
|
-
name: string;
|
|
289
|
-
label: string;
|
|
290
|
-
input: "radio";
|
|
291
|
-
required?: boolean | undefined;
|
|
292
|
-
readOnly?: boolean | undefined;
|
|
293
|
-
color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined;
|
|
294
|
-
defaultValue?: string | undefined;
|
|
295
|
-
direction?: "horizontal" | "vertical" | undefined;
|
|
296
|
-
} | {
|
|
297
|
-
options: {
|
|
298
|
-
value: string;
|
|
299
|
-
label: string;
|
|
300
|
-
disabled?: boolean | undefined;
|
|
301
|
-
}[];
|
|
302
|
-
name: string;
|
|
303
|
-
label: string;
|
|
304
|
-
input: "select";
|
|
305
|
-
type?: "search" | "basic" | undefined;
|
|
306
|
-
required?: boolean | undefined;
|
|
307
|
-
readOnly?: boolean | undefined;
|
|
308
|
-
placeholder?: string | undefined;
|
|
309
|
-
defaultValue?: string | undefined;
|
|
310
|
-
})[];
|
|
311
|
-
required?: boolean | undefined;
|
|
312
|
-
readOnly?: boolean | undefined;
|
|
313
|
-
alignCenter?: boolean | undefined;
|
|
314
|
-
gapSize?: "sm" | "md" | "lg" | undefined;
|
|
315
|
-
})[] | undefined;
|
|
316
|
-
description?: string | undefined;
|
|
317
|
-
pageContentComponent?: string | undefined;
|
|
318
|
-
rendererComponent?: string | undefined;
|
|
319
|
-
apiEndpoint?: string | undefined;
|
|
75
|
+
readonly pageTypes?: readonly {
|
|
76
|
+
readonly description?: string | undefined;
|
|
77
|
+
readonly identifier: string;
|
|
78
|
+
readonly fields?: readonly (import("../schemas/plugins/shared.js").CheckboxFieldSchema | import("../schemas/plugins/shared.js").TextInputFieldSchema | import("../schemas/plugins/shared.js").TextAreaFieldSchema | import("../schemas/plugins/shared.js").RadioGroupFieldSchema | import("../schemas/plugins/shared.js").SelectFieldSchema | import("../schemas/plugins/shared.js").RowFieldSchema)[] | undefined;
|
|
79
|
+
readonly label: string;
|
|
80
|
+
readonly pageContentComponent?: string | undefined;
|
|
81
|
+
readonly rendererComponent?: string | undefined;
|
|
82
|
+
readonly apiEndpoint?: string | undefined;
|
|
320
83
|
}[] | undefined;
|
|
321
84
|
}[];
|
|
322
85
|
messages: Messages;
|
|
323
86
|
oAuthProvidersConfigured: boolean;
|
|
324
|
-
pluginsTranslations:
|
|
325
|
-
|
|
87
|
+
pluginsTranslations: {
|
|
88
|
+
[x: string]: {
|
|
89
|
+
[x: string]: {
|
|
90
|
+
[x: string]: {
|
|
91
|
+
[x: string]: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
augmentTranslations: {
|
|
97
|
+
[x: string]: {
|
|
98
|
+
augments: {
|
|
99
|
+
[x: string]: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
326
103
|
}>>;
|
|
327
104
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cause, deepmerge, Effect, runEffect } from "@withstudiocms/effect";
|
|
1
|
+
import { Cause, deepmerge, Effect, runEffect, Schema } from "@withstudiocms/effect";
|
|
2
2
|
import {
|
|
3
3
|
integrationLogger,
|
|
4
4
|
pluginLogger
|
|
@@ -7,32 +7,30 @@ import createPathResolver from "@withstudiocms/internal_helpers/pathResolver";
|
|
|
7
7
|
import {
|
|
8
8
|
convertToSafeString,
|
|
9
9
|
pageContentComponentFilter,
|
|
10
|
-
readJson,
|
|
11
10
|
rendererComponentFilter
|
|
12
11
|
} from "@withstudiocms/internal_helpers/utils";
|
|
13
12
|
import { AstroError } from "astro/errors";
|
|
14
13
|
import { addVirtualImports, defineUtility } from "astro-integration-kit";
|
|
15
14
|
import boxen from "boxen";
|
|
16
|
-
import { compare as semCompare } from "semver";
|
|
17
15
|
import { loadEnv } from "vite";
|
|
18
16
|
import { StudioCMSDefaultRobotsConfig } from "../consts.js";
|
|
19
17
|
import { StudioCMSError } from "../errors.js";
|
|
20
18
|
import { dynamicSitemap, robotsTXT } from "../integrations/plugins.js";
|
|
21
19
|
import { studioCMSAnalyticsPlugin } from "../plugins/analytics/index.js";
|
|
20
|
+
import {
|
|
21
|
+
StudioCMSPluginSchema,
|
|
22
|
+
StudioCMSStorageManagerSchema
|
|
23
|
+
} from "../schemas/index.js";
|
|
22
24
|
import { buildTranslations, loadJsTranslations } from "../utils/lang-helper.js";
|
|
23
25
|
import { NoOpStorageManager } from "./storage-manager/no-op.js";
|
|
24
26
|
const { resolve } = createPathResolver(import.meta.url);
|
|
25
|
-
const { version: pkgVersion } = readJson(
|
|
26
|
-
resolve("../../package.json")
|
|
27
|
-
);
|
|
28
27
|
const translations = await loadJsTranslations("./plugin-i18n", import.meta.url);
|
|
29
28
|
const t = await buildTranslations(translations);
|
|
30
29
|
const defaultPlugin = {
|
|
31
30
|
name: "Core (built-in)",
|
|
32
31
|
identifier: "studiocms",
|
|
33
|
-
studiocmsMinimumVersion: pkgVersion,
|
|
34
32
|
hooks: {
|
|
35
|
-
"studiocms:dashboard": ({ setDashboard }) => {
|
|
33
|
+
"studiocms:dashboard": async ({ setDashboard }) => {
|
|
36
34
|
setDashboard({
|
|
37
35
|
translations,
|
|
38
36
|
dashboardGridItems: [
|
|
@@ -134,7 +132,6 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
134
132
|
dbStartPage,
|
|
135
133
|
verbose,
|
|
136
134
|
name,
|
|
137
|
-
pkgVersion: pkgVersion2,
|
|
138
135
|
plugins,
|
|
139
136
|
storageManager,
|
|
140
137
|
robotsTXTConfig,
|
|
@@ -155,6 +152,8 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
155
152
|
const pluginEndpoints = [];
|
|
156
153
|
const pluginRenderers = [];
|
|
157
154
|
const pluginAugments = [];
|
|
155
|
+
const postProcessorAugments = [];
|
|
156
|
+
const pluginPostProcessors = [];
|
|
158
157
|
const safePluginList = [];
|
|
159
158
|
const extraRoutes = [];
|
|
160
159
|
const messages = [];
|
|
@@ -178,10 +177,11 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
178
177
|
}) {
|
|
179
178
|
const pLogger = pluginLogger(safeData.identifier, logger);
|
|
180
179
|
return async (hook, args) => {
|
|
181
|
-
|
|
180
|
+
const hookFunction = hooks[hook];
|
|
181
|
+
if (typeof hookFunction === "function") {
|
|
182
182
|
return await runEffect(
|
|
183
183
|
Effect.tryPromise(
|
|
184
|
-
async () => await
|
|
184
|
+
async () => await hookFunction({
|
|
185
185
|
// biome-ignore lint/suspicious/noExplicitAny: needed for dynamic hook args
|
|
186
186
|
...args,
|
|
187
187
|
logger: pLogger
|
|
@@ -242,21 +242,21 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
242
242
|
const pluginsToProcess = [defaultPlugin];
|
|
243
243
|
if (webVitals)
|
|
244
244
|
pluginsToProcess.push(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
245
|
+
Schema.decodeSync(StudioCMSPluginSchema)(
|
|
246
|
+
studioCMSAnalyticsPlugin({
|
|
247
|
+
driverDialect: dialect
|
|
248
|
+
})
|
|
249
|
+
)
|
|
249
250
|
);
|
|
250
251
|
if (plugins) pluginsToProcess.push(...plugins);
|
|
251
252
|
return pluginsToProcess;
|
|
252
253
|
}
|
|
253
254
|
function splitStorageManager(manager) {
|
|
254
|
-
const { hooks,
|
|
255
|
+
const { hooks, requires, ...shared } = manager;
|
|
255
256
|
const { "studiocms:storage-manager": storageManagerHook, ...pluginHooks } = hooks;
|
|
256
257
|
const plugin = {
|
|
257
258
|
...shared,
|
|
258
259
|
hooks: pluginHooks,
|
|
259
|
-
studiocmsMinimumVersion,
|
|
260
260
|
requires
|
|
261
261
|
};
|
|
262
262
|
const storageManager2 = {
|
|
@@ -271,29 +271,14 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
271
271
|
if (storageManager) {
|
|
272
272
|
manager = storageManager;
|
|
273
273
|
} else {
|
|
274
|
-
manager = NoOpStorageManager(
|
|
274
|
+
manager = Schema.decodeSync(StudioCMSStorageManagerSchema)(NoOpStorageManager());
|
|
275
275
|
}
|
|
276
276
|
const { smManager, smPlugin } = splitStorageManager(manager);
|
|
277
277
|
pluginsToProcess.push(smPlugin);
|
|
278
278
|
return { pluginsToProcess, storageManager: smManager };
|
|
279
279
|
}
|
|
280
280
|
function getPluginData(plugin) {
|
|
281
|
-
const {
|
|
282
|
-
let comparison;
|
|
283
|
-
try {
|
|
284
|
-
comparison = semCompare(studiocmsMinimumVersion, pkgVersion2);
|
|
285
|
-
} catch (_error) {
|
|
286
|
-
throw new StudioCMSError(
|
|
287
|
-
`Plugin ${safeData.name} has invalid version requirement: ${studiocmsMinimumVersion}`,
|
|
288
|
-
"The minimum version requirement must be a valid semver string."
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
if (comparison === 1) {
|
|
292
|
-
throw new StudioCMSError(
|
|
293
|
-
`Plugin ${safeData.name} requires StudioCMS version ${studiocmsMinimumVersion} or higher.`,
|
|
294
|
-
`Plugin ${safeData.name} requires StudioCMS version ${studiocmsMinimumVersion} or higher. Please update StudioCMS to the required version, contact the plugin author to update the minimum version requirement or remove the plugin from the StudioCMS config.`
|
|
295
|
-
);
|
|
296
|
-
}
|
|
281
|
+
const { hooks = {}, requires, ...safeData } = plugin;
|
|
297
282
|
return {
|
|
298
283
|
hooks,
|
|
299
284
|
requires,
|
|
@@ -356,11 +341,23 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
356
341
|
const safeId = convertToSafeString(id);
|
|
357
342
|
const type = augment.type;
|
|
358
343
|
const components = {};
|
|
359
|
-
if (augment.components) {
|
|
344
|
+
if ("components" in augment && augment.components) {
|
|
360
345
|
for (const [key, value] of Object.entries(augment.components)) {
|
|
361
346
|
components[key] = rendererComponentFilter(value, convertToSafeString(safeId + key));
|
|
362
347
|
}
|
|
363
348
|
}
|
|
349
|
+
if (type === "post-processor") {
|
|
350
|
+
return {
|
|
351
|
+
id,
|
|
352
|
+
safeId,
|
|
353
|
+
type,
|
|
354
|
+
components,
|
|
355
|
+
postProcessor: rendererComponentFilter(
|
|
356
|
+
augment.postProcessor,
|
|
357
|
+
convertToSafeString(`${safeId}postProcessor`)
|
|
358
|
+
)
|
|
359
|
+
};
|
|
360
|
+
}
|
|
364
361
|
if (type === "component") {
|
|
365
362
|
return {
|
|
366
363
|
id,
|
|
@@ -377,7 +374,7 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
377
374
|
const { pluginsToProcess, storageManager: storageManager2 } = getPluginsAndStorageManager();
|
|
378
375
|
const smHookRunner = runSMHook(storageManager2);
|
|
379
376
|
await smHookRunner({
|
|
380
|
-
setStorageManager({ managerPath }) {
|
|
377
|
+
async setStorageManager({ managerPath }) {
|
|
381
378
|
if (managerPath) {
|
|
382
379
|
finalStorageManagerModulePath = managerPath;
|
|
383
380
|
finalStorageManagerName = storageManager2.name;
|
|
@@ -388,7 +385,7 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
388
385
|
const { hooks, requires, safeData } = getPluginData(plugin);
|
|
389
386
|
const hookRunner = runHook({ hooks, safeData });
|
|
390
387
|
await hookRunner("studiocms:auth", {
|
|
391
|
-
setAuthService({ oAuthProvider }) {
|
|
388
|
+
async setAuthService({ oAuthProvider }) {
|
|
392
389
|
if (oAuthProvider)
|
|
393
390
|
registerOAuthProvider(oAuthProvider, messages, unInjectedAuthProviders);
|
|
394
391
|
}
|
|
@@ -451,7 +448,7 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
451
448
|
const { pluginsToProcess, storageManager: storageManager2 } = getPluginsAndStorageManager();
|
|
452
449
|
const smHookRunner = runSMHook(storageManager2);
|
|
453
450
|
await smHookRunner({
|
|
454
|
-
setStorageManager({ managerPath }) {
|
|
451
|
+
async setStorageManager({ managerPath }) {
|
|
455
452
|
if (managerPath) {
|
|
456
453
|
finalStorageManagerModulePath = managerPath;
|
|
457
454
|
finalStorageManagerName = storageManager2.name;
|
|
@@ -465,7 +462,7 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
465
462
|
let foundPageTypes;
|
|
466
463
|
const hookRunner = runHook({ hooks, safeData });
|
|
467
464
|
await hookRunner("studiocms:astro-config", {
|
|
468
|
-
addIntegrations(integration) {
|
|
465
|
+
async addIntegrations(integration) {
|
|
469
466
|
if (integration) {
|
|
470
467
|
if (Array.isArray(integration)) {
|
|
471
468
|
integrations.push(...integration.map((integration2) => ({ integration: integration2 })));
|
|
@@ -476,7 +473,7 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
476
473
|
}
|
|
477
474
|
});
|
|
478
475
|
await hookRunner("studiocms:auth", {
|
|
479
|
-
setAuthService({ oAuthProvider }) {
|
|
476
|
+
async setAuthService({ oAuthProvider }) {
|
|
480
477
|
if (oAuthProvider)
|
|
481
478
|
registerOAuthProvider(oAuthProvider, messages, unInjectedAuthProviders);
|
|
482
479
|
}
|
|
@@ -537,7 +534,7 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
537
534
|
foundSettingsPage = settingsPage;
|
|
538
535
|
}
|
|
539
536
|
},
|
|
540
|
-
augmentDashboard({ components, scripts }) {
|
|
537
|
+
async augmentDashboard({ components, scripts }) {
|
|
541
538
|
if (components !== void 0) {
|
|
542
539
|
const fixed = Object.entries(components).reduce(
|
|
543
540
|
(acc, [compKey, compPath]) => {
|
|
@@ -557,7 +554,7 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
557
554
|
}
|
|
558
555
|
});
|
|
559
556
|
await hookRunner("studiocms:sitemap", {
|
|
560
|
-
setSitemap({ sitemaps: pluginSitemaps, triggerSitemap }) {
|
|
557
|
+
async setSitemap({ sitemaps: pluginSitemaps, triggerSitemap }) {
|
|
561
558
|
if (triggerSitemap) sitemapEnabled = triggerSitemap;
|
|
562
559
|
if (pluginSitemaps) {
|
|
563
560
|
sitemaps.push(...pluginSitemaps);
|
|
@@ -565,14 +562,14 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
565
562
|
}
|
|
566
563
|
});
|
|
567
564
|
await hookRunner("studiocms:frontend", {
|
|
568
|
-
setFrontend({ frontendNavigationLinks }) {
|
|
565
|
+
async setFrontend({ frontendNavigationLinks }) {
|
|
569
566
|
if (frontendNavigationLinks) {
|
|
570
567
|
foundFrontendNavigationLinks = frontendNavigationLinks;
|
|
571
568
|
}
|
|
572
569
|
}
|
|
573
570
|
});
|
|
574
571
|
await hookRunner("studiocms:rendering", {
|
|
575
|
-
setRendering({ pageTypes, augments }) {
|
|
572
|
+
async setRendering({ pageTypes, augments, postProcessor }) {
|
|
576
573
|
for (const { apiEndpoint, identifier, rendererComponent } of pageTypes || []) {
|
|
577
574
|
if (apiEndpoint) {
|
|
578
575
|
pluginEndpoints.push({
|
|
@@ -601,12 +598,26 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
601
598
|
foundPageTypes = pageTypes;
|
|
602
599
|
for (const augment of augments || []) {
|
|
603
600
|
const runtimeAugment = convertToRuntimeAugment(augment);
|
|
604
|
-
|
|
601
|
+
if (runtimeAugment.type === "post-processor") {
|
|
602
|
+
postProcessorAugments.push(runtimeAugment);
|
|
603
|
+
} else {
|
|
604
|
+
pluginAugments.push(runtimeAugment);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (postProcessor) {
|
|
608
|
+
pluginPostProcessors.push({
|
|
609
|
+
id: postProcessor.id,
|
|
610
|
+
safeId: convertToSafeString(postProcessor.id),
|
|
611
|
+
postProcessor: rendererComponentFilter(
|
|
612
|
+
postProcessor.postProcessor,
|
|
613
|
+
convertToSafeString(`${postProcessor.id}postProcessor`)
|
|
614
|
+
)
|
|
615
|
+
});
|
|
605
616
|
}
|
|
606
617
|
}
|
|
607
618
|
});
|
|
608
619
|
await hookRunner("studiocms:image-service", {
|
|
609
|
-
setImageService({ imageService }) {
|
|
620
|
+
async setImageService({ imageService }) {
|
|
610
621
|
if (imageService) {
|
|
611
622
|
imageServiceKeys.push({
|
|
612
623
|
identifier: imageService.identifier,
|
|
@@ -853,19 +864,45 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
853
864
|
export const pluginRenderers = ${JSON.stringify(pluginRenderers.map(({ pageType, safePageType }) => ({ pageType, safePageType })) || [])};
|
|
854
865
|
`
|
|
855
866
|
},
|
|
867
|
+
{
|
|
868
|
+
id: "virtual:studiocms/plugins/post-processors",
|
|
869
|
+
content: pluginPostProcessors.map(({ postProcessor }) => postProcessor).join("\n")
|
|
870
|
+
},
|
|
871
|
+
{
|
|
872
|
+
id: "studiocms:plugins/post-processors",
|
|
873
|
+
content: `
|
|
874
|
+
import * as postProcessors from 'virtual:studiocms/plugins/post-processors';
|
|
875
|
+
|
|
876
|
+
const pluginPostProcessors = ${JSON.stringify(pluginPostProcessors.map(({ id, safeId }) => ({ id, safeId })) || [])};
|
|
877
|
+
|
|
878
|
+
export const renderPostProcessors = pluginPostProcessors.map(({ id, safeId }) => ({
|
|
879
|
+
id,
|
|
880
|
+
safeId,
|
|
881
|
+
postProcessor: postProcessors[safeId + 'postProcessor'],
|
|
882
|
+
}));
|
|
883
|
+
`
|
|
884
|
+
},
|
|
856
885
|
{
|
|
857
886
|
id: "virtual:studiocms/plugins/augments",
|
|
858
887
|
content: [...pluginAugments].map(
|
|
859
888
|
({ components }) => Object.entries(components).map(([_key, value]) => value).join("\n")
|
|
860
889
|
).join("\n")
|
|
861
890
|
},
|
|
891
|
+
{
|
|
892
|
+
id: "virtual:studiocms/plugins/post-processor-augments",
|
|
893
|
+
content: postProcessorAugments.map(({ postProcessor }) => postProcessor).join("\n")
|
|
894
|
+
},
|
|
862
895
|
{
|
|
863
896
|
id: "studiocms:plugins/augments",
|
|
864
897
|
content: `
|
|
865
898
|
import * as augments from 'virtual:studiocms/plugins/augments';
|
|
899
|
+
import * as postProcessorAugments from 'virtual:studiocms/plugins/post-processor-augments';
|
|
866
900
|
import { convertToSafeString } from '${resolve("../utils/safeString.js")}';
|
|
867
901
|
|
|
868
902
|
const pluginAugments = ${JSON.stringify(pluginAugments || [])};
|
|
903
|
+
const postProcessorPluginAugments = ${JSON.stringify(postProcessorAugments || [])};
|
|
904
|
+
|
|
905
|
+
export const renderAugmentsList = [...pluginAugments, ...postProcessorPluginAugments].map(({ id, safeId }) => ({ id, safeId }));
|
|
869
906
|
|
|
870
907
|
export const renderAugments = pluginAugments.map((entry) => {
|
|
871
908
|
const { id, safeId, type, components } = entry;
|
|
@@ -889,6 +926,15 @@ const pluginHandler = defineUtility("astro:config:setup")(
|
|
|
889
926
|
}), {}),
|
|
890
927
|
};
|
|
891
928
|
});
|
|
929
|
+
|
|
930
|
+
export const renderPostProcessorAugments = postProcessorPluginAugments.map((entry) => {
|
|
931
|
+
const { id, safeId, type, postProcessor } = entry;
|
|
932
|
+
return {
|
|
933
|
+
id,
|
|
934
|
+
type,
|
|
935
|
+
postProcessor: postProcessorAugments[convertToSafeString(safeId + 'postProcessor')],
|
|
936
|
+
};
|
|
937
|
+
});
|
|
892
938
|
`
|
|
893
939
|
},
|
|
894
940
|
{
|