@conloca/astro-cms 0.1.15 → 0.2.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/README.md +259 -247
- package/dist/internal/acorn-default.mjs +11 -3
- package/dist/internal/page-handler.astro +137 -358
- package/dist/ts/node/content.d.ts +4 -0
- package/dist/ts/node/content.d.ts.map +1 -0
- package/dist/ts/node/content.js +3 -0
- package/dist/ts/node/content.js.map +1 -0
- package/dist/ts/node/index.d.ts +9 -0
- package/dist/ts/node/index.d.ts.map +1 -0
- package/dist/ts/node/index.js +14 -0
- package/dist/ts/node/index.js.map +1 -0
- package/dist/ts/src/asset-ref-base.d.ts +3 -0
- package/dist/ts/src/asset-ref-base.d.ts.map +1 -0
- package/dist/ts/src/asset-ref-base.js +48 -0
- package/dist/ts/src/asset-ref-base.js.map +1 -0
- package/dist/ts/src/checks.d.ts +7 -0
- package/dist/ts/src/checks.d.ts.map +1 -0
- package/dist/ts/src/checks.js +7 -0
- package/dist/ts/src/checks.js.map +1 -0
- package/dist/ts/src/cms-handler.d.ts +18 -0
- package/dist/ts/src/cms-handler.d.ts.map +1 -0
- package/dist/ts/src/cms-handler.js +245 -0
- package/dist/ts/src/cms-handler.js.map +1 -0
- package/dist/ts/src/collections.d.ts +160 -0
- package/dist/ts/src/collections.d.ts.map +1 -0
- package/dist/ts/src/collections.js +170 -0
- package/dist/ts/src/collections.js.map +1 -0
- package/dist/ts/src/components/HydrationWrapper.d.ts +18 -0
- package/dist/ts/src/components/HydrationWrapper.d.ts.map +1 -0
- package/dist/ts/src/components/HydrationWrapper.js +22 -0
- package/dist/ts/src/components/HydrationWrapper.js.map +1 -0
- package/dist/ts/src/components/RenderWithFragments.d.ts +27 -0
- package/dist/ts/src/components/RenderWithFragments.d.ts.map +1 -0
- package/dist/ts/src/components/RenderWithFragments.js +133 -0
- package/dist/ts/src/components/RenderWithFragments.js.map +1 -0
- package/dist/ts/src/components/RenderWithHydration.d.ts +21 -0
- package/dist/ts/src/components/RenderWithHydration.d.ts.map +1 -0
- package/dist/ts/src/components/RenderWithHydration.js +39 -0
- package/dist/ts/src/components/RenderWithHydration.js.map +1 -0
- package/dist/ts/src/components.d.ts +4 -0
- package/dist/ts/src/components.d.ts.map +1 -0
- package/dist/ts/src/components.js +4 -0
- package/dist/ts/src/components.js.map +1 -0
- package/dist/ts/src/discovery/astro-frontmatter.d.ts +18 -0
- package/dist/ts/src/discovery/astro-frontmatter.d.ts.map +1 -0
- package/dist/ts/src/discovery/astro-frontmatter.js +25 -0
- package/dist/ts/src/discovery/astro-frontmatter.js.map +1 -0
- package/dist/ts/src/discovery/discover.d.ts +43 -0
- package/dist/ts/src/discovery/discover.d.ts.map +1 -0
- package/dist/ts/src/discovery/discover.js +87 -0
- package/dist/ts/src/discovery/discover.js.map +1 -0
- package/dist/ts/src/discovery/extract-props-ts.d.ts +41 -0
- package/dist/ts/src/discovery/extract-props-ts.d.ts.map +1 -0
- package/dist/ts/src/discovery/extract-props-ts.js +232 -0
- package/dist/ts/src/discovery/extract-props-ts.js.map +1 -0
- package/dist/ts/src/discovery/merge-registry.d.ts +58 -0
- package/dist/ts/src/discovery/merge-registry.d.ts.map +1 -0
- package/dist/ts/src/discovery/merge-registry.js +333 -0
- package/dist/ts/src/discovery/merge-registry.js.map +1 -0
- package/dist/ts/src/discovery/registry-endpoint.d.ts +27 -0
- package/dist/ts/src/discovery/registry-endpoint.d.ts.map +1 -0
- package/dist/ts/src/discovery/registry-endpoint.js +76 -0
- package/dist/ts/src/discovery/registry-endpoint.js.map +1 -0
- package/dist/ts/src/discovery/scan-components.d.ts +94 -0
- package/dist/ts/src/discovery/scan-components.d.ts.map +1 -0
- package/dist/ts/src/discovery/scan-components.js +397 -0
- package/dist/ts/src/discovery/scan-components.js.map +1 -0
- package/dist/ts/src/discovery/scan-mdx.d.ts +63 -0
- package/dist/ts/src/discovery/scan-mdx.d.ts.map +1 -0
- package/dist/ts/src/discovery/scan-mdx.js +113 -0
- package/dist/ts/src/discovery/scan-mdx.js.map +1 -0
- package/dist/ts/src/discovery/scan-overrides.d.ts +71 -0
- package/dist/ts/src/discovery/scan-overrides.d.ts.map +1 -0
- package/dist/ts/src/discovery/scan-overrides.js +34 -0
- package/dist/ts/src/discovery/scan-overrides.js.map +1 -0
- package/dist/ts/src/editor-descriptors.d.ts +31 -0
- package/dist/ts/src/editor-descriptors.d.ts.map +1 -0
- package/dist/ts/src/editor-descriptors.js +84 -0
- package/dist/ts/src/editor-descriptors.js.map +1 -0
- package/dist/ts/src/handlers/collection-content-api.d.ts +32 -0
- package/dist/ts/src/handlers/collection-content-api.d.ts.map +1 -0
- package/dist/ts/src/handlers/collection-content-api.js +166 -0
- package/dist/ts/src/handlers/collection-content-api.js.map +1 -0
- package/dist/ts/src/handlers/page-render-core.d.ts +137 -0
- package/dist/ts/src/handlers/page-render-core.d.ts.map +1 -0
- package/dist/ts/src/handlers/page-render-core.js +315 -0
- package/dist/ts/src/handlers/page-render-core.js.map +1 -0
- package/dist/ts/src/hydration.d.ts +4 -0
- package/dist/ts/src/hydration.d.ts.map +1 -0
- package/dist/ts/src/hydration.js +5 -0
- package/dist/ts/src/hydration.js.map +1 -0
- package/dist/ts/src/index.d.ts +21 -0
- package/dist/ts/src/index.d.ts.map +1 -0
- package/dist/ts/src/index.js +45 -0
- package/dist/ts/src/index.js.map +1 -0
- package/dist/ts/src/internal/declared-collections.d.ts +30 -0
- package/dist/ts/src/internal/declared-collections.d.ts.map +1 -0
- package/dist/ts/src/internal/declared-collections.js +84 -0
- package/dist/ts/src/internal/declared-collections.js.map +1 -0
- package/dist/ts/src/internal/page-collection-schema.d.ts +44 -0
- package/dist/ts/src/internal/page-collection-schema.d.ts.map +1 -0
- package/dist/ts/src/internal/page-collection-schema.js +152 -0
- package/dist/ts/src/internal/page-collection-schema.js.map +1 -0
- package/dist/ts/src/lib/content-config-guard.d.ts +11 -0
- package/dist/ts/src/lib/content-config-guard.d.ts.map +1 -0
- package/dist/ts/src/lib/content-config-guard.js +41 -0
- package/dist/ts/src/lib/content-config-guard.js.map +1 -0
- package/dist/ts/src/lib/hydration-scanner.d.ts +47 -0
- package/dist/ts/src/lib/hydration-scanner.d.ts.map +1 -0
- package/dist/ts/src/lib/hydration-scanner.js +136 -0
- package/dist/ts/src/lib/hydration-scanner.js.map +1 -0
- package/dist/{lib/hydration-script.d.mts → ts/src/lib/hydration-script.d.ts} +7 -10
- package/dist/ts/src/lib/hydration-script.d.ts.map +1 -0
- package/dist/ts/src/lib/hydration-script.js +89 -0
- package/dist/ts/src/lib/hydration-script.js.map +1 -0
- package/dist/ts/src/lib/hydration-utils.d.ts +51 -0
- package/dist/ts/src/lib/hydration-utils.d.ts.map +1 -0
- package/dist/ts/src/lib/hydration-utils.js +84 -0
- package/dist/ts/src/lib/hydration-utils.js.map +1 -0
- package/dist/ts/src/lib/resolve-locale.d.ts +15 -0
- package/dist/ts/src/lib/resolve-locale.d.ts.map +1 -0
- package/dist/ts/src/lib/resolve-locale.js +16 -0
- package/dist/ts/src/lib/resolve-locale.js.map +1 -0
- package/dist/ts/src/lib/resolve-site-name.d.ts +8 -0
- package/dist/ts/src/lib/resolve-site-name.d.ts.map +1 -0
- package/dist/ts/src/lib/resolve-site-name.js +12 -0
- package/dist/ts/src/lib/resolve-site-name.js.map +1 -0
- package/dist/ts/src/lib/route-utils.d.ts +61 -0
- package/dist/ts/src/lib/route-utils.d.ts.map +1 -0
- package/dist/ts/src/lib/route-utils.js +96 -0
- package/dist/ts/src/lib/route-utils.js.map +1 -0
- package/dist/ts/src/lib/routing-config.d.ts +38 -0
- package/dist/ts/src/lib/routing-config.d.ts.map +1 -0
- package/dist/ts/src/lib/routing-config.js +106 -0
- package/dist/ts/src/lib/routing-config.js.map +1 -0
- package/dist/ts/src/lib/serialize-props.d.ts +6 -0
- package/dist/ts/src/lib/serialize-props.d.ts.map +1 -0
- package/dist/ts/src/lib/serialize-props.js +8 -0
- package/dist/ts/src/lib/serialize-props.js.map +1 -0
- package/dist/ts/src/lib/unknown-components.d.ts +21 -0
- package/dist/ts/src/lib/unknown-components.d.ts.map +1 -0
- package/dist/ts/src/lib/unknown-components.js +49 -0
- package/dist/ts/src/lib/unknown-components.js.map +1 -0
- package/dist/ts/src/lib/virtual-module-generators.d.ts +33 -0
- package/dist/ts/src/lib/virtual-module-generators.d.ts.map +1 -0
- package/dist/ts/src/lib/virtual-module-generators.js +51 -0
- package/dist/ts/src/lib/virtual-module-generators.js.map +1 -0
- package/dist/{withHydration-HIvO9ysY.d.mts → ts/src/lib/withHydration.d.ts} +7 -11
- package/dist/ts/src/lib/withHydration.d.ts.map +1 -0
- package/dist/ts/src/lib/withHydration.js +50 -0
- package/dist/ts/src/lib/withHydration.js.map +1 -0
- package/dist/ts/src/loader.d.ts +27 -0
- package/dist/ts/src/loader.d.ts.map +1 -0
- package/dist/ts/src/loader.js +118 -0
- package/dist/ts/src/loader.js.map +1 -0
- package/dist/ts/src/locales-helpers.d.ts +61 -0
- package/dist/ts/src/locales-helpers.d.ts.map +1 -0
- package/dist/ts/src/locales-helpers.js +50 -0
- package/dist/ts/src/locales-helpers.js.map +1 -0
- package/dist/ts/src/mime-types.d.ts +3 -0
- package/dist/ts/src/mime-types.d.ts.map +1 -0
- package/dist/ts/src/mime-types.js +20 -0
- package/dist/ts/src/mime-types.js.map +1 -0
- package/dist/ts/src/page-feed.d.ts +13 -0
- package/dist/ts/src/page-feed.d.ts.map +1 -0
- package/dist/ts/src/page-feed.js +20 -0
- package/dist/ts/src/page-feed.js.map +1 -0
- package/dist/ts/src/page-schemas.d.ts +6 -0
- package/dist/ts/src/page-schemas.d.ts.map +1 -0
- package/dist/ts/src/page-schemas.js +6 -0
- package/dist/ts/src/page-schemas.js.map +1 -0
- package/dist/ts/src/path-validation.d.ts +8 -0
- package/dist/ts/src/path-validation.d.ts.map +1 -0
- package/dist/ts/src/path-validation.js +13 -0
- package/dist/ts/src/path-validation.js.map +1 -0
- package/dist/ts/src/plugin-spa.d.ts +182 -0
- package/dist/ts/src/plugin-spa.d.ts.map +1 -0
- package/dist/ts/src/plugin-spa.js +1165 -0
- package/dist/ts/src/plugin-spa.js.map +1 -0
- package/dist/ts/src/puck-manifest/components-endpoint.d.ts +30 -0
- package/dist/ts/src/puck-manifest/components-endpoint.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/components-endpoint.js +54 -0
- package/dist/ts/src/puck-manifest/components-endpoint.js.map +1 -0
- package/dist/ts/src/puck-manifest/field-projection.d.ts +91 -0
- package/dist/ts/src/puck-manifest/field-projection.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/field-projection.js +422 -0
- package/dist/ts/src/puck-manifest/field-projection.js.map +1 -0
- package/dist/ts/src/puck-manifest/index.d.ts +4 -0
- package/dist/ts/src/puck-manifest/index.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/index.js +3 -0
- package/dist/ts/src/puck-manifest/index.js.map +1 -0
- package/dist/ts/src/puck-manifest/literal.d.ts +163 -0
- package/dist/ts/src/puck-manifest/literal.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/literal.js +354 -0
- package/dist/ts/src/puck-manifest/literal.js.map +1 -0
- package/dist/ts/src/puck-manifest/read-config.d.ts +42 -0
- package/dist/ts/src/puck-manifest/read-config.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/read-config.js +517 -0
- package/dist/ts/src/puck-manifest/read-config.js.map +1 -0
- package/dist/ts/src/puck-manifest/read-field.d.ts +7 -0
- package/dist/ts/src/puck-manifest/read-field.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/read-field.js +11 -0
- package/dist/ts/src/puck-manifest/read-field.js.map +1 -0
- package/dist/ts/src/puck-manifest/read-wrapper.d.ts +147 -0
- package/dist/ts/src/puck-manifest/read-wrapper.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/read-wrapper.js +889 -0
- package/dist/ts/src/puck-manifest/read-wrapper.js.map +1 -0
- package/dist/ts/src/puck-manifest/reading-budget.d.ts +50 -0
- package/dist/ts/src/puck-manifest/reading-budget.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/reading-budget.js +113 -0
- package/dist/ts/src/puck-manifest/reading-budget.js.map +1 -0
- package/dist/ts/src/puck-manifest/resolve-reference.d.ts +4 -0
- package/dist/ts/src/puck-manifest/resolve-reference.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/resolve-reference.js +4 -0
- package/dist/ts/src/puck-manifest/resolve-reference.js.map +1 -0
- package/dist/ts/src/puck-manifest/source-reference.d.ts +96 -0
- package/dist/ts/src/puck-manifest/source-reference.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/source-reference.js +424 -0
- package/dist/ts/src/puck-manifest/source-reference.js.map +1 -0
- package/dist/ts/src/puck-manifest/syntax.d.ts +29 -0
- package/dist/ts/src/puck-manifest/syntax.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/syntax.js +79 -0
- package/dist/ts/src/puck-manifest/syntax.js.map +1 -0
- package/dist/ts/src/puck-manifest/types.d.ts +145 -0
- package/dist/ts/src/puck-manifest/types.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/types.js +2 -0
- package/dist/ts/src/puck-manifest/types.js.map +1 -0
- package/dist/ts/src/safe-json-stringify.d.ts +13 -0
- package/dist/ts/src/safe-json-stringify.d.ts.map +1 -0
- package/dist/ts/src/safe-json-stringify.js +7 -0
- package/dist/ts/src/safe-json-stringify.js.map +1 -0
- package/dist/ts/src/sandbox-frame-handler.d.ts +19 -0
- package/dist/ts/src/sandbox-frame-handler.d.ts.map +1 -0
- package/dist/ts/src/sandbox-frame-handler.js +27 -0
- package/dist/ts/src/sandbox-frame-handler.js.map +1 -0
- package/dist/ts/src/site-styles/content-wrapper-endpoint.d.ts +73 -0
- package/dist/ts/src/site-styles/content-wrapper-endpoint.d.ts.map +1 -0
- package/dist/ts/src/site-styles/content-wrapper-endpoint.js +224 -0
- package/dist/ts/src/site-styles/content-wrapper-endpoint.js.map +1 -0
- package/dist/ts/src/site-styles/render-endpoint.d.ts +50 -0
- package/dist/ts/src/site-styles/render-endpoint.d.ts.map +1 -0
- package/dist/ts/src/site-styles/render-endpoint.js +264 -0
- package/dist/ts/src/site-styles/render-endpoint.js.map +1 -0
- package/dist/ts/src/site-styles/styles-endpoint.d.ts +59 -0
- package/dist/ts/src/site-styles/styles-endpoint.d.ts.map +1 -0
- package/dist/ts/src/site-styles/styles-endpoint.js +156 -0
- package/dist/ts/src/site-styles/styles-endpoint.js.map +1 -0
- package/dist/ts/src/sitemap-options.d.ts +21 -0
- package/dist/ts/src/sitemap-options.d.ts.map +1 -0
- package/dist/ts/src/sitemap-options.js +92 -0
- package/dist/ts/src/sitemap-options.js.map +1 -0
- package/dist/ts/src/tiptap-html-static.d.ts +15 -0
- package/dist/ts/src/tiptap-html-static.d.ts.map +1 -0
- package/dist/ts/src/tiptap-html-static.js +67 -0
- package/dist/ts/src/tiptap-html-static.js.map +1 -0
- package/dist/ts/src/types.d.ts +543 -0
- package/dist/ts/src/types.d.ts.map +1 -0
- package/dist/ts/src/types.js +2 -0
- package/dist/ts/src/types.js.map +1 -0
- package/dist/virtual-modules.d.ts +74 -0
- package/node/content.ts +14 -0
- package/node/index.ts +22 -0
- package/package.json +198 -56
- package/src/asset-ref-base.ts +48 -0
- package/src/checks.ts +10 -0
- package/src/cms-handler.ts +280 -0
- package/src/collections.ts +262 -0
- package/src/components/HydrationWrapper.tsx +41 -0
- package/src/components/RenderWithFragments.tsx +204 -0
- package/src/components/RenderWithHydration.tsx +55 -0
- package/src/components.ts +3 -0
- package/src/discovery/astro-frontmatter.ts +24 -0
- package/src/discovery/discover.ts +108 -0
- package/src/discovery/extract-props-ts.ts +255 -0
- package/src/discovery/merge-registry.ts +411 -0
- package/src/discovery/registry-endpoint.ts +80 -0
- package/src/discovery/scan-components.ts +458 -0
- package/src/discovery/scan-mdx.ts +190 -0
- package/src/discovery/scan-overrides.ts +92 -0
- package/src/editor-descriptors.ts +96 -0
- package/src/env.d.ts +31 -0
- package/src/handlers/collection-content-api.ts +196 -0
- package/src/handlers/page-handler.astro +320 -0
- package/src/handlers/page-render-core.ts +456 -0
- package/src/hydration.ts +7 -0
- package/src/index.ts +111 -0
- package/src/internal/acorn-default.mjs +37 -0
- package/src/internal/declared-collections.ts +98 -0
- package/src/internal/page-collection-schema.ts +210 -0
- package/src/lib/content-config-guard.ts +48 -0
- package/src/lib/hydration-scanner.ts +176 -0
- package/src/lib/hydration-script.ts +126 -0
- package/src/lib/hydration-utils.ts +120 -0
- package/src/lib/resolve-locale.ts +22 -0
- package/src/lib/resolve-site-name.ts +10 -0
- package/src/lib/route-utils.ts +106 -0
- package/src/lib/routing-config.ts +126 -0
- package/src/lib/serialize-props.ts +7 -0
- package/src/lib/unknown-components.ts +64 -0
- package/src/lib/virtual-module-generators.ts +58 -0
- package/src/lib/withHydration.ts +71 -0
- package/src/loader.ts +145 -0
- package/src/locales-helpers.ts +68 -0
- package/src/mime-types.ts +19 -0
- package/src/page-feed.ts +26 -0
- package/src/page-schemas.ts +19 -0
- package/src/path-validation.ts +13 -0
- package/src/plugin-spa.ts +1480 -0
- package/src/puck-manifest/components-endpoint.ts +55 -0
- package/src/puck-manifest/field-projection.ts +510 -0
- package/src/puck-manifest/index.ts +3 -0
- package/src/puck-manifest/literal.ts +459 -0
- package/src/puck-manifest/read-config.ts +577 -0
- package/src/puck-manifest/read-field.ts +19 -0
- package/src/puck-manifest/read-wrapper.ts +1056 -0
- package/src/puck-manifest/reading-budget.ts +127 -0
- package/src/puck-manifest/resolve-reference.ts +9 -0
- package/src/puck-manifest/source-reference.ts +484 -0
- package/src/puck-manifest/syntax.ts +104 -0
- package/src/puck-manifest/types.ts +139 -0
- package/src/safe-json-stringify.ts +17 -0
- package/src/sandbox-frame-handler.ts +31 -0
- package/src/site-styles/content-wrapper-endpoint.ts +327 -0
- package/src/site-styles/render-endpoint.ts +331 -0
- package/src/site-styles/styles-endpoint.ts +184 -0
- package/src/sitemap-options.ts +115 -0
- package/src/tiptap-html-static.ts +84 -0
- package/{dist/types-CVQNmPxF.d.mts → src/types.ts} +232 -79
- package/src/virtual-modules.d.ts +74 -0
- package/dist/collections.d.mts +0 -36
- package/dist/collections.d.mts.map +0 -1
- package/dist/collections.mjs +0 -65
- package/dist/collections.mjs.map +0 -1
- package/dist/components.d.mts +0 -46
- package/dist/components.d.mts.map +0 -1
- package/dist/components.mjs +0 -226
- package/dist/components.mjs.map +0 -1
- package/dist/hydration-scanner-B0NjYkZ_.mjs +0 -109
- package/dist/hydration-scanner-B0NjYkZ_.mjs.map +0 -1
- package/dist/hydration.d.mts +0 -4
- package/dist/hydration.mjs +0 -3
- package/dist/index.d.mts +0 -139
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -66
- package/dist/index.mjs.map +0 -1
- package/dist/internal/cms-handler.d.mts +0 -26
- package/dist/internal/cms-handler.d.mts.map +0 -1
- package/dist/internal/cms-handler.mjs +0 -267
- package/dist/internal/cms-handler.mjs.map +0 -1
- package/dist/lib/hydration-script.d.mts.map +0 -1
- package/dist/lib/hydration-script.mjs +0 -85
- package/dist/lib/hydration-script.mjs.map +0 -1
- package/dist/loader-By-AQWHc.mjs +0 -68
- package/dist/loader-By-AQWHc.mjs.map +0 -1
- package/dist/node/content.d.mts +0 -19
- package/dist/node/content.d.mts.map +0 -1
- package/dist/node/content.mjs +0 -4
- package/dist/node/index.d.mts +0 -52
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.mjs +0 -753
- package/dist/node/index.mjs.map +0 -1
- package/dist/serialize-props-Dhv_MnkY.mjs +0 -73
- package/dist/serialize-props-Dhv_MnkY.mjs.map +0 -1
- package/dist/types-CVQNmPxF.d.mts.map +0 -1
- package/dist/withHydration-EzyzBQ-Y.mjs +0 -49
- package/dist/withHydration-EzyzBQ-Y.mjs.map +0 -1
- package/dist/withHydration-HIvO9ysY.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -5,301 +5,313 @@ managing content using Puck's drag-and-drop editor, allowing developers to creat
|
|
|
5
5
|
maintaining full control over their content structure. The CMS integrates seamlessly into your Astro development
|
|
6
6
|
workflow, accessible at `/__cms` routes without requiring authentication or complex setup.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Getting started
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Install
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```json
|
|
17
|
-
{
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "astro-scripts build \"src/**/*.ts\" && tsc",
|
|
20
|
-
"build:ci": "astro-scripts build \"src/**/*.ts\""
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
2. **TypeScript Compilation** - Standard `tsc` for type definitions:
|
|
26
|
-
- Compiles `.ts` files to `.js`
|
|
27
|
-
- Generates `.d.ts` type definitions
|
|
28
|
-
- Does NOT compile `.astro` files
|
|
29
|
-
|
|
30
|
-
3. **Package Exports** - Modern ESM exports in package.json:
|
|
31
|
-
```json
|
|
32
|
-
{
|
|
33
|
-
"exports": {
|
|
34
|
-
".": "./dist/index.js",
|
|
35
|
-
"./package.json": "./package.json"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### How Integrations Ship UI
|
|
41
|
-
|
|
42
|
-
Official integrations handle UI in several ways:
|
|
43
|
-
|
|
44
|
-
1. **API Endpoints Only** (Most common)
|
|
45
|
-
- Example: `@astrojs/web-vitals` injects API routes
|
|
46
|
-
- No UI components shipped
|
|
47
|
-
|
|
48
|
-
2. **Client-Side Scripts** (Common)
|
|
49
|
-
- Example: Dev toolbar integrations
|
|
50
|
-
- Ship JavaScript that runs on the client
|
|
51
|
-
- Injected via `injectScript()`
|
|
52
|
-
|
|
53
|
-
3. **Middleware Approach** (Common)
|
|
54
|
-
- Example: `@astrojs/node` adds Express middleware
|
|
55
|
-
- Serves content programmatically
|
|
56
|
-
|
|
57
|
-
4. **Virtual Modules** (Advanced)
|
|
58
|
-
- Example: `@astrojs/db` uses virtual modules
|
|
59
|
-
- Routes are generated at build time
|
|
60
|
-
- Uses Vite's virtual module system
|
|
61
|
-
|
|
62
|
-
### Building Non-Standard Integrations
|
|
63
|
-
|
|
64
|
-
For integrations that need to ship actual UI:
|
|
65
|
-
|
|
66
|
-
1. **Custom Build Process**
|
|
67
|
-
- Can use any build tool (Vite, Rollup, esbuild)
|
|
68
|
-
- Not limited to `tsc` only
|
|
69
|
-
- Example: Bundle React app and serve via middleware
|
|
12
|
+
```bash
|
|
13
|
+
npm install @conloca/astro-cms
|
|
14
|
+
npm install @astrojs/react @vitejs/plugin-react astro react react-dom vite zod
|
|
15
|
+
```
|
|
70
16
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- Example: CSS files, images, bundled JavaScript
|
|
17
|
+
The second line is the full peer set — the CMS expects the host site to own those packages. `@astrojs/react` is not
|
|
18
|
+
optional: the editor is a React application, and this integration does not register Astro's React renderer for you. A
|
|
19
|
+
site that omits it serves the editor route with no editor in it.
|
|
75
20
|
|
|
76
|
-
|
|
21
|
+
### The four files a site needs
|
|
77
22
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
injectRoute({
|
|
81
|
-
pattern: '/api/[...path]',
|
|
82
|
-
entrypoint: '@my-pkg/api-handler',
|
|
83
|
-
});
|
|
23
|
+
A working site needs all four of these. Omitting any one of them breaks the site or the editor, in most cases without an
|
|
24
|
+
error message.
|
|
84
25
|
|
|
85
|
-
|
|
86
|
-
injectRoute({
|
|
87
|
-
pattern: '/__cms/[...path]',
|
|
88
|
-
entrypoint: '@my-pkg/spa-handler',
|
|
89
|
-
});
|
|
90
|
-
```
|
|
26
|
+
#### 1. `astro.config.mjs`
|
|
91
27
|
|
|
92
|
-
|
|
28
|
+
`react()` must be listed before `conlocaCMS()`.
|
|
93
29
|
|
|
94
|
-
|
|
30
|
+
```js
|
|
31
|
+
import react from '@astrojs/react';
|
|
32
|
+
import { conlocaCMS } from '@conloca/astro-cms/node';
|
|
33
|
+
import { defineConfig } from 'astro/config';
|
|
95
34
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
35
|
+
export default defineConfig({
|
|
36
|
+
integrations: [
|
|
37
|
+
react(),
|
|
38
|
+
conlocaCMS({
|
|
39
|
+
contentRoot: './content',
|
|
40
|
+
puckConfigPath: './src/puck.config.tsx',
|
|
41
|
+
layout: './src/layouts/Layout.astro',
|
|
42
|
+
}),
|
|
43
|
+
],
|
|
44
|
+
});
|
|
102
45
|
```
|
|
103
46
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
- Proper export configuration
|
|
108
|
-
- User's Astro instance compiles them at build time
|
|
109
|
-
|
|
110
|
-
### For This CMS
|
|
47
|
+
Import the integration from `@conloca/astro-cms/node`, not from the package root. The root export deliberately throws
|
|
48
|
+
with a message pointing at the `/node` subpath: the root entry stays free of Node-only code so it can load in any
|
|
49
|
+
runtime, including the browser.
|
|
111
50
|
|
|
112
|
-
|
|
51
|
+
`puckConfigPath` points at a module whose default export is a Puck `Config` — the components it lists become the
|
|
52
|
+
editor's palette, and the folders they live in are what the integration scans for hydratable components.
|
|
113
53
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
54
|
+
```tsx
|
|
55
|
+
// src/puck.config.tsx
|
|
56
|
+
import type { Config } from '@puckeditor/core';
|
|
57
|
+
import { Text } from './components/puck/Text';
|
|
117
58
|
|
|
118
|
-
|
|
59
|
+
const puckConfig: Config = {
|
|
60
|
+
components: {
|
|
61
|
+
Text,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
119
64
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
3. Serve via middleware with catch-all routing
|
|
123
|
-
4. Use Astro's API routes for data endpoints
|
|
65
|
+
export default puckConfig;
|
|
66
|
+
```
|
|
124
67
|
|
|
125
|
-
|
|
68
|
+
These must be React components. An `.astro` component cannot be listed here — Astro compiles those into a server-side
|
|
69
|
+
renderer with its own hydration model, so they cannot be wrapped as React components for the editor to render.
|
|
126
70
|
|
|
127
|
-
|
|
71
|
+
#### 2. `src/content.config.ts`
|
|
128
72
|
|
|
129
|
-
|
|
130
|
-
|
|
73
|
+
**Without this file every content page returns 404.** The integration registers the routes, but Astro only has content
|
|
74
|
+
to render once the collections are defined, and defining them is this file's whole job.
|
|
131
75
|
|
|
132
|
-
|
|
76
|
+
```ts
|
|
77
|
+
import { conlocaData, conlocaFragments, conlocaPages } from '@conloca/astro-cms/node/content';
|
|
78
|
+
import { dataSchemas, pageSchemas } from './schemas';
|
|
133
79
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
80
|
+
export const collections = {
|
|
81
|
+
pages: conlocaPages({ pageSchemas }),
|
|
82
|
+
...conlocaData({ dataSchemas }),
|
|
83
|
+
...conlocaFragments('general'),
|
|
84
|
+
};
|
|
85
|
+
```
|
|
138
86
|
|
|
139
|
-
|
|
87
|
+
The keys are the collection names, and `dataSchemas`' own keys become the data collections — nothing is named twice. A
|
|
88
|
+
site with no custom page fields writes `conlocaPages()` on its own, and a site with no data collections drops the
|
|
89
|
+
`conlocaData` line; `conlocaFragments()` with no names still defines the aggregate the renderer reads. No paths are
|
|
90
|
+
passed: the integration publishes its `contentRoot` option through the environment before the content config loads, so
|
|
91
|
+
the one path in `astro.config.mjs` covers both.
|
|
140
92
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
```
|
|
93
|
+
Entries come back typed — `getCollection('pages')` carries `pathname`, `title`, the dates and, via the `HostPageMeta`
|
|
94
|
+
augmentation, the host's own page fields, and a data entry carries `data` typed by its schema. That `data` is optional
|
|
95
|
+
(`data?: T`): an entry saved before any payload exists is not an error, so readers guard the access. Content the config
|
|
96
|
+
does not declare fails the build, and the error names the collection and its kind, rather than silently not building;
|
|
97
|
+
declaring a collection before its folder exists is the normal order, since the folder appears with the first entry saved
|
|
98
|
+
in the editor.
|
|
149
99
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
- Can render .astro components to HTML strings via `renderToString()`
|
|
153
|
-
- Server-side only - returns static HTML, not React components
|
|
100
|
+
A site with no MDX fragments yet prints this once per rendered page, and it is expected — nothing is wrong with the file
|
|
101
|
+
this message points at:
|
|
154
102
|
|
|
155
|
-
|
|
103
|
+
```plain
|
|
104
|
+
The collection "__conloca_fragments" does not exist or is empty. Please check your content config file for errors.
|
|
105
|
+
```
|
|
156
106
|
|
|
157
|
-
|
|
107
|
+
Astro prints it from `getCollection()` whenever a collection holds no entries, and there is no way to register an empty
|
|
108
|
+
one — leaving the collection out produces the very same message. It stops as soon as the site has one published
|
|
109
|
+
fragment.
|
|
158
110
|
|
|
159
|
-
|
|
160
|
-
// Example from astro/examples/container-with-vitest/test/ReactWrapper.test.ts
|
|
161
|
-
import { experimental_AstroContainer as AstroContainer } from 'astro/container';
|
|
162
|
-
import { getContainerRenderer } from '@astrojs/react';
|
|
163
|
-
import Component from '../src/components/Component.astro';
|
|
111
|
+
#### 3. `content/sites.json`
|
|
164
112
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
});
|
|
113
|
+
Lives at the root of `contentRoot` and declares the sites and their locales. A single-site setup names its site
|
|
114
|
+
`default`, which is the site name every other default assumes.
|
|
168
115
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"sites": {
|
|
119
|
+
"default": {
|
|
120
|
+
"locales": ["en"],
|
|
121
|
+
"defaultLocale": "en"
|
|
122
|
+
}
|
|
172
123
|
},
|
|
173
|
-
|
|
174
|
-
}
|
|
124
|
+
"globalLocales": ["en"]
|
|
125
|
+
}
|
|
175
126
|
```
|
|
176
127
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
#### 1. Server-Side HTML Rendering (Limited)
|
|
180
|
-
|
|
181
|
-
- Render .astro components to HTML strings server-side
|
|
182
|
-
- Display in React using `dangerouslySetInnerHTML`
|
|
183
|
-
- No client-side interactivity preserved
|
|
184
|
-
- Requires API endpoint to render components on demand
|
|
185
|
-
|
|
186
|
-
#### 2. Astro Islands Architecture ([astro/packages/astro/src/runtime/server/astro-island.ts](https://github.com/withastro/astro/blob/main/packages/astro/src/runtime/server/astro-island.ts))
|
|
187
|
-
|
|
188
|
-
- Astro uses custom `<astro-island>` elements for hydration
|
|
189
|
-
- Complex hydration system with directives (`client:load`, `client:idle`, etc.)
|
|
190
|
-
- Not designed for embedding within React components
|
|
191
|
-
- Would require significant work to integrate with React's lifecycle
|
|
192
|
-
|
|
193
|
-
#### 3. Direct Component Usage (Not Possible)
|
|
194
|
-
|
|
195
|
-
- .astro components cannot be directly imported and used as React components
|
|
196
|
-
- Different component models: Astro uses server-first rendering with partial hydration
|
|
197
|
-
- React expects components that return React elements
|
|
198
|
-
|
|
199
|
-
### Recommendation
|
|
200
|
-
|
|
201
|
-
**Use React components in Puck, not .astro components:**
|
|
202
|
-
|
|
203
|
-
1. Create shared React components that can be used by both:
|
|
204
|
-
- Astro pages (via React integration)
|
|
205
|
-
- Puck editor (native React)
|
|
206
|
-
|
|
207
|
-
2. Example structure:
|
|
128
|
+
If the file is missing the CMS logs a warning and falls back to an empty site list, which means no page collections get
|
|
129
|
+
created — the same symptom as a missing content config.
|
|
208
130
|
|
|
209
|
-
|
|
210
|
-
src/
|
|
211
|
-
components/
|
|
212
|
-
Hero.tsx # React component
|
|
213
|
-
Card.tsx # React component
|
|
214
|
-
pages/
|
|
215
|
-
index.astro # Uses React components
|
|
216
|
-
puck.config.ts # Also uses React components
|
|
217
|
-
```
|
|
131
|
+
#### 4. The layout named by `layout`
|
|
218
132
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
- No complex wrapping or conversion needed
|
|
223
|
-
- Proper TypeScript support and props validation
|
|
133
|
+
An ordinary Astro layout. It receives `title` and `description`, and renders the page body through `<slot />`. It also
|
|
134
|
+
receives `page`, the page being rendered with its settings in `page.meta`; read extra head fields such as an Open Graph
|
|
135
|
+
image from there rather than querying the collection again.
|
|
224
136
|
|
|
225
|
-
|
|
137
|
+
```astro
|
|
138
|
+
---
|
|
139
|
+
interface Props {
|
|
140
|
+
title?: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
}
|
|
226
143
|
|
|
227
|
-
|
|
144
|
+
const { title, description } = Astro.props;
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
<!doctype html>
|
|
148
|
+
<html lang="en">
|
|
149
|
+
<head>
|
|
150
|
+
<meta charset="utf-8" />
|
|
151
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
152
|
+
<title>{title ?? 'My site'}</title>
|
|
153
|
+
{description && <meta name="description" content={description} />}
|
|
154
|
+
</head>
|
|
155
|
+
<body>
|
|
156
|
+
<slot />
|
|
157
|
+
</body>
|
|
158
|
+
</html>
|
|
159
|
+
```
|
|
228
160
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
161
|
+
Supplying `layout` and nothing else turns on a catch-all `/[...slug]` route over the `pages` collection with a `404`
|
|
162
|
+
fallback. Sites that need more than one route drop `layout` and use `routing.routes.<name>.layout` instead.
|
|
163
|
+
|
|
164
|
+
With those four files in place, run the Astro dev server and open `/__cms`.
|
|
165
|
+
|
|
166
|
+
### Options
|
|
167
|
+
|
|
168
|
+
Passed to `conlocaCMS({ ... })`. Only two are required.
|
|
169
|
+
|
|
170
|
+
| Option | Required | What it does |
|
|
171
|
+
| ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
172
|
+
| `contentRoot` | yes | Directory holding `sites.json` and the content files. Also handed to the collection factories, so the content config needs no copy of it. |
|
|
173
|
+
| `puckConfigPath` | yes | Module whose default export is the Puck `Config`. Supplies the visual editor's component palette and seeds component auto-discovery. |
|
|
174
|
+
| `canvasDir` | no | Directory for canvas documents. |
|
|
175
|
+
| `route` | no | Where the CMS mounts. Defaults to `/__cms`. |
|
|
176
|
+
| `layout` | no | Default layout for content pages. On its own it enables routing with a catch-all pattern. |
|
|
177
|
+
| `routing` | no | Full routing configuration, for sites with more than one content route. |
|
|
178
|
+
| `templates` | no | Page templates offered in the create-page dialog. |
|
|
179
|
+
| `schemasPath` | no | Module exporting `dataSchemas`, `pageSchemas` and `mdxComponents`. Drives the page-settings form and the MDX component registry. |
|
|
180
|
+
| `componentPaths` | no | Extra folders to scan for components wrapped in `withHydration()`. |
|
|
181
|
+
| `mdxComponentFolders` | no | Folders scanned for locally authored MDX components, whose `interface Props` becomes the editor's prop panel. Defaults to `['src/components/mdx']`. |
|
|
182
|
+
| `assetsPath` | no | Upload directory; enables the Media Library. The site must serve it from `publicDir`, directly or through a link there, or dev and build fail. |
|
|
183
|
+
| `siteStyles` | no | CSS injected into the Puck preview iframe so components render with site styling. |
|
|
184
|
+
| `editorStyles` | no | CSS injected into the MDX editor's admin document. Host-component selectors only — see the file's own notes on what does not belong. |
|
|
185
|
+
| `editorCSS` | no | Raw CSS applied after auto-discovered host styles in the editor's host-preview layer. |
|
|
186
|
+
| `fragmentPreviewRoute` | no | Route whose styles and content wrapper frame the standalone fragment editor. Defaults to `/`. |
|
|
187
|
+
| `locales` | no | The site's locales and default locale. Falls back to `globalLocales` in `sites.json`. |
|
|
188
|
+
|
|
189
|
+
`ConlocaCMSOptions` also extends the editor's `UIConfig` (minus `basename`), so fields such as `apiBaseUrl`,
|
|
190
|
+
`siteBaseUrl`, `enableDevtools`, `queryClientOptions`, `projectRoot` and `hosted` are accepted as well. Those exist for
|
|
191
|
+
hosts that embed the editor in their own shell; an ordinary Astro site leaves them alone.
|
|
192
|
+
|
|
193
|
+
**`puckConfigPath` and `schemasPath` are unrelated options.** They resolve different files, feed different parts of the
|
|
194
|
+
CMS, and neither falls back to the other. `puckConfigPath` is required and supplies the visual page editor's component
|
|
195
|
+
palette. `schemasPath` is optional and supplies frontmatter forms plus the MDX component registry described below.
|
|
196
|
+
Setting `schemasPath` does not make `puckConfigPath` unnecessary, and a site with no `schemasPath` still works — it just
|
|
197
|
+
has no custom page-settings fields and no registered MDX components.
|
|
198
|
+
|
|
199
|
+
### Sitemap for on-demand pages
|
|
200
|
+
|
|
201
|
+
A static build writes a file for every published page, and `@astrojs/sitemap` lists those by itself. A route with
|
|
202
|
+
`prerender: false` renders its pages on demand instead, so there is no file to find and the sitemap leaves them out.
|
|
203
|
+
`conlocaSitemapOptions` returns the two `@astrojs/sitemap` options the CMS's pages need: `customPages`, the full address
|
|
204
|
+
of every published page the CMS routes serve, and `serialize`, which gives each of them its last-edit date as
|
|
205
|
+
`<lastmod>`. Addresses follow your `site`, `base`, `trailingSlash` and `build.format`, so hand it the same settings you
|
|
206
|
+
give Astro, along with the same options as `conlocaCMS()`:
|
|
207
|
+
|
|
208
|
+
```js
|
|
209
|
+
import node from '@astrojs/node';
|
|
210
|
+
import react from '@astrojs/react';
|
|
211
|
+
import sitemap from '@astrojs/sitemap';
|
|
212
|
+
import { conlocaCMS, conlocaSitemapOptions } from '@conloca/astro-cms/node';
|
|
213
|
+
import { defineConfig } from 'astro/config';
|
|
214
|
+
|
|
215
|
+
// Every setting that decides a page's address, shared by Astro and the sitemap.
|
|
216
|
+
const urls = { site: 'https://example.com', trailingSlash: 'always' };
|
|
217
|
+
const cmsOptions = {
|
|
218
|
+
contentRoot: './content',
|
|
219
|
+
puckConfigPath: './src/puck.config.tsx',
|
|
220
|
+
routing: {
|
|
221
|
+
routes: {
|
|
222
|
+
pages: { pattern: '/[...slug]', layout: './src/layouts/Layout.astro', prerender: false },
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
};
|
|
233
226
|
|
|
234
|
-
|
|
227
|
+
export default defineConfig({
|
|
228
|
+
...urls,
|
|
229
|
+
adapter: node({ mode: 'standalone' }),
|
|
230
|
+
integrations: [react(), sitemap(await conlocaSitemapOptions(cmsOptions, urls)), conlocaCMS(cmsOptions)],
|
|
231
|
+
});
|
|
232
|
+
```
|
|
235
233
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
234
|
+
The list is read when the config loads, so publish and unpublish dates count as of the build. If a CMS route is
|
|
235
|
+
prerendered after all, its pages get the address Astro gives them, so each appears once, not twice. Pages are listed in
|
|
236
|
+
the language the CMS routes serve (`routing.locale`), because the routes give other languages no address. A page whose
|
|
237
|
+
last-edit date cannot be read is listed without `<lastmod>` instead of failing the build. To pass sitemap options of
|
|
238
|
+
your own as well, put them in one object with these, as in
|
|
239
|
+
`sitemap({ ...(await conlocaSitemapOptions(cmsOptions, urls)), changefreq: 'weekly' })`. A `serialize` of your own
|
|
240
|
+
replaces this one, so call this one inside it.
|
|
239
241
|
|
|
240
|
-
|
|
242
|
+
### Listing CMS pages on an Astro page
|
|
241
243
|
|
|
242
|
-
|
|
244
|
+
A block on a CMS page gets its list of pages from the route's `dataBindings.pages`. An ordinary Astro page, such as a
|
|
245
|
+
blog index or an RSS route, asks for the same list through `@conloca/astro-cms/page-feed`:
|
|
243
246
|
|
|
244
|
-
|
|
247
|
+
```astro
|
|
248
|
+
---
|
|
249
|
+
import { getPagesByPrefix } from '@conloca/astro-cms/page-feed';
|
|
245
250
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
- `vite-plugin-astro` orchestrates this compilation
|
|
249
|
-
- The plugin integrates with Vite's module system
|
|
251
|
+
const posts = await getPagesByPrefix('/blog/');
|
|
252
|
+
---
|
|
250
253
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
- CSS dependencies: Invalidates compile metadata when CSS imports change
|
|
256
|
-
- Full changes: Re-compiles the entire component
|
|
257
|
-
- Vite's HMR system propagates updates to the browser
|
|
254
|
+
<ul>
|
|
255
|
+
{posts.map((post) => <li><a href={post.pathname}>{post.title}</a></li>)}
|
|
256
|
+
</ul>
|
|
257
|
+
```
|
|
258
258
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
259
|
+
The list holds the published pages under the prefix, in the site's language, without the page at the prefix itself. Each
|
|
260
|
+
entry is a `PageReference`: `meta` carries the page's own fields, including the ones `pageSchemas` declares, and
|
|
261
|
+
`timestamps` carries created, modified and published dates. `published` is the page's publish time or, when it has none,
|
|
262
|
+
its creation time. The second argument takes `sort` (`'date-desc'`, the default, puts the newest publish date first, so
|
|
263
|
+
editing a page never moves it; `'date-asc'` and `'title'` are the others; pages that tie are listed by path), `limit`,
|
|
264
|
+
and `locale` to read another language. It reads the pages of the content routes `conlocaCMS()` serves, so it needs
|
|
265
|
+
`layout` or `routing` set there and throws when neither is.
|
|
266
|
+
|
|
267
|
+
## MDX component registry
|
|
268
|
+
|
|
269
|
+
Hosts can register JSX components (their own, or third-party ones like Starlight's `<Steps>`, `<Tabs>`, `<Card>`) with
|
|
270
|
+
the MDX editor so authors get typed insert affordances and optional auto-import injection. The registry is wired through
|
|
271
|
+
the same `schemasPath` option that already loads `pageSchemas` — add an `mdxComponents` export to the file and the CMS
|
|
272
|
+
picks it up at boot (and on HMR).
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
// src/schemas.ts
|
|
276
|
+
import { defineMdxComponents } from '@conloca/astro-cms';
|
|
277
|
+
|
|
278
|
+
export const pageSchemas = {/* existing entries */};
|
|
279
|
+
|
|
280
|
+
export const mdxComponents = defineMdxComponents([
|
|
281
|
+
{
|
|
282
|
+
name: 'Steps',
|
|
283
|
+
kind: 'flow',
|
|
284
|
+
hasChildren: true,
|
|
285
|
+
insert: { label: 'Steps', description: 'Numbered step-by-step list', icon: 'list-ordered' },
|
|
286
|
+
defaults: { children: '1. First step\n2. Second step\n3. Third step' },
|
|
287
|
+
import: { from: '@astrojs/starlight/components' },
|
|
288
|
+
},
|
|
289
|
+
// …other components your site uses
|
|
290
|
+
]);
|
|
291
|
+
```
|
|
264
292
|
|
|
265
|
-
|
|
293
|
+
Starlight components are declared the same way as any other component — the CMS does not ship Starlight descriptors.
|
|
294
|
+
Copy the props you need from each component's source (e.g.
|
|
295
|
+
`node_modules/@astrojs/starlight/user-components/<Component>.astro`).
|
|
266
296
|
|
|
267
|
-
|
|
297
|
+
In the editor, registered components appear in two places:
|
|
268
298
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
3. **Component Bundling**: Vite will handle bundling React components in the config
|
|
272
|
-
4. **No Custom Build**: We don't need a separate build process for the config
|
|
299
|
+
- A slash menu, opened by typing `/` in the body. Filter by name, label, description, or keywords.
|
|
300
|
+
- A toolbar dropdown next to the admonition button, listing block-level (`kind: 'flow'`) components.
|
|
273
301
|
|
|
274
|
-
|
|
302
|
+
### Auto-import injection (and its pruning caveat)
|
|
275
303
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
plugins: [
|
|
280
|
-
{
|
|
281
|
-
name: 'conloca-cms-config',
|
|
282
|
-
resolveId(id) {
|
|
283
|
-
if (id === 'virtual:conloca-cms/puck-config') {
|
|
284
|
-
return '\0virtual:conloca-cms/puck-config';
|
|
285
|
-
}
|
|
286
|
-
},
|
|
287
|
-
load(id) {
|
|
288
|
-
if (id === '\0virtual:conloca-cms/puck-config') {
|
|
289
|
-
return `
|
|
290
|
-
import { puckConfig } from '${userPuckConfigPath}';
|
|
291
|
-
export default puckConfig;
|
|
292
|
-
`;
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
];
|
|
297
|
-
}
|
|
298
|
-
```
|
|
304
|
+
Setting `import: { from: '<module>' }` on a descriptor opts the component into automatic import injection: whenever the
|
|
305
|
+
component appears in the document, the CMS save serializer emits the matching `import { Name } from '<module>'` line at
|
|
306
|
+
the top of the file (after frontmatter).
|
|
299
307
|
|
|
300
|
-
|
|
308
|
+
**Important: the editor rebuilds the import block on every save from components actually referenced in the tree.**
|
|
309
|
+
Imports for unused components are dropped. So are non-JSX imports — type imports, side-effect imports
|
|
310
|
+
(`import './styles.css'`), and helper-function imports — because the editor does not consider them "referred to" by a
|
|
311
|
+
JSX node. This is a hard constraint of the underlying `@mdxeditor/editor` export pipeline (see
|
|
312
|
+
`dist/exportMarkdownFromLexical.js` in that package), not a policy choice.
|
|
301
313
|
|
|
302
|
-
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
314
|
+
For Starlight-flavored docs (where MDX only imports Starlight components from `@astrojs/starlight/components`) the
|
|
315
|
+
behavior matches authorial intent — imports follow usage. For richer MDX that relies on type or side-effect imports,
|
|
316
|
+
edit those files in your IDE rather than the CMS, or omit `import.from` from your descriptors so the editor does not
|
|
317
|
+
claim ownership of the import line.
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
// Uniform acorn surface for SSR builds: some toolchain consumers
|
|
2
|
+
// default-import acorn (which its ESM build does not provide), others use
|
|
3
|
+
// named imports — this shim serves both. Resolved with a static import, never
|
|
4
|
+
// a Node require built from `import.meta.url` — that value is undefined
|
|
5
|
+
// inside a Workers bundle, and building one at module scope throws before the
|
|
6
|
+
// bundle can serve anything. The
|
|
7
|
+
// integration's alias plugin skips this file as an importer, so the specifier
|
|
8
|
+
// below reaches the real package instead of recursing into the shim.
|
|
9
|
+
import * as acornModule from 'acorn';
|
|
2
10
|
|
|
3
|
-
|
|
4
|
-
const acorn =
|
|
11
|
+
// Bundler CJS interop can surface the namespace under `default`.
|
|
12
|
+
const acorn = acornModule.Parser ? acornModule : acornModule.default;
|
|
5
13
|
|
|
6
14
|
export const Node = acorn.Node;
|
|
7
15
|
export const Parser = acorn.Parser;
|