@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
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Drop-in replacement for `@tiptap/html` wherever the site's build resolves it, in
|
|
2
|
+
// the editor and in the server render alike: same named exports, no happy-dom and
|
|
3
|
+
// no `node:vm`. The richtext field render imports `generateHTML`/`generateJSON`
|
|
4
|
+
// from `@tiptap/html`; its browser build needs `window`, and its `/server` build
|
|
5
|
+
// fakes one with happy-dom — whose `Window` constructor calls `node:vm`
|
|
6
|
+
// (`Script.runInContext`). Workers runtimes ship `node:vm` as a stub, so that
|
|
7
|
+
// call throws at render time and every richtext section on the page dies. Here
|
|
8
|
+
// ProseMirror's own serializer, the one `@tiptap/html` runs, writes into a few
|
|
9
|
+
// string-backed elements instead of a DOM, so the same markup comes out on any
|
|
10
|
+
// engine; reading HTML back takes the browser's own parser, or linkedom where
|
|
11
|
+
// there is none.
|
|
12
|
+
import { getSchema } from '@tiptap/core';
|
|
13
|
+
import { DOMSerializer, DOMParser as ProseMirrorDOMParser, Node as ProseMirrorNode, } from '@tiptap/pm/model';
|
|
14
|
+
import { parseHTML } from 'linkedom/worker';
|
|
15
|
+
// Elements the HTML parser closes on its own, so a DOM serializer writes no end tag.
|
|
16
|
+
const VOID_ELEMENTS = new Set([
|
|
17
|
+
'area',
|
|
18
|
+
'base',
|
|
19
|
+
'br',
|
|
20
|
+
'col',
|
|
21
|
+
'embed',
|
|
22
|
+
'hr',
|
|
23
|
+
'img',
|
|
24
|
+
'input',
|
|
25
|
+
'link',
|
|
26
|
+
'meta',
|
|
27
|
+
'param',
|
|
28
|
+
'source',
|
|
29
|
+
'track',
|
|
30
|
+
'wbr',
|
|
31
|
+
]);
|
|
32
|
+
const escapeText = (text) => text
|
|
33
|
+
.replace(/&/g, '&')
|
|
34
|
+
.replace(/\u00a0/g, ' ')
|
|
35
|
+
.replace(/</g, '<')
|
|
36
|
+
.replace(/>/g, '>');
|
|
37
|
+
const escapeAttribute = (value) => escapeText(value).replace(/"/g, '"');
|
|
38
|
+
class StringText {
|
|
39
|
+
text;
|
|
40
|
+
nodeType = 3;
|
|
41
|
+
constructor(text) {
|
|
42
|
+
this.text = text;
|
|
43
|
+
}
|
|
44
|
+
toString() {
|
|
45
|
+
return escapeText(this.text);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* An element as far as ProseMirror's serializer uses one: attributes in the
|
|
50
|
+
* order they were set, children appended. Having no `style` object, it takes
|
|
51
|
+
* `style` as a plain attribute, as written.
|
|
52
|
+
*/
|
|
53
|
+
class StringElement {
|
|
54
|
+
tagName;
|
|
55
|
+
nodeType = 1;
|
|
56
|
+
attributes = new Map();
|
|
57
|
+
children = [];
|
|
58
|
+
constructor(tagName) {
|
|
59
|
+
this.tagName = tagName;
|
|
60
|
+
}
|
|
61
|
+
setAttribute(name, value) {
|
|
62
|
+
this.attributes.set(name, String(value));
|
|
63
|
+
}
|
|
64
|
+
setAttributeNS(_namespace, name, value) {
|
|
65
|
+
this.setAttribute(name, value);
|
|
66
|
+
}
|
|
67
|
+
appendChild(child) {
|
|
68
|
+
this.children.push(child);
|
|
69
|
+
return child;
|
|
70
|
+
}
|
|
71
|
+
get innerHTML() {
|
|
72
|
+
return this.children.join('');
|
|
73
|
+
}
|
|
74
|
+
toString() {
|
|
75
|
+
const attributes = [...this.attributes].map(([name, value]) => ` ${name}="${escapeAttribute(value)}"`).join('');
|
|
76
|
+
const open = `<${this.tagName}${attributes}>`;
|
|
77
|
+
return VOID_ELEMENTS.has(this.tagName) ? open : `${open}${this.innerHTML}</${this.tagName}>`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const stringDocument = {
|
|
81
|
+
createElement: (tagName) => new StringElement(tagName),
|
|
82
|
+
createElementNS: (_namespace, tagName) => new StringElement(tagName),
|
|
83
|
+
createTextNode: (text) => new StringText(text),
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Generates HTML from a ProseMirror JSON document, without a DOM. The
|
|
87
|
+
* serializer keeps a mark's element open across the runs that share it, so a
|
|
88
|
+
* link with one underlined word stays one link.
|
|
89
|
+
*/
|
|
90
|
+
export function generateHTML(doc, extensions) {
|
|
91
|
+
const schema = getSchema(extensions);
|
|
92
|
+
const root = new StringElement('div');
|
|
93
|
+
// The string-backed elements cover every DOM call the serializer makes, under types of their own.
|
|
94
|
+
DOMSerializer.fromSchema(schema).serializeFragment(ProseMirrorNode.fromJSON(schema, doc).content, { document: stringDocument }, root);
|
|
95
|
+
return root.innerHTML;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Reads an HTML string into a ProseMirror JSON document. The richtext field stores
|
|
99
|
+
* the editor's HTML and its render reads it back through here. A browser parses
|
|
100
|
+
* with its own DOMParser; a server render has none, so linkedom parses there —
|
|
101
|
+
* plain JavaScript without `node:vm`, so it runs in Workers runtimes too.
|
|
102
|
+
*/
|
|
103
|
+
export function generateJSON(html, extensions, options) {
|
|
104
|
+
const parser = ProseMirrorDOMParser.fromSchema(getSchema(extensions));
|
|
105
|
+
if (typeof globalThis.DOMParser === 'function') {
|
|
106
|
+
const { body } = new globalThis.DOMParser().parseFromString(html, 'text/html');
|
|
107
|
+
return parser.parse(body, options).toJSON();
|
|
108
|
+
}
|
|
109
|
+
const { document } = parseHTML(`<!DOCTYPE html><html><body>${html}</body></html>`);
|
|
110
|
+
// linkedom's elements implement the part of the DOM ProseMirror reads, under types of their own.
|
|
111
|
+
const doc = parser.parse(document.body, options).toJSON();
|
|
112
|
+
// linkedom answers `getAttribute('class')` with "" for an element that has no
|
|
113
|
+
// class, where a browser answers null, so every link would read back with an
|
|
114
|
+
// empty class and render as `class=""`. Give the null back.
|
|
115
|
+
return JSON.parse(JSON.stringify(doc), (key, value) => (key === 'class' && value === '' ? null : value));
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=tiptap-html-static.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiptap-html-static.js","sourceRoot":"","sources":["../../../src/tiptap-html-static.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,kFAAkF;AAClF,gFAAgF;AAChF,iFAAiF;AACjF,wEAAwE;AACxE,8EAA8E;AAC9E,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,iBAAiB;AACjB,OAAO,EAAmB,SAAS,EAAoB,MAAM,cAAc,CAAC;AAC5E,OAAO,EACL,aAAa,EAEb,SAAS,IAAI,oBAAoB,EACjC,IAAI,IAAI,eAAe,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qFAAqF;AACrF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,MAAM;IACN,MAAM;IACN,IAAI;IACJ,KAAK;IACL,OAAO;IACP,IAAI;IACJ,KAAK;IACL,O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D,IAA8B,CAC/B,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CAAC;AACxB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,UAAsB,EAAE,OAAsB;IACvF,MAAM,MAAM,GAAG,oBAAoB,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;QAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC/E,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9C,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,8BAA8B,IAAI,gBAAgB,CAAC,CAAC;IACnF,iGAAiG;IACjG,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAuB,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7E,8EAA8E;IAC9E,6EAA6E;IAC7E,4DAA4D;IAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3G,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataBindingConfig, PageReference } from '@conloca/content-api';
|
|
1
2
|
import type { Data } from '@puckeditor/core';
|
|
2
3
|
/**
|
|
3
4
|
* Hydration strategy for Puck components in production.
|
|
@@ -21,6 +22,7 @@ import type { Data } from '@puckeditor/core';
|
|
|
21
22
|
* - 'idle': Hydrate when browser is idle (client:idle)
|
|
22
23
|
*/
|
|
23
24
|
export type HydrationStrategy = 'none' | 'load' | 'visible' | 'idle';
|
|
25
|
+
export type { ContentFragmentSectionProps } from '@conloca/cms-spa';
|
|
24
26
|
/**
|
|
25
27
|
* Configuration for Conloca's content page routing system.
|
|
26
28
|
*
|
|
@@ -90,11 +92,13 @@ export interface RoutingConfig {
|
|
|
90
92
|
/**
|
|
91
93
|
* Behavior when a route pattern matches but no content exists.
|
|
92
94
|
*
|
|
93
|
-
* - '404': Return a 404 response (standard behavior)
|
|
94
|
-
* - 'passthrough':
|
|
95
|
+
* - '404': Return a bare 404 response (standard behavior)
|
|
96
|
+
* - 'passthrough': Hand the miss back to Astro's own error handling, which
|
|
97
|
+
* renders the site's /404 route (prerendered included) with a real 404
|
|
98
|
+
* status — never a redirect or a soft-404
|
|
95
99
|
*
|
|
96
|
-
* 'passthrough' is useful when
|
|
97
|
-
*
|
|
100
|
+
* 'passthrough' is useful when the site has its own designed /404 page
|
|
101
|
+
* that should answer for paths the CMS doesn't know.
|
|
98
102
|
*
|
|
99
103
|
* @default '404'
|
|
100
104
|
*/
|
|
@@ -215,6 +219,11 @@ export interface RouteConfig {
|
|
|
215
219
|
*
|
|
216
220
|
* IMPORTANT: Pattern must start with '/'
|
|
217
221
|
* IMPORTANT: Catch-all patterns ([...param]) capture everything after the prefix
|
|
222
|
+
* IMPORTANT: The parameter name must be unique among the site's routes — Astro's
|
|
223
|
+
* runtime resolves a page's stylesheets by route name, so a Conloca route named
|
|
224
|
+
* like another integration's (Starlight's docs route is '/[...slug]') breaks
|
|
225
|
+
* the styling of one or the other in server output or when rendered on demand.
|
|
226
|
+
* Conloca fails such a build; pick another name, e.g. '/[...page]'.
|
|
218
227
|
*/
|
|
219
228
|
pattern: string;
|
|
220
229
|
/**
|
|
@@ -387,29 +396,18 @@ export interface PageData {
|
|
|
387
396
|
* Schema depends on the site's content configuration.
|
|
388
397
|
*/
|
|
389
398
|
meta?: Record<string, unknown>;
|
|
390
|
-
/**
|
|
391
|
-
|
|
392
|
-
*/
|
|
393
|
-
timestamps?: {
|
|
394
|
-
/**
|
|
395
|
-
* When the page was first created.
|
|
396
|
-
*/
|
|
397
|
-
created?: Date;
|
|
398
|
-
/**
|
|
399
|
-
* When the page was last modified.
|
|
400
|
-
*/
|
|
401
|
-
modified?: Date;
|
|
402
|
-
/**
|
|
403
|
-
* When the page was published (if different from created).
|
|
404
|
-
*/
|
|
405
|
-
published?: Date;
|
|
406
|
-
};
|
|
399
|
+
/** The page's dates, as on PageReference. */
|
|
400
|
+
timestamps?: PageReference['timestamps'];
|
|
407
401
|
}
|
|
408
402
|
/**
|
|
409
403
|
* Props passed to layout components wrapping page content.
|
|
410
404
|
*
|
|
411
405
|
* Layouts receive common props (title, description) that work with
|
|
412
406
|
* most existing layouts. No special Conloca-specific layout needed.
|
|
407
|
+
* A layout that needs more of the page's settings (an Open Graph image,
|
|
408
|
+
* structured data) reads them from `page` instead of looking the page up
|
|
409
|
+
* again, because a second lookup would have to repeat the handler's language,
|
|
410
|
+
* publication and preview rules.
|
|
413
411
|
*
|
|
414
412
|
* @example Astro layout usage
|
|
415
413
|
* ```astro
|
|
@@ -462,6 +460,12 @@ export interface LayoutProps {
|
|
|
462
460
|
* Page description for SEO meta tag.
|
|
463
461
|
*/
|
|
464
462
|
description?: string;
|
|
463
|
+
/**
|
|
464
|
+
* The page being rendered, with its settings in `meta`: the version in the
|
|
465
|
+
* route's language that the handler matched, published or the draft a
|
|
466
|
+
* preview renders.
|
|
467
|
+
*/
|
|
468
|
+
page: PageReference;
|
|
465
469
|
/**
|
|
466
470
|
* The rendered Puck content.
|
|
467
471
|
*
|
|
@@ -493,95 +497,7 @@ export interface ResolvedRoutingConfig {
|
|
|
493
497
|
/** Default locale for content resolution. */
|
|
494
498
|
locale: string;
|
|
495
499
|
}
|
|
496
|
-
|
|
497
|
-
* Configuration for automatic data collection injection into Puck components.
|
|
498
|
-
*
|
|
499
|
-
* Allows components to declare data dependencies on Conloca data collections,
|
|
500
|
-
* which are automatically fetched and injected via Puck's metadata system.
|
|
501
|
-
*
|
|
502
|
-
* @example Route with data bindings
|
|
503
|
-
* ```typescript
|
|
504
|
-
* conlocaCMS({
|
|
505
|
-
* routing: {
|
|
506
|
-
* routes: {
|
|
507
|
-
* pages: {
|
|
508
|
-
* pattern: '/[...slug]',
|
|
509
|
-
* dataBindings: {
|
|
510
|
-
* collections: ['team', 'testimonials'],
|
|
511
|
-
* },
|
|
512
|
-
* },
|
|
513
|
-
* },
|
|
514
|
-
* },
|
|
515
|
-
* });
|
|
516
|
-
* ```
|
|
517
|
-
*/
|
|
518
|
-
export interface DataBindingConfig {
|
|
519
|
-
/**
|
|
520
|
-
* Collections to fetch and inject into component resolvers.
|
|
521
|
-
*
|
|
522
|
-
* Each collection name must match a data collection in the content directory.
|
|
523
|
-
* The fetched data will be available in `metadata.collections[collectionName]`
|
|
524
|
-
* within Puck component resolvers.
|
|
525
|
-
*
|
|
526
|
-
* @example ['team', 'testimonials', 'products']
|
|
527
|
-
*/
|
|
528
|
-
collections?: string[];
|
|
529
|
-
/**
|
|
530
|
-
* Locale override for data fetching.
|
|
531
|
-
*
|
|
532
|
-
* Defaults to the route's locale setting (from routing.locale).
|
|
533
|
-
* Use this to fetch data in a specific locale regardless of route config.
|
|
534
|
-
*/
|
|
535
|
-
locale?: string;
|
|
536
|
-
/**
|
|
537
|
-
* Page discovery configuration for listing pages by path prefix.
|
|
538
|
-
*
|
|
539
|
-
* Enables components to access lists of pages matching a URL pattern,
|
|
540
|
-
* useful for blog listings, category pages, and site navigation.
|
|
541
|
-
*
|
|
542
|
-
* @example Blog listing page
|
|
543
|
-
* ```typescript
|
|
544
|
-
* {
|
|
545
|
-
* pattern: '/blog',
|
|
546
|
-
* dataBindings: {
|
|
547
|
-
* pages: {
|
|
548
|
-
* prefix: '/blog/',
|
|
549
|
-
* sort: 'date-desc',
|
|
550
|
-
* limit: 10,
|
|
551
|
-
* },
|
|
552
|
-
* },
|
|
553
|
-
* }
|
|
554
|
-
* ```
|
|
555
|
-
*/
|
|
556
|
-
pages?: {
|
|
557
|
-
/**
|
|
558
|
-
* Path prefix to filter pages.
|
|
559
|
-
*
|
|
560
|
-
* Only pages whose pathname starts with this prefix are included.
|
|
561
|
-
* The listing page itself is excluded.
|
|
562
|
-
*
|
|
563
|
-
* @example '/blog/' matches '/blog/post-1', '/blog/post-2'
|
|
564
|
-
*/
|
|
565
|
-
prefix: string;
|
|
566
|
-
/**
|
|
567
|
-
* Maximum number of pages to return.
|
|
568
|
-
*
|
|
569
|
-
* Useful for showing "latest N posts" on a homepage or sidebar.
|
|
570
|
-
*/
|
|
571
|
-
limit?: number;
|
|
572
|
-
/**
|
|
573
|
-
* Sort order for returned pages.
|
|
574
|
-
*
|
|
575
|
-
* - 'date-desc': Newest first (by modified/created date)
|
|
576
|
-
* - 'date-asc': Oldest first
|
|
577
|
-
* - 'title': Alphabetical by title
|
|
578
|
-
*
|
|
579
|
-
* @default 'date-desc'
|
|
580
|
-
*/
|
|
581
|
-
sort?: 'date-desc' | 'date-asc' | 'title';
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
export type { DataCollectionEntry, DataContext, PageReference } from '@conloca/content-api';
|
|
500
|
+
export type { DataBindingConfig, DataCollectionEntry, DataContext, EditorDataBindings, PageReference, } from '@conloca/content-api';
|
|
585
501
|
/**
|
|
586
502
|
* Configuration for a page creation template.
|
|
587
503
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,SAA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Aa,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACxC,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB;AAGD,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* Type declarations for Conloca virtual modules.
|
|
3
3
|
*
|
|
4
4
|
* These modules are generated at build/dev time by the Vite plugin
|
|
5
|
-
* and provide routing configuration, layout components
|
|
6
|
-
*
|
|
5
|
+
* and provide routing configuration, layout components and Puck config
|
|
6
|
+
* to page handlers.
|
|
7
|
+
*
|
|
8
|
+
* Every type import lives INSIDE its `declare module` block so this file has
|
|
9
|
+
* no top-level import/export: a file that is itself a module turns these into
|
|
10
|
+
* augmentations of modules that must already resolve, which they never do.
|
|
7
11
|
*/
|
|
8
12
|
|
|
9
|
-
import type { LayoutProps, PageData, PageReference, ResolvedRoutingConfig } from '@conloca/astro-cms';
|
|
10
|
-
import type { Config } from '@puckeditor/core';
|
|
11
|
-
|
|
12
13
|
/**
|
|
13
14
|
* Virtual module: virtual:conloca-routing-config
|
|
14
15
|
*
|
|
@@ -16,6 +17,8 @@ import type { Config } from '@puckeditor/core';
|
|
|
16
17
|
* All defaults are applied before this module is generated.
|
|
17
18
|
*/
|
|
18
19
|
declare module 'virtual:conloca-routing-config' {
|
|
20
|
+
import type { ResolvedRoutingConfig } from '@conloca/astro-cms';
|
|
21
|
+
|
|
19
22
|
const config: ResolvedRoutingConfig;
|
|
20
23
|
export default config;
|
|
21
24
|
}
|
|
@@ -30,100 +33,14 @@ declare module 'virtual:conloca-routing-config' {
|
|
|
30
33
|
* is planned for future versions.
|
|
31
34
|
*/
|
|
32
35
|
declare module 'virtual:conloca-layout' {
|
|
36
|
+
import type { LayoutProps } from '@conloca/astro-cms';
|
|
37
|
+
|
|
33
38
|
type LayoutComponent = ((props: LayoutProps) => unknown) | undefined;
|
|
34
39
|
|
|
35
40
|
const Layout: LayoutComponent;
|
|
36
41
|
export default Layout;
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
/**
|
|
40
|
-
* Virtual module: virtual:conloca-page-api
|
|
41
|
-
*
|
|
42
|
-
* Provides ContentAPI-backed helpers for the dev-only CMS runtime.
|
|
43
|
-
* Public page routing uses Astro content collections directly.
|
|
44
|
-
*/
|
|
45
|
-
declare module 'virtual:conloca-page-api' {
|
|
46
|
-
/**
|
|
47
|
-
* Content configuration options for ContentAPI initialization.
|
|
48
|
-
* Useful for creating additional ContentAPI instances (e.g., for MDX evaluation).
|
|
49
|
-
*/
|
|
50
|
-
export const contentOptions: {
|
|
51
|
-
/** Path to content directory */
|
|
52
|
-
contentRoot: string;
|
|
53
|
-
/** Path to canvas/puck directory */
|
|
54
|
-
canvasDir: string;
|
|
55
|
-
/** Site name for content resolution */
|
|
56
|
-
siteName: string;
|
|
57
|
-
/** Default locale for content resolution */
|
|
58
|
-
locale: string;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Get all pages for static path generation.
|
|
63
|
-
* @param collection - Optional collection filter (defaults to all collections)
|
|
64
|
-
* @returns Array of page references with id, pathname, title, collection
|
|
65
|
-
*/
|
|
66
|
-
export function getAllPages(collection?: string): Promise<PageReference[]>;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Load full page data for rendering.
|
|
70
|
-
* @param pathname - URL pathname (e.g., '/about')
|
|
71
|
-
* @param collection - Optional collection to search in
|
|
72
|
-
* @returns Full page data including puckData for rendering
|
|
73
|
-
* @throws Error with code 'PAGE_NOT_FOUND' if page doesn't exist
|
|
74
|
-
*/
|
|
75
|
-
export function getPage(pathname: string, collection?: string): Promise<PageData>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Check if a page exists without loading full data.
|
|
79
|
-
* @param pathname - URL pathname
|
|
80
|
-
* @param collection - Optional collection filter
|
|
81
|
-
* @returns true if page exists, false otherwise
|
|
82
|
-
*/
|
|
83
|
-
export function pageExists(pathname: string, collection?: string): Promise<boolean>;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Get all entries from a data collection.
|
|
87
|
-
*
|
|
88
|
-
* Fetches all entries from a data collection and returns them as
|
|
89
|
-
* simplified DataCollectionEntry objects for use in Puck component resolvers.
|
|
90
|
-
*
|
|
91
|
-
* @param collection - Data collection name
|
|
92
|
-
* @param locale - Optional locale override (defaults to configured locale)
|
|
93
|
-
* @returns Array of DataCollectionEntry objects with id, name, data, and meta
|
|
94
|
-
*/
|
|
95
|
-
export function getDataCollection(
|
|
96
|
-
collection: string,
|
|
97
|
-
locale?: string,
|
|
98
|
-
): Promise<import('@conloca/astro-cms').DataCollectionEntry[]>;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Get pages matching a path prefix.
|
|
102
|
-
*
|
|
103
|
-
* Filters all pages by pathname prefix and returns them sorted.
|
|
104
|
-
* Excludes the listing page itself (exact prefix match).
|
|
105
|
-
*
|
|
106
|
-
* @param prefix - Path prefix to match (e.g., '/blog/')
|
|
107
|
-
* @param options - Optional sort and limit settings
|
|
108
|
-
* @returns Array of PageReference objects with meta and timestamps
|
|
109
|
-
*
|
|
110
|
-
* @example Get latest 10 blog posts
|
|
111
|
-
* ```typescript
|
|
112
|
-
* const posts = await getPagesByPrefix('/blog/', {
|
|
113
|
-
* sort: 'date-desc',
|
|
114
|
-
* limit: 10,
|
|
115
|
-
* });
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
export function getPagesByPrefix(
|
|
119
|
-
prefix: string,
|
|
120
|
-
options?: {
|
|
121
|
-
sort?: 'date-desc' | 'date-asc' | 'title';
|
|
122
|
-
limit?: number;
|
|
123
|
-
},
|
|
124
|
-
): Promise<PageReference[]>;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
44
|
/**
|
|
128
45
|
* Virtual module: virtual:conloca-puck-config
|
|
129
46
|
*
|
|
@@ -134,6 +51,8 @@ declare module 'virtual:conloca-page-api' {
|
|
|
134
51
|
* preamble since it's used for SSG builds.
|
|
135
52
|
*/
|
|
136
53
|
declare module 'virtual:conloca-puck-config' {
|
|
54
|
+
import type { Config } from '@puckeditor/core';
|
|
55
|
+
|
|
137
56
|
const config: Config;
|
|
138
57
|
export default config;
|
|
139
58
|
}
|
package/node/content.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ALL_FRAGMENTS_COLLECTION,
|
|
3
|
+
type ConlocaCollectionsResult,
|
|
4
|
+
type ConlocaDataOptions,
|
|
5
|
+
type ConlocaPagesOptions,
|
|
6
|
+
type CreateConlocaCollectionsOptions,
|
|
7
|
+
conlocaData,
|
|
8
|
+
conlocaFragments,
|
|
9
|
+
conlocaPages,
|
|
10
|
+
createConlocaCollections,
|
|
11
|
+
pageSchemasOf,
|
|
12
|
+
} from '../src/collections.js';
|
|
13
|
+
export type { ConlocaPageEntry } from '../src/internal/page-collection-schema.js';
|
|
14
|
+
export { type ConlocaLoaderOptions, conlocaLoader } from '../src/loader.js';
|
package/node/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// The MDX component registry scan, for any build-time caller, so it runs the
|
|
2
|
+
// same discovery implementation as the dev endpoint.
|
|
3
|
+
export { discoverMdxComponents, type MdxRegistryScanOptions, toPortableImports } from '../src/discovery/discover.js';
|
|
4
|
+
export type { DiscoveredComponent } from '../src/discovery/merge-registry.js';
|
|
5
|
+
// The editor descriptors conlocaCMS publishes during a build.
|
|
6
|
+
export {
|
|
7
|
+
EDITOR_DESCRIPTORS_ENV_VAR,
|
|
8
|
+
type EditorDescriptorChannel,
|
|
9
|
+
readEditorDescriptors,
|
|
10
|
+
} from '../src/editor-descriptors.js';
|
|
11
|
+
export { type HydrationDiscovery, scanForHydratableComponents } from '../src/lib/hydration-scanner.js';
|
|
12
|
+
export { type ConlocaLocales, localesFromAstroI18n, localesFromStarlight } from '../src/locales-helpers.js';
|
|
13
|
+
export { type ConlocaCMSOptions, conlocaCMS } from '../src/plugin-spa.js';
|
|
14
|
+
// Pure HTML→wrapper-shape heuristic, for any build-time caller, so it runs
|
|
15
|
+
// the same find-wrapper implementation as the dev endpoint.
|
|
16
|
+
export {
|
|
17
|
+
type ContentWrapperInfo,
|
|
18
|
+
type DiscoveredWrappers,
|
|
19
|
+
findContentWrapper,
|
|
20
|
+
} from '../src/site-styles/content-wrapper-endpoint.js';
|
|
21
|
+
// Sitemap entries for CMS pages, which a sitemap cannot find by itself when they render on demand.
|
|
22
|
+
export { type AstroUrlSettings, type ConlocaSitemapOptions, conlocaSitemapOptions } from '../src/sitemap-options.js';
|