@conloca/astro-cms 0.1.16 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +254 -301
- 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/{src → ts/src}/cms-handler.d.ts +0 -1
- package/dist/ts/src/cms-handler.d.ts.map +1 -0
- package/dist/{src → ts/src}/cms-handler.js +11 -131
- package/dist/ts/src/cms-handler.js.map +1 -0
- package/dist/ts/src/collections.d.ts +161 -0
- package/dist/ts/src/collections.d.ts.map +1 -0
- package/dist/ts/src/collections.js +178 -0
- package/dist/ts/src/collections.js.map +1 -0
- package/dist/{src → ts/src}/components/HydrationWrapper.d.ts +1 -1
- package/dist/ts/src/components/HydrationWrapper.d.ts.map +1 -0
- package/dist/{src → ts/src}/components/HydrationWrapper.js +1 -0
- package/dist/ts/src/components/HydrationWrapper.js.map +1 -0
- package/dist/{src/components/RenderWithBlocks.d.ts → ts/src/components/RenderWithFragments.d.ts} +8 -4
- 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/{src → ts/src}/components/RenderWithHydration.d.ts +6 -2
- package/dist/ts/src/components/RenderWithHydration.d.ts.map +1 -0
- package/dist/{src → ts/src}/components/RenderWithHydration.js +6 -3
- 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.map +1 -0
- package/dist/{src → ts/src}/discovery/astro-frontmatter.js +1 -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.map +1 -0
- package/dist/{src → ts/src}/discovery/extract-props-ts.js +1 -0
- package/dist/ts/src/discovery/extract-props-ts.js.map +1 -0
- package/dist/{src → ts/src}/discovery/merge-registry.d.ts +3 -3
- package/dist/ts/src/discovery/merge-registry.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/merge-registry.js +1 -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/{src → ts/src}/discovery/scan-components.d.ts +3 -7
- package/dist/ts/src/discovery/scan-components.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/scan-components.js +4 -6
- package/dist/ts/src/discovery/scan-components.js.map +1 -0
- package/dist/ts/src/discovery/scan-mdx.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/scan-mdx.js +1 -0
- package/dist/ts/src/discovery/scan-mdx.js.map +1 -0
- package/dist/ts/src/discovery/scan-overrides.d.ts.map +1 -0
- package/dist/{src → ts/src}/discovery/scan-overrides.js +1 -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.map +1 -0
- package/dist/{src → ts/src}/hydration.js +1 -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 +13 -0
- package/dist/ts/src/lib/content-config-guard.d.ts.map +1 -0
- package/dist/ts/src/lib/content-config-guard.js +45 -0
- package/dist/ts/src/lib/content-config-guard.js.map +1 -0
- package/dist/ts/src/lib/hydration-scanner.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/hydration-scanner.js +1 -0
- package/dist/ts/src/lib/hydration-scanner.js.map +1 -0
- package/dist/ts/src/lib/hydration-script.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/hydration-script.js +1 -0
- package/dist/ts/src/lib/hydration-script.js.map +1 -0
- package/dist/ts/src/lib/hydration-utils.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/hydration-utils.js +1 -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/{src → ts/src}/lib/route-utils.d.ts +26 -6
- package/dist/ts/src/lib/route-utils.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/route-utils.js +33 -15
- package/dist/ts/src/lib/route-utils.js.map +1 -0
- package/dist/{src → ts/src}/lib/routing-config.d.ts +7 -1
- package/dist/ts/src/lib/routing-config.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/routing-config.js +13 -0
- package/dist/ts/src/lib/routing-config.js.map +1 -0
- package/dist/ts/src/lib/serialize-props.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/serialize-props.js +1 -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/{src → ts/src}/lib/virtual-module-generators.d.ts +0 -24
- 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/ts/src/lib/withHydration.d.ts.map +1 -0
- package/dist/{src → ts/src}/lib/withHydration.js +1 -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/{src → ts/src}/loader.js +33 -4
- package/dist/ts/src/loader.js.map +1 -0
- package/dist/ts/src/locales-helpers.d.ts.map +1 -0
- package/dist/{src → ts/src}/locales-helpers.js +1 -0
- package/dist/ts/src/locales-helpers.js.map +1 -0
- package/dist/ts/src/mime-types.d.ts.map +1 -0
- package/dist/{src → ts/src}/mime-types.js +1 -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.map +1 -0
- package/dist/{src → ts/src}/path-validation.js +1 -0
- package/dist/ts/src/path-validation.js.map +1 -0
- package/dist/{src → ts/src}/plugin-spa.d.ts +28 -10
- package/dist/ts/src/plugin-spa.d.ts.map +1 -0
- package/dist/{src → ts/src}/plugin-spa.js +301 -88
- 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.map +1 -0
- package/dist/{src → ts/src}/safe-json-stringify.js +1 -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/{src → ts/src}/site-styles/content-wrapper-endpoint.d.ts +2 -5
- package/dist/ts/src/site-styles/content-wrapper-endpoint.d.ts.map +1 -0
- package/dist/{src → ts/src}/site-styles/content-wrapper-endpoint.js +5 -8
- package/dist/ts/src/site-styles/content-wrapper-endpoint.js.map +1 -0
- package/dist/{src → ts/src}/site-styles/render-endpoint.d.ts +4 -9
- package/dist/ts/src/site-styles/render-endpoint.d.ts.map +1 -0
- package/dist/{src → ts/src}/site-styles/render-endpoint.js +1 -0
- package/dist/ts/src/site-styles/render-endpoint.js.map +1 -0
- package/dist/{src → ts/src}/site-styles/styles-endpoint.d.ts +2 -4
- package/dist/ts/src/site-styles/styles-endpoint.d.ts.map +1 -0
- package/dist/{src → ts/src}/site-styles/styles-endpoint.js +3 -5
- 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 +16 -0
- package/dist/ts/src/tiptap-html-static.d.ts.map +1 -0
- package/dist/ts/src/tiptap-html-static.js +117 -0
- package/dist/ts/src/tiptap-html-static.js.map +1 -0
- package/dist/{src → ts/src}/types.d.ts +26 -110
- 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 +12 -93
- package/node/content.ts +14 -0
- package/node/index.ts +22 -0
- package/package.json +161 -73
- package/src/asset-ref-base.ts +48 -0
- package/src/checks.ts +11 -0
- package/src/cms-handler.ts +281 -0
- package/src/collections.ts +271 -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 +53 -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/{dist/withHydration-DkKpkmzJ.d.mts → src/lib/withHydration.ts} +25 -8
- package/src/loader.ts +145 -0
- package/{dist/locales-helpers-BvYYqnJ5.d.mts → src/locales-helpers.ts} +21 -17
- 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 +1496 -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 +134 -0
- package/{dist/types-CS9neadI.d.mts → src/types.ts} +87 -124
- package/src/virtual-modules.d.ts +74 -0
- package/dist/collections-Bd7EME4b.mjs +0 -129
- package/dist/collections-Bd7EME4b.mjs.map +0 -1
- package/dist/collections.d.mts +0 -35
- package/dist/collections.d.mts.map +0 -1
- package/dist/collections.mjs +0 -2
- package/dist/components.d.mts +0 -41
- package/dist/components.d.mts.map +0 -1
- package/dist/components.mjs +0 -223
- package/dist/components.mjs.map +0 -1
- package/dist/hydration.d.mts +0 -4
- package/dist/hydration.mjs +0 -2
- package/dist/index.d.mts +0 -108
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -67
- package/dist/index.mjs.map +0 -1
- package/dist/internal/cms-handler.d.mts +0 -25
- package/dist/internal/cms-handler.d.mts.map +0 -1
- package/dist/internal/cms-handler.mjs +0 -314
- package/dist/internal/cms-handler.mjs.map +0 -1
- package/dist/lib/hydration-script.d.mts +0 -30
- package/dist/lib/hydration-script.d.mts.map +0 -1
- package/dist/lib/hydration-script.mjs +0 -84
- package/dist/lib/hydration-script.mjs.map +0 -1
- package/dist/locales-helpers-BvYYqnJ5.d.mts.map +0 -1
- package/dist/locales-helpers-qiwh7nxS.mjs +0 -54
- package/dist/locales-helpers-qiwh7nxS.mjs.map +0 -1
- package/dist/node/content.d.mts +0 -18
- package/dist/node/content.d.mts.map +0 -1
- package/dist/node/content.d.ts +0 -3
- package/dist/node/content.d.ts.map +0 -1
- package/dist/node/content.js +0 -2
- package/dist/node/content.mjs +0 -2
- package/dist/node/index.d.mts +0 -200
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.d.ts +0 -4
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.js +0 -3
- package/dist/node/index.mjs +0 -2513
- package/dist/node/index.mjs.map +0 -1
- package/dist/serialize-props-BHoNpzH6.mjs +0 -72
- package/dist/serialize-props-BHoNpzH6.mjs.map +0 -1
- package/dist/src/cms-handler.d.ts.map +0 -1
- package/dist/src/collections.d.ts +0 -32
- package/dist/src/collections.d.ts.map +0 -1
- package/dist/src/collections.js +0 -50
- package/dist/src/components/HydrationWrapper.d.ts.map +0 -1
- package/dist/src/components/RenderWithBlocks.d.ts.map +0 -1
- package/dist/src/components/RenderWithBlocks.js +0 -129
- package/dist/src/components/RenderWithHydration.d.ts.map +0 -1
- package/dist/src/components.d.ts +0 -4
- package/dist/src/components.d.ts.map +0 -1
- package/dist/src/components.js +0 -3
- package/dist/src/discovery/astro-frontmatter.d.ts.map +0 -1
- package/dist/src/discovery/extract-props-ts.d.ts.map +0 -1
- package/dist/src/discovery/merge-registry.d.ts.map +0 -1
- package/dist/src/discovery/registry-endpoint.d.ts +0 -42
- package/dist/src/discovery/registry-endpoint.d.ts.map +0 -1
- package/dist/src/discovery/registry-endpoint.js +0 -81
- package/dist/src/discovery/scan-components.d.ts.map +0 -1
- package/dist/src/discovery/scan-mdx.d.ts.map +0 -1
- package/dist/src/discovery/scan-overrides.d.ts.map +0 -1
- package/dist/src/hydration.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -11
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -25
- package/dist/src/lib/hydration-scanner.d.ts.map +0 -1
- package/dist/src/lib/hydration-script.d.ts.map +0 -1
- package/dist/src/lib/hydration-utils.d.ts.map +0 -1
- package/dist/src/lib/page-api.d.ts +0 -77
- package/dist/src/lib/page-api.d.ts.map +0 -1
- package/dist/src/lib/page-api.js +0 -121
- package/dist/src/lib/route-utils.d.ts.map +0 -1
- package/dist/src/lib/routing-config.d.ts.map +0 -1
- package/dist/src/lib/serialize-props.d.ts.map +0 -1
- package/dist/src/lib/virtual-module-generators.d.ts.map +0 -1
- package/dist/src/lib/virtual-module-generators.js +0 -263
- package/dist/src/lib/withHydration.d.ts.map +0 -1
- package/dist/src/loader.d.ts +0 -14
- package/dist/src/loader.d.ts.map +0 -1
- package/dist/src/locales-helpers.d.ts.map +0 -1
- package/dist/src/mime-types.d.ts.map +0 -1
- package/dist/src/path-validation.d.ts.map +0 -1
- package/dist/src/plugin-spa.d.ts.map +0 -1
- package/dist/src/safe-json-stringify.d.ts.map +0 -1
- package/dist/src/site-styles/content-wrapper-endpoint.d.ts.map +0 -1
- package/dist/src/site-styles/render-endpoint.d.ts.map +0 -1
- package/dist/src/site-styles/styles-endpoint.d.ts.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -1
- package/dist/types-CS9neadI.d.mts.map +0 -1
- package/dist/withHydration-C256ox_6.mjs +0 -49
- package/dist/withHydration-C256ox_6.mjs.map +0 -1
- package/dist/withHydration-DkKpkmzJ.d.mts.map +0 -1
- /package/dist/{src → ts/src}/discovery/astro-frontmatter.d.ts +0 -0
- /package/dist/{src → ts/src}/discovery/extract-props-ts.d.ts +0 -0
- /package/dist/{src → ts/src}/discovery/scan-mdx.d.ts +0 -0
- /package/dist/{src → ts/src}/discovery/scan-overrides.d.ts +0 -0
- /package/dist/{src → ts/src}/hydration.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/hydration-scanner.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/hydration-script.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/hydration-utils.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/serialize-props.d.ts +0 -0
- /package/dist/{src → ts/src}/lib/withHydration.d.ts +0 -0
- /package/dist/{src → ts/src}/locales-helpers.d.ts +0 -0
- /package/dist/{src → ts/src}/mime-types.d.ts +0 -0
- /package/dist/{src → ts/src}/path-validation.d.ts +0 -0
- /package/dist/{src → ts/src}/safe-json-stringify.d.ts +0 -0
package/README.md
CHANGED
|
@@ -5,361 +5,314 @@ 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
|
-
##
|
|
9
|
-
|
|
10
|
-
Hosts can register JSX components (their own, or third-party ones like Starlight's `<Steps>`, `<Tabs>`, `<Card>`) with
|
|
11
|
-
the MDX editor so authors get typed insert affordances and optional auto-import injection. The registry is wired through
|
|
12
|
-
the same `schemasPath` option that already loads `pageSchemas` — add an `mdxComponents` export to the file and the CMS
|
|
13
|
-
picks it up at boot (and on HMR).
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
// src/schemas.ts
|
|
17
|
-
import { defineMdxComponents } from '@conloca/astro-cms';
|
|
8
|
+
## Getting started
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
/* existing entries */
|
|
21
|
-
};
|
|
10
|
+
### Install
|
|
22
11
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
kind: 'flow',
|
|
27
|
-
hasChildren: true,
|
|
28
|
-
insert: { label: 'Steps', description: 'Numbered step-by-step list', icon: 'list-ordered' },
|
|
29
|
-
defaults: { children: '1. First step\n2. Second step\n3. Third step' },
|
|
30
|
-
import: { from: '@astrojs/starlight/components' },
|
|
31
|
-
},
|
|
32
|
-
// …other components your site uses
|
|
33
|
-
]);
|
|
12
|
+
```bash
|
|
13
|
+
npm install @conloca/astro-cms
|
|
14
|
+
npm install @astrojs/react @vitejs/plugin-react astro react react-dom vite zod
|
|
34
15
|
```
|
|
35
16
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
In the editor, registered components appear in two places:
|
|
41
|
-
|
|
42
|
-
- A slash menu, opened by typing `/` in the body. Filter by name, label, description, or keywords.
|
|
43
|
-
- A toolbar dropdown next to the admonition button, listing block-level (`kind: 'flow'`) components.
|
|
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.
|
|
44
20
|
|
|
45
|
-
###
|
|
21
|
+
### The four files a site needs
|
|
46
22
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
the top of the file (after frontmatter).
|
|
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.
|
|
50
25
|
|
|
51
|
-
|
|
52
|
-
Imports for unused components are dropped. So are non-JSX imports — type imports, side-effect imports
|
|
53
|
-
(`import './styles.css'`), and helper-function imports — because the editor does not consider them "referred to" by a
|
|
54
|
-
JSX node. This is a hard constraint of the underlying `@mdxeditor/editor` export pipeline
|
|
55
|
-
([`exportMarkdownFromLexical.js:98-148`](../../node_modules/@mdxeditor/editor/dist/exportMarkdownFromLexical.js)), not a
|
|
56
|
-
policy choice.
|
|
26
|
+
#### 1. `astro.config.mjs`
|
|
57
27
|
|
|
58
|
-
|
|
59
|
-
behavior matches authorial intent — imports follow usage. For richer MDX that relies on type or side-effect imports,
|
|
60
|
-
edit those files in your IDE rather than the CMS, or omit `import.from` from your descriptors so the editor does not
|
|
61
|
-
claim ownership of the import line.
|
|
28
|
+
`react()` must be listed before `conlocaCMS()`.
|
|
62
29
|
|
|
63
|
-
|
|
30
|
+
```js
|
|
31
|
+
import react from '@astrojs/react';
|
|
32
|
+
import { conlocaCMS } from '@conloca/astro-cms/node';
|
|
33
|
+
import { defineConfig } from 'astro/config';
|
|
64
34
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
2. **TypeScript Compilation** - Standard `tsc` for type definitions:
|
|
81
|
-
- Compiles `.ts` files to `.js`
|
|
82
|
-
- Generates `.d.ts` type definitions
|
|
83
|
-
- Does NOT compile `.astro` files
|
|
84
|
-
|
|
85
|
-
3. **Package Exports** - Modern ESM exports in package.json:
|
|
86
|
-
```json
|
|
87
|
-
{
|
|
88
|
-
"exports": {
|
|
89
|
-
".": "./dist/index.js",
|
|
90
|
-
"./package.json": "./package.json"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### How Integrations Ship UI
|
|
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
|
+
});
|
|
45
|
+
```
|
|
96
46
|
|
|
97
|
-
|
|
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.
|
|
98
50
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- No UI components shipped
|
|
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.
|
|
102
53
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
54
|
+
```tsx
|
|
55
|
+
// src/puck.config.tsx
|
|
56
|
+
import type { Config } from '@puckeditor/core';
|
|
57
|
+
import { Text } from './components/puck/Text';
|
|
107
58
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
59
|
+
const puckConfig: Config = {
|
|
60
|
+
components: {
|
|
61
|
+
Text,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
111
64
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
- Routes are generated at build time
|
|
115
|
-
- Uses Vite's virtual module system
|
|
65
|
+
export default puckConfig;
|
|
66
|
+
```
|
|
116
67
|
|
|
117
|
-
|
|
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.
|
|
118
70
|
|
|
119
|
-
|
|
71
|
+
#### 2. `src/content.config.ts`
|
|
120
72
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
- Not limited to `tsc` only
|
|
124
|
-
- Example: Bundle React app and serve via middleware
|
|
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.
|
|
125
75
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
- Example: CSS files, images, bundled JavaScript
|
|
76
|
+
```ts
|
|
77
|
+
import { conlocaData, conlocaFragments, conlocaPages } from '@conloca/astro-cms/node/content';
|
|
78
|
+
import { dataSchemas, pageSchemas } from './schemas';
|
|
130
79
|
|
|
131
|
-
|
|
80
|
+
export const collections = {
|
|
81
|
+
pages: conlocaPages({ pageSchemas }),
|
|
82
|
+
...conlocaData({ dataSchemas }),
|
|
83
|
+
...conlocaFragments('general'),
|
|
84
|
+
};
|
|
85
|
+
```
|
|
132
86
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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.
|
|
92
|
+
|
|
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. The editor saves new fragments in the `fragments` folder, and every form of `conlocaFragments(...)`
|
|
99
|
+
declares that folder, so it never needs naming for the build to accept it.
|
|
100
|
+
|
|
101
|
+
A site with no MDX fragments yet prints this once per rendered page, and it is expected — nothing is wrong with the file
|
|
102
|
+
this message points at:
|
|
103
|
+
|
|
104
|
+
```plain
|
|
105
|
+
The collection "__conloca_fragments" does not exist or is empty. Please check your content config file for errors.
|
|
106
|
+
```
|
|
139
107
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
entrypoint: '@my-pkg/spa-handler',
|
|
144
|
-
});
|
|
145
|
-
```
|
|
108
|
+
Astro prints it from `getCollection()` whenever a collection holds no entries, and there is no way to register an empty
|
|
109
|
+
one — leaving the collection out produces the very same message. It stops as soon as the site has one published
|
|
110
|
+
fragment.
|
|
146
111
|
|
|
147
|
-
|
|
112
|
+
#### 3. `content/sites.json`
|
|
148
113
|
|
|
149
|
-
|
|
114
|
+
Lives at the root of `contentRoot` and declares the sites and their locales. A single-site setup names its site
|
|
115
|
+
`default`, which is the site name every other default assumes.
|
|
150
116
|
|
|
151
117
|
```json
|
|
152
118
|
{
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
|
|
119
|
+
"sites": {
|
|
120
|
+
"default": {
|
|
121
|
+
"locales": ["en"],
|
|
122
|
+
"defaultLocale": "en"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"globalLocales": ["en"]
|
|
156
126
|
}
|
|
157
127
|
```
|
|
158
128
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
- Including source .astro files in npm package
|
|
162
|
-
- Proper export configuration
|
|
163
|
-
- User's Astro instance compiles them at build time
|
|
129
|
+
If the file is missing the CMS logs a warning and falls back to an empty site list, which means no page collections get
|
|
130
|
+
created — the same symptom as a missing content config.
|
|
164
131
|
|
|
165
|
-
|
|
132
|
+
#### 4. The layout named by `layout`
|
|
166
133
|
|
|
167
|
-
|
|
134
|
+
An ordinary Astro layout. It receives `title` and `description`, and renders the page body through `<slot />`. It also
|
|
135
|
+
receives `page`, the page being rendered with its settings in `page.meta`; read extra head fields such as an Open Graph
|
|
136
|
+
image from there rather than querying the collection again.
|
|
168
137
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
138
|
+
```astro
|
|
139
|
+
---
|
|
140
|
+
interface Props {
|
|
141
|
+
title?: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
}
|
|
172
144
|
|
|
173
|
-
|
|
145
|
+
const { title, description } = Astro.props;
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
<!doctype html>
|
|
149
|
+
<html lang="en">
|
|
150
|
+
<head>
|
|
151
|
+
<meta charset="utf-8" />
|
|
152
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
153
|
+
<title>{title ?? 'My site'}</title>
|
|
154
|
+
{description && <meta name="description" content={description} />}
|
|
155
|
+
</head>
|
|
156
|
+
<body>
|
|
157
|
+
<slot />
|
|
158
|
+
</body>
|
|
159
|
+
</html>
|
|
160
|
+
```
|
|
174
161
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
162
|
+
Supplying `layout` and nothing else turns on a catch-all `/[...slug]` route over the `pages` collection with a `404`
|
|
163
|
+
fallback. Sites that need more than one route drop `layout` and use `routing.routes.<name>.layout` instead.
|
|
164
|
+
|
|
165
|
+
With those four files in place, run the Astro dev server and open `/__cms`.
|
|
166
|
+
|
|
167
|
+
### Options
|
|
168
|
+
|
|
169
|
+
Passed to `conlocaCMS({ ... })`. Only two are required.
|
|
170
|
+
|
|
171
|
+
| Option | Required | What it does |
|
|
172
|
+
| ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
173
|
+
| `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. |
|
|
174
|
+
| `puckConfigPath` | yes | Module whose default export is the Puck `Config`. Supplies the visual editor's component palette and seeds component auto-discovery. |
|
|
175
|
+
| `canvasDir` | no | Directory for canvas documents. |
|
|
176
|
+
| `route` | no | Where the CMS mounts. Defaults to `/__cms`. |
|
|
177
|
+
| `layout` | no | Default layout for content pages. On its own it enables routing with a catch-all pattern. |
|
|
178
|
+
| `routing` | no | Full routing configuration, for sites with more than one content route. |
|
|
179
|
+
| `templates` | no | Page templates offered in the create-page dialog. |
|
|
180
|
+
| `schemasPath` | no | Module exporting `dataSchemas`, `pageSchemas` and `mdxComponents`. Drives the page-settings form and the MDX component registry. |
|
|
181
|
+
| `componentPaths` | no | Extra folders to scan for components wrapped in `withHydration()`. |
|
|
182
|
+
| `mdxComponentFolders` | no | Folders scanned for locally authored MDX components, whose `interface Props` becomes the editor's prop panel. Defaults to `['src/components/mdx']`. |
|
|
183
|
+
| `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. |
|
|
184
|
+
| `siteStyles` | no | CSS injected into the Puck preview iframe so components render with site styling. |
|
|
185
|
+
| `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. |
|
|
186
|
+
| `editorCSS` | no | Raw CSS applied after auto-discovered host styles in the editor's host-preview layer. |
|
|
187
|
+
| `fragmentPreviewRoute` | no | Route whose styles and content wrapper frame the standalone fragment editor. Defaults to `/`. |
|
|
188
|
+
| `locales` | no | The site's locales and default locale. Without it: the site's `locales` and `defaultLocale` in `sites.json`, else `globalLocales`. |
|
|
189
|
+
|
|
190
|
+
`ConlocaCMSOptions` also extends the editor's `UIConfig` (minus `basename`), so fields such as `apiBaseUrl`,
|
|
191
|
+
`siteBaseUrl`, `enableDevtools`, `queryClientOptions`, `projectRoot` and `hosted` are accepted as well. Those exist for
|
|
192
|
+
hosts that embed the editor in their own shell; an ordinary Astro site leaves them alone.
|
|
193
|
+
|
|
194
|
+
**`puckConfigPath` and `schemasPath` are unrelated options.** They resolve different files, feed different parts of the
|
|
195
|
+
CMS, and neither falls back to the other. `puckConfigPath` is required and supplies the visual page editor's component
|
|
196
|
+
palette. `schemasPath` is optional and supplies frontmatter forms plus the MDX component registry described below.
|
|
197
|
+
Setting `schemasPath` does not make `puckConfigPath` unnecessary, and a site with no `schemasPath` still works — it just
|
|
198
|
+
has no custom page-settings fields and no registered MDX components.
|
|
199
|
+
|
|
200
|
+
### Sitemap for on-demand pages
|
|
201
|
+
|
|
202
|
+
A static build writes a file for every published page, and `@astrojs/sitemap` lists those by itself. A route with
|
|
203
|
+
`prerender: false` renders its pages on demand instead, so there is no file to find and the sitemap leaves them out.
|
|
204
|
+
`conlocaSitemapOptions` returns the two `@astrojs/sitemap` options the CMS's pages need: `customPages`, the full address
|
|
205
|
+
of every published page the CMS routes serve, and `serialize`, which gives each of them its last-edit date as
|
|
206
|
+
`<lastmod>`. Addresses follow your `site`, `base`, `trailingSlash` and `build.format`, so hand it the same settings you
|
|
207
|
+
give Astro, along with the same options as `conlocaCMS()`:
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
import node from '@astrojs/node';
|
|
211
|
+
import react from '@astrojs/react';
|
|
212
|
+
import sitemap from '@astrojs/sitemap';
|
|
213
|
+
import { conlocaCMS, conlocaSitemapOptions } from '@conloca/astro-cms/node';
|
|
214
|
+
import { defineConfig } from 'astro/config';
|
|
215
|
+
|
|
216
|
+
// Every setting that decides a page's address, shared by Astro and the sitemap.
|
|
217
|
+
const urls = { site: 'https://example.com', trailingSlash: 'always' };
|
|
218
|
+
const cmsOptions = {
|
|
219
|
+
contentRoot: './content',
|
|
220
|
+
puckConfigPath: './src/puck.config.tsx',
|
|
221
|
+
routing: {
|
|
222
|
+
routes: {
|
|
223
|
+
pages: { pattern: '/[...slug]', layout: './src/layouts/Layout.astro', prerender: false },
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
};
|
|
179
227
|
|
|
180
|
-
|
|
228
|
+
export default defineConfig({
|
|
229
|
+
...urls,
|
|
230
|
+
adapter: node({ mode: 'standalone' }),
|
|
231
|
+
integrations: [react(), sitemap(await conlocaSitemapOptions(cmsOptions, urls)), conlocaCMS(cmsOptions)],
|
|
232
|
+
});
|
|
233
|
+
```
|
|
181
234
|
|
|
182
|
-
|
|
235
|
+
The list is read when the config loads, so publish and unpublish dates count as of the build. If a CMS route is
|
|
236
|
+
prerendered after all, its pages get the address Astro gives them, so each appears once, not twice. Pages are listed in
|
|
237
|
+
the language the CMS routes serve (`routing.locale`), because the routes give other languages no address. A page whose
|
|
238
|
+
last-edit date cannot be read is listed without `<lastmod>` instead of failing the build. To pass sitemap options of
|
|
239
|
+
your own as well, put them in one object with these, as in
|
|
240
|
+
`sitemap({ ...(await conlocaSitemapOptions(cmsOptions, urls)), changefreq: 'weekly' })`. A `serialize` of your own
|
|
241
|
+
replaces this one, so call this one inside it.
|
|
183
242
|
|
|
184
|
-
|
|
185
|
-
React:
|
|
243
|
+
### Listing CMS pages on an Astro page
|
|
186
244
|
|
|
187
|
-
|
|
245
|
+
A block on a CMS page gets its list of pages from the route's `dataBindings.pages`. An ordinary Astro page, such as a
|
|
246
|
+
blog index or an RSS route, asks for the same list through `@conloca/astro-cms/page-feed`:
|
|
188
247
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
- The output is an `AstroComponentFactory` function, not a React component
|
|
193
|
-
- Components include metadata for hydration, slots, and server-side rendering
|
|
248
|
+
```astro
|
|
249
|
+
---
|
|
250
|
+
import { getPagesByPrefix } from '@conloca/astro-cms/page-feed';
|
|
194
251
|
|
|
195
|
-
|
|
196
|
-
|
|
252
|
+
const posts = await getPagesByPrefix('/blog/');
|
|
253
|
+
---
|
|
197
254
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
moduleId?: string;
|
|
203
|
-
propagation?: PropagationHint;
|
|
204
|
-
}
|
|
205
|
-
```
|
|
255
|
+
<ul>
|
|
256
|
+
{posts.map((post) => <li><a href={post.pathname}>{post.title}</a></li>)}
|
|
257
|
+
</ul>
|
|
258
|
+
```
|
|
206
259
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
260
|
+
The list holds the published pages under the prefix, in the site's language, without the page at the prefix itself. Each
|
|
261
|
+
entry is a `PageReference`: `meta` carries the page's own fields, including the ones `pageSchemas` declares, and
|
|
262
|
+
`timestamps` carries created, modified and published dates. `published` is the page's publish time or, when it has none,
|
|
263
|
+
its creation time. The second argument takes `sort` (`'date-desc'`, the default, puts the newest publish date first, so
|
|
264
|
+
editing a page never moves it; `'date-asc'` and `'title'` are the others; pages that tie are listed by path), `limit`,
|
|
265
|
+
and `locale` to read another language. It reads the pages of the content routes `conlocaCMS()` serves, so it needs
|
|
266
|
+
`layout` or `routing` set there and throws when neither is.
|
|
212
267
|
|
|
213
|
-
|
|
268
|
+
## MDX component registry
|
|
214
269
|
|
|
215
|
-
|
|
270
|
+
Hosts can register JSX components (their own, or third-party ones like Starlight's `<Steps>`, `<Tabs>`, `<Card>`) with
|
|
271
|
+
the MDX editor so authors get typed insert affordances and optional auto-import injection. The registry is wired through
|
|
272
|
+
the same `schemasPath` option that already loads `pageSchemas` — add an `mdxComponents` export to the file and the CMS
|
|
273
|
+
picks it up at boot (and on HMR).
|
|
216
274
|
|
|
217
|
-
```
|
|
218
|
-
//
|
|
219
|
-
import {
|
|
220
|
-
import { getContainerRenderer } from '@astrojs/react';
|
|
221
|
-
import Component from '../src/components/Component.astro';
|
|
275
|
+
```ts
|
|
276
|
+
// src/schemas.ts
|
|
277
|
+
import { defineMdxComponents } from '@conloca/astro-cms';
|
|
222
278
|
|
|
223
|
-
const
|
|
224
|
-
renderers: [getContainerRenderer()],
|
|
225
|
-
});
|
|
279
|
+
export const pageSchemas = {/* existing entries */};
|
|
226
280
|
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
281
|
+
export const mdxComponents = defineMdxComponents([
|
|
282
|
+
{
|
|
283
|
+
name: 'Steps',
|
|
284
|
+
kind: 'flow',
|
|
285
|
+
hasChildren: true,
|
|
286
|
+
insert: { label: 'Steps', description: 'Numbered step-by-step list', icon: 'list-ordered' },
|
|
287
|
+
defaults: { children: '1. First step\n2. Second step\n3. Third step' },
|
|
288
|
+
import: { from: '@astrojs/starlight/components' },
|
|
230
289
|
},
|
|
231
|
-
|
|
232
|
-
|
|
290
|
+
// …other components your site uses
|
|
291
|
+
]);
|
|
233
292
|
```
|
|
234
293
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
- Render .astro components to HTML strings server-side
|
|
240
|
-
- Display in React using `dangerouslySetInnerHTML`
|
|
241
|
-
- No client-side interactivity preserved
|
|
242
|
-
- Requires API endpoint to render components on demand
|
|
294
|
+
Starlight components are declared the same way as any other component — the CMS does not ship Starlight descriptors.
|
|
295
|
+
Copy the props you need from each component's source (e.g.
|
|
296
|
+
`node_modules/@astrojs/starlight/user-components/<Component>.astro`).
|
|
243
297
|
|
|
244
|
-
|
|
298
|
+
In the editor, registered components appear in two places:
|
|
245
299
|
|
|
246
|
-
-
|
|
247
|
-
-
|
|
248
|
-
- Not designed for embedding within React components
|
|
249
|
-
- Would require significant work to integrate with React's lifecycle
|
|
300
|
+
- A slash menu, opened by typing `/` in the body. Filter by name, label, description, or keywords.
|
|
301
|
+
- A toolbar dropdown next to the admonition button, listing block-level (`kind: 'flow'`) components.
|
|
250
302
|
|
|
251
|
-
|
|
303
|
+
### Auto-import injection (and its pruning caveat)
|
|
252
304
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
### Recommendation
|
|
258
|
-
|
|
259
|
-
**Use React components in Puck, not .astro components:**
|
|
260
|
-
|
|
261
|
-
1. Create shared React components that can be used by both:
|
|
262
|
-
- Astro pages (via React integration)
|
|
263
|
-
- Puck editor (native React)
|
|
264
|
-
|
|
265
|
-
2. Example structure:
|
|
266
|
-
|
|
267
|
-
```
|
|
268
|
-
src/
|
|
269
|
-
components/
|
|
270
|
-
Hero.tsx # React component
|
|
271
|
-
Card.tsx # React component
|
|
272
|
-
pages/
|
|
273
|
-
index.astro # Uses React components
|
|
274
|
-
puck.config.ts # Also uses React components
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
3. Benefits:
|
|
278
|
-
- Full interactivity in the CMS
|
|
279
|
-
- Consistent behavior between CMS preview and production
|
|
280
|
-
- No complex wrapping or conversion needed
|
|
281
|
-
- Proper TypeScript support and props validation
|
|
282
|
-
|
|
283
|
-
### Technical Constraints
|
|
284
|
-
|
|
285
|
-
Based on the source code analysis:
|
|
286
|
-
|
|
287
|
-
1. **No React Wrapper Exists**: Astro doesn't provide a way to wrap .astro components for use in React
|
|
288
|
-
2. **Different Rendering Models**: Astro's server-first, partial hydration model is incompatible with React's
|
|
289
|
-
client-side model
|
|
290
|
-
3. **Container API Limitations**: Only provides server-side rendering to HTML strings, not interactive components
|
|
291
|
-
|
|
292
|
-
### Conclusion
|
|
293
|
-
|
|
294
|
-
While .astro components excel at server-side rendering with selective hydration, they cannot be meaningfully wrapped as
|
|
295
|
-
React components for use in Puck. The recommended approach is to use React components throughout the Puck configuration,
|
|
296
|
-
which can also be used in Astro pages via the React integration.
|
|
297
|
-
|
|
298
|
-
## Astro Development Mode and HMR
|
|
299
|
-
|
|
300
|
-
### How Astro Handles Hot Module Replacement
|
|
301
|
-
|
|
302
|
-
Based on analysis of the Astro source code:
|
|
303
|
-
|
|
304
|
-
1. **Compilation Pipeline**
|
|
305
|
-
([astro/packages/astro/src/vite-plugin-astro/index.ts](https://github.com/withastro/astro/blob/main/packages/astro/src/vite-plugin-astro/index.ts)):
|
|
306
|
-
- `@astrojs/compiler` transforms .astro files into JavaScript
|
|
307
|
-
- `vite-plugin-astro` orchestrates this compilation
|
|
308
|
-
- The plugin integrates with Vite's module system
|
|
309
|
-
|
|
310
|
-
2. **HMR Implementation**
|
|
311
|
-
([astro/packages/astro/src/vite-plugin-astro/hmr.ts](https://github.com/withastro/astro/blob/main/packages/astro/src/vite-plugin-astro/hmr.ts)):
|
|
312
|
-
- Vite watches for file changes and triggers `handleHotUpdate`
|
|
313
|
-
- Astro optimizes HMR for specific change types:
|
|
314
|
-
- Style-only changes: Only CSS virtual modules are invalidated
|
|
315
|
-
- CSS dependencies: Invalidates compile metadata when CSS imports change
|
|
316
|
-
- Full changes: Re-compiles the entire component
|
|
317
|
-
- Vite's HMR system propagates updates to the browser
|
|
318
|
-
|
|
319
|
-
3. **Development Flow**:
|
|
320
|
-
```
|
|
321
|
-
.astro file changes → Vite detects → vite-plugin-astro compiles →
|
|
322
|
-
@astrojs/compiler transforms → JavaScript output → Vite HMR update → Browser
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
### Implications for Puck Config Loading
|
|
326
|
-
|
|
327
|
-
Since Vite handles all module loading and HMR in Astro's dev mode:
|
|
328
|
-
|
|
329
|
-
1. **Virtual Modules**: We can use Vite's virtual module system to serve the Puck config
|
|
330
|
-
2. **Automatic HMR**: Changes to puck.config.ts will trigger HMR automatically
|
|
331
|
-
3. **Component Bundling**: Vite will handle bundling React components in the config
|
|
332
|
-
4. **No Custom Build**: We don't need a separate build process for the config
|
|
333
|
-
|
|
334
|
-
Example virtual module approach:
|
|
335
|
-
|
|
336
|
-
```typescript
|
|
337
|
-
// In the Astro plugin
|
|
338
|
-
vite: {
|
|
339
|
-
plugins: [
|
|
340
|
-
{
|
|
341
|
-
name: 'conloca-cms-config',
|
|
342
|
-
resolveId(id) {
|
|
343
|
-
if (id === 'virtual:conloca-cms/puck-config') {
|
|
344
|
-
return '\0virtual:conloca-cms/puck-config';
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
load(id) {
|
|
348
|
-
if (id === '\0virtual:conloca-cms/puck-config') {
|
|
349
|
-
return `
|
|
350
|
-
import { puckConfig } from '${userPuckConfigPath}';
|
|
351
|
-
export default puckConfig;
|
|
352
|
-
`;
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
},
|
|
356
|
-
];
|
|
357
|
-
}
|
|
358
|
-
```
|
|
305
|
+
Setting `import: { from: '<module>' }` on a descriptor opts the component into automatic import injection: whenever the
|
|
306
|
+
component appears in the document, the CMS save serializer emits the matching `import { Name } from '<module>'` line at
|
|
307
|
+
the top of the file (after frontmatter).
|
|
359
308
|
|
|
360
|
-
|
|
309
|
+
**Important: the editor rebuilds the import block on every save from components actually referenced in the tree.**
|
|
310
|
+
Imports for unused components are dropped. So are non-JSX imports — type imports, side-effect imports
|
|
311
|
+
(`import './styles.css'`), and helper-function imports — because the editor does not consider them "referred to" by a
|
|
312
|
+
JSX node. This is a hard constraint of the underlying `@mdxeditor/editor` export pipeline (see
|
|
313
|
+
`dist/exportMarkdownFromLexical.js` in that package), not a policy choice.
|
|
361
314
|
|
|
362
|
-
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
315
|
+
For Starlight-flavored docs (where MDX only imports Starlight components from `@astrojs/starlight/components`) the
|
|
316
|
+
behavior matches authorial intent — imports follow usage. For richer MDX that relies on type or side-effect imports,
|
|
317
|
+
edit those files in your IDE rather than the CMS, or omit `import.from` from your descriptors so the editor does not
|
|
318
|
+
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;
|