@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,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Astro-free render core for the page handler.
|
|
3
|
+
*
|
|
4
|
+
* The pure frontmatter logic of `page-handler.astro` (entry shaping/filtering,
|
|
5
|
+
* data context assembly, puck-data resolution, MDX fragment loading) lives here,
|
|
6
|
+
* parameterized over a narrow {@link PageContentSource} so the same logic runs
|
|
7
|
+
* against two backends: Astro content collections, and a ContentAPI reader a
|
|
8
|
+
* caller installs on `Astro.locals.contentApi`. No `astro:content` import and
|
|
9
|
+
* no `import.meta.env` — the `.astro` file injects `getCollection` (via
|
|
10
|
+
* {@link createCollectionContentSource}) and the dev flag, so this module is
|
|
11
|
+
* importable outside an Astro page.
|
|
12
|
+
*/
|
|
13
|
+
import { type ContentAPI, type MDXHeading } from '@conloca/content-api';
|
|
14
|
+
import type { Config } from '@puckeditor/core';
|
|
15
|
+
import { type Data } from '@puckeditor/core';
|
|
16
|
+
import type { ComponentType } from 'react';
|
|
17
|
+
import type { DataCollectionEntry, DataContext, PageReference, ResolvedRoutingConfig } from '../types.js';
|
|
18
|
+
export { findUnknownComponentTypes } from '../lib/unknown-components.js';
|
|
19
|
+
/**
|
|
20
|
+
* Synthetic collection every discovered fragment lands in (the loader flattens
|
|
21
|
+
* all fragment collections into one). Owned here — rather than imported from
|
|
22
|
+
* `collections.ts` — so this core stays free of the `astro:content` that module
|
|
23
|
+
* pulls in; `collections.ts` re-exports it to keep the public name stable.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ALL_FRAGMENTS_COLLECTION = "__conloca_fragments";
|
|
26
|
+
/**
|
|
27
|
+
* The single content-access seam the render core depends on: give me the raw
|
|
28
|
+
* frontmatter data records for a collection. The collection-backed impl wraps
|
|
29
|
+
* Astro's `getCollection`; the reader-backed impl (preview) projects
|
|
30
|
+
* ContentAPI content into the same record shape.
|
|
31
|
+
*/
|
|
32
|
+
export interface PageContentSource {
|
|
33
|
+
listEntries(collection: string): Promise<Record<string, unknown>[]>;
|
|
34
|
+
}
|
|
35
|
+
interface BaseEntryData {
|
|
36
|
+
id: string;
|
|
37
|
+
locale: string;
|
|
38
|
+
title?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
created?: string | Date;
|
|
41
|
+
modified?: string | Date;
|
|
42
|
+
publishAt?: string | Date | null;
|
|
43
|
+
unpublishAt?: string | Date | null;
|
|
44
|
+
}
|
|
45
|
+
export interface PageEntryData extends BaseEntryData {
|
|
46
|
+
pathname?: string;
|
|
47
|
+
puckData?: Data;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A page entry as the content loader delivers it: the structural fields above
|
|
51
|
+
* plus the host page schema's meta fields flattened alongside them.
|
|
52
|
+
*/
|
|
53
|
+
export type PageEntryRecord = PageEntryData & Record<string, unknown>;
|
|
54
|
+
/** An evaluated MDX fragment ready to render, matching RenderWithFragments' shape. */
|
|
55
|
+
export interface MdxFragmentComponent {
|
|
56
|
+
id: string;
|
|
57
|
+
title: string;
|
|
58
|
+
Component: ComponentType;
|
|
59
|
+
outline: readonly MDXHeading[];
|
|
60
|
+
}
|
|
61
|
+
type EvaluateMDXToComponentFn = typeof import('@conloca/mdx/node')['evaluateMDXToComponent'];
|
|
62
|
+
/**
|
|
63
|
+
* Collection-backed {@link PageContentSource}. The production render path
|
|
64
|
+
* injects Astro's `getCollection`; the dev flag preserves the handler's
|
|
65
|
+
* cache-bypass-in-DEV behaviour and the per-render dedup cache. Kept identical
|
|
66
|
+
* to the handler's former inline `loadCollectionEntries`/`getCollectionEntries`
|
|
67
|
+
* so the built page HTML is byte-for-byte unchanged.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createCollectionContentSource(deps: {
|
|
70
|
+
getCollection: (collection: string) => Promise<{
|
|
71
|
+
data: unknown;
|
|
72
|
+
}[]>;
|
|
73
|
+
isDev: boolean;
|
|
74
|
+
}): PageContentSource;
|
|
75
|
+
/**
|
|
76
|
+
* Canonical pathname form: no trailing slash, except the root itself. Site
|
|
77
|
+
* nav links carry trailing slashes ('/faq/') while entry pathnames are
|
|
78
|
+
* canonical ('/faq'); every exact-equality match must go through this.
|
|
79
|
+
*/
|
|
80
|
+
export declare function normalizePathname(pathname: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Response for a matched route whose content lookup found nothing. The
|
|
83
|
+
* 'passthrough' body is deliberately null: Astro only reroutes a 404 to the
|
|
84
|
+
* site's own /404 route when the body is empty, and that reroute serves even a
|
|
85
|
+
* prerendered /404 page with a real 404 status — so the site keeps its designed
|
|
86
|
+
* not-found page without a soft-404 redirect.
|
|
87
|
+
*/
|
|
88
|
+
export declare function pageNotFoundResponse(fallback: '404' | 'passthrough'): Response;
|
|
89
|
+
/**
|
|
90
|
+
* Published page entries for a collection/locale, shaped for downstream use.
|
|
91
|
+
* The narrowing `isPageEntryRecord` performs is kept in the return type, so
|
|
92
|
+
* callers read `pathname` as the string the filter already guaranteed.
|
|
93
|
+
*/
|
|
94
|
+
export declare function getPageEntries(source: PageContentSource, collectionName: string, locale: string): Promise<(PageEntryRecord & {
|
|
95
|
+
pathname: string;
|
|
96
|
+
})[]>;
|
|
97
|
+
export declare function getPagesByPrefix(source: PageContentSource, prefix: string, locale: string, config: ResolvedRoutingConfig, options?: {
|
|
98
|
+
sort?: 'date-desc' | 'date-asc' | 'title';
|
|
99
|
+
limit?: number;
|
|
100
|
+
}): Promise<PageReference[]>;
|
|
101
|
+
export declare function getDataCollectionEntries(source: PageContentSource, collectionName: string, locale: string): Promise<DataCollectionEntry[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Evaluate every published MDX fragment for a locale into a renderable React
|
|
104
|
+
* component. `evaluateMDXToComponent` and `isDev` are injected so the core
|
|
105
|
+
* stays astro/vite-free.
|
|
106
|
+
*/
|
|
107
|
+
export declare function loadMdxComponents(source: PageContentSource, locale: string, evaluateMDXToComponent: EvaluateMDXToComponentFn, isDev: boolean): Promise<MdxFragmentComponent[]>;
|
|
108
|
+
/**
|
|
109
|
+
* Assemble the data context every block of `entry` is rendered with: the page
|
|
110
|
+
* itself, plus the collections and pages-by-prefix its route's data bindings
|
|
111
|
+
* declare.
|
|
112
|
+
*/
|
|
113
|
+
export declare function buildDataContext(source: PageContentSource, routeConfig: ResolvedRoutingConfig['routes'][string], config: ResolvedRoutingConfig, entry: PageEntryRecord & {
|
|
114
|
+
pathname: string;
|
|
115
|
+
}): Promise<DataContext>;
|
|
116
|
+
/**
|
|
117
|
+
* Resolve a page's Puck data for render: apply component defaultProps, then run
|
|
118
|
+
* Puck's async data-resolution with the data context as each resolver's
|
|
119
|
+
* `metadata`. Falls back to the merged (unresolved) data on a resolver error,
|
|
120
|
+
* matching the handler's former behaviour.
|
|
121
|
+
*/
|
|
122
|
+
export declare function resolvePuckData(puckData: Data, puckConfig: Config, dataContext: DataContext): Promise<Data>;
|
|
123
|
+
/**
|
|
124
|
+
* Reader-backed {@link PageContentSource} over a {@link ContentAPI}, the one a
|
|
125
|
+
* caller installs on `Astro.locals.contentApi`. It projects the reader's
|
|
126
|
+
* manifest listing + per-locale content into the SAME record shape the
|
|
127
|
+
* collection-backed source (and the Astro loader) produce, so the render core
|
|
128
|
+
* is oblivious to which backend served it: the page shows whatever that
|
|
129
|
+
* reader returns.
|
|
130
|
+
*
|
|
131
|
+
* The synthetic `__conloca_fragments` collection is not a real ContentAPI
|
|
132
|
+
* collection (the loader flattens every fragment collection into it), so it maps
|
|
133
|
+
* to a `kind: 'fragment'` query; `type: 'mdx'` PAGES are skipped exactly as the
|
|
134
|
+
* loader skips them (they belong to an external renderer).
|
|
135
|
+
*/
|
|
136
|
+
export declare function createReaderContentSource(api: ContentAPI, renderLocale?: string): PageContentSource;
|
|
137
|
+
//# sourceMappingURL=page-render-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-render-core.d.ts","sourceRoot":"","sources":["../../../../src/handlers/page-render-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,UAAU,EAGhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,IAAI,EAAkB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAI1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CA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EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjH;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,iBAAiB,CA6CnG"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Astro-free render core for the page handler.
|
|
3
|
+
*
|
|
4
|
+
* The pure frontmatter logic of `page-handler.astro` (entry shaping/filtering,
|
|
5
|
+
* data context assembly, puck-data resolution, MDX fragment loading) lives here,
|
|
6
|
+
* parameterized over a narrow {@link PageContentSource} so the same logic runs
|
|
7
|
+
* against two backends: Astro content collections, and a ContentAPI reader a
|
|
8
|
+
* caller installs on `Astro.locals.contentApi`. No `astro:content` import and
|
|
9
|
+
* no `import.meta.env` — the `.astro` file injects `getCollection` (via
|
|
10
|
+
* {@link createCollectionContentSource}) and the dev flag, so this module is
|
|
11
|
+
* importable outside an Astro page.
|
|
12
|
+
*/
|
|
13
|
+
import { mergeDefaultProps } from '@conloca/cms-spa/merge-default-props';
|
|
14
|
+
import { isContentPublished, pageTimestampsOf, selectPagesByPrefix, } from '@conloca/content-api';
|
|
15
|
+
import { resolveAllData } from '@puckeditor/core';
|
|
16
|
+
import React from 'react';
|
|
17
|
+
// Re-exported so the copied `dist/internal/page-handler.astro` reaches
|
|
18
|
+
// everything it renders with through this one module.
|
|
19
|
+
export { findUnknownComponentTypes } from '../lib/unknown-components.js';
|
|
20
|
+
/**
|
|
21
|
+
* Synthetic collection every discovered fragment lands in (the loader flattens
|
|
22
|
+
* all fragment collections into one). Owned here — rather than imported from
|
|
23
|
+
* `collections.ts` — so this core stays free of the `astro:content` that module
|
|
24
|
+
* pulls in; `collections.ts` re-exports it to keep the public name stable.
|
|
25
|
+
*/
|
|
26
|
+
export const ALL_FRAGMENTS_COLLECTION = '__conloca_fragments';
|
|
27
|
+
/**
|
|
28
|
+
* Collection-backed {@link PageContentSource}. The production render path
|
|
29
|
+
* injects Astro's `getCollection`; the dev flag preserves the handler's
|
|
30
|
+
* cache-bypass-in-DEV behaviour and the per-render dedup cache. Kept identical
|
|
31
|
+
* to the handler's former inline `loadCollectionEntries`/`getCollectionEntries`
|
|
32
|
+
* so the built page HTML is byte-for-byte unchanged.
|
|
33
|
+
*/
|
|
34
|
+
export function createCollectionContentSource(deps) {
|
|
35
|
+
const collectionCache = new Map();
|
|
36
|
+
async function getCollectionEntries(collectionName) {
|
|
37
|
+
return deps.getCollection(collectionName).catch((error) => {
|
|
38
|
+
if (error instanceof Error &&
|
|
39
|
+
error.message.includes(`The collection "${collectionName}" does not exist or is empty`)) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
throw error;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async function loadCollectionEntries(collectionName) {
|
|
46
|
+
if (deps.isDev) {
|
|
47
|
+
return getCollectionEntries(collectionName);
|
|
48
|
+
}
|
|
49
|
+
let entriesPromise = collectionCache.get(collectionName);
|
|
50
|
+
if (!entriesPromise) {
|
|
51
|
+
entriesPromise = getCollectionEntries(collectionName);
|
|
52
|
+
collectionCache.set(collectionName, entriesPromise);
|
|
53
|
+
}
|
|
54
|
+
return entriesPromise;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
async listEntries(collection) {
|
|
58
|
+
const entries = await loadCollectionEntries(collection);
|
|
59
|
+
return entries.map((entry) => entry.data);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Canonical pathname form: no trailing slash, except the root itself. Site
|
|
65
|
+
* nav links carry trailing slashes ('/faq/') while entry pathnames are
|
|
66
|
+
* canonical ('/faq'); every exact-equality match must go through this.
|
|
67
|
+
*/
|
|
68
|
+
export function normalizePathname(pathname) {
|
|
69
|
+
const stripped = pathname.replace(/\/+$/u, '');
|
|
70
|
+
return stripped === '' ? '/' : stripped;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Response for a matched route whose content lookup found nothing. The
|
|
74
|
+
* 'passthrough' body is deliberately null: Astro only reroutes a 404 to the
|
|
75
|
+
* site's own /404 route when the body is empty, and that reroute serves even a
|
|
76
|
+
* prerendered /404 page with a real 404 status — so the site keeps its designed
|
|
77
|
+
* not-found page without a soft-404 redirect.
|
|
78
|
+
*/
|
|
79
|
+
export function pageNotFoundResponse(fallback) {
|
|
80
|
+
if (fallback === 'passthrough') {
|
|
81
|
+
return new Response(null, { status: 404 });
|
|
82
|
+
}
|
|
83
|
+
return new Response('Page not found', { status: 404 });
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Runtime narrow from a raw loader record to a page entry. Checks the fields
|
|
87
|
+
* a {@link PageReference} is built from, so nothing downstream carries a type
|
|
88
|
+
* the record never had — a record without a string id is dropped here instead
|
|
89
|
+
* of becoming a PageReference whose `id: string` is a lie.
|
|
90
|
+
*/
|
|
91
|
+
function isPageEntryRecord(data) {
|
|
92
|
+
return typeof data.id === 'string' && typeof data.locale === 'string' && typeof data.pathname === 'string';
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Published page entries for a collection/locale, shaped for downstream use.
|
|
96
|
+
* The narrowing `isPageEntryRecord` performs is kept in the return type, so
|
|
97
|
+
* callers read `pathname` as the string the filter already guaranteed.
|
|
98
|
+
*/
|
|
99
|
+
export async function getPageEntries(source, collectionName, locale) {
|
|
100
|
+
const entries = await source.listEntries(collectionName);
|
|
101
|
+
return entries.filter(isPageEntryRecord).filter((data) => data.locale === locale && isContentPublished(data));
|
|
102
|
+
}
|
|
103
|
+
function toPageReference(entry, collection) {
|
|
104
|
+
// The content loader flattens localeVersion.meta into the entry record, so
|
|
105
|
+
// everything that isn't a structural field IS the page's metadata: the rest
|
|
106
|
+
// element peels the structural fields off rather than allowlisting meta
|
|
107
|
+
// keys — host page schemas add arbitrary fields (author, tags, …) that
|
|
108
|
+
// listing components read via `page.meta`, and the editor's page feed
|
|
109
|
+
// (`pageReferenceOf`) passes the full meta; the rendered site must match it.
|
|
110
|
+
const { id, locale, pathname, name, created, modified, publishAt, unpublishAt, puckData, mdx, data, ...rest } = entry;
|
|
111
|
+
// `pageMetaSchema` makes `title` required, so a page that reached the
|
|
112
|
+
// collection carries one; the loader-record type marks it optional because it
|
|
113
|
+
// describes the raw flattened shape, before that schema runs. Assert the
|
|
114
|
+
// narrower ContentMeta here rather than inventing an empty title downstream.
|
|
115
|
+
const meta = rest;
|
|
116
|
+
return {
|
|
117
|
+
id,
|
|
118
|
+
pathname: pathname || '/',
|
|
119
|
+
title: meta.title,
|
|
120
|
+
collection,
|
|
121
|
+
meta,
|
|
122
|
+
timestamps: pageTimestampsOf({ created, modified, publishAt }),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export async function getPagesByPrefix(source, prefix, locale, config, options) {
|
|
126
|
+
const pageCollections = Array.from(new Set(Object.values(config.routes).map((route) => route.collection)));
|
|
127
|
+
const pages = (await Promise.all(pageCollections.map(async (collectionName) => {
|
|
128
|
+
const entries = await getPageEntries(source, collectionName, locale);
|
|
129
|
+
return entries.map((data) => toPageReference(data, collectionName));
|
|
130
|
+
}))).flat();
|
|
131
|
+
return selectPagesByPrefix(pages, prefix, options);
|
|
132
|
+
}
|
|
133
|
+
export async function getDataCollectionEntries(source, collectionName, locale) {
|
|
134
|
+
const entries = await source.listEntries(collectionName);
|
|
135
|
+
return entries
|
|
136
|
+
.map((data) => data)
|
|
137
|
+
.filter((data) => data.locale === locale && typeof data.name === 'string' && isContentPublished(data))
|
|
138
|
+
.map((data) => ({
|
|
139
|
+
id: data.id || '',
|
|
140
|
+
name: data.name || '',
|
|
141
|
+
data: data.data || {},
|
|
142
|
+
meta: {
|
|
143
|
+
title: data.title,
|
|
144
|
+
description: data.description,
|
|
145
|
+
},
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Evaluate every published MDX fragment for a locale into a renderable React
|
|
150
|
+
* component. `evaluateMDXToComponent` and `isDev` are injected so the core
|
|
151
|
+
* stays astro/vite-free.
|
|
152
|
+
*/
|
|
153
|
+
export async function loadMdxComponents(source, locale, evaluateMDXToComponent, isDev) {
|
|
154
|
+
const entries = (await source.listEntries(ALL_FRAGMENTS_COLLECTION)).map((data) => data);
|
|
155
|
+
return Promise.all(entries
|
|
156
|
+
.filter((data) => data.locale === locale && typeof data.id === 'string' && isContentPublished(data))
|
|
157
|
+
.map(async (data) => {
|
|
158
|
+
const title = data.title || data.name || data.id;
|
|
159
|
+
const mdx = data.mdx;
|
|
160
|
+
if (!mdx) {
|
|
161
|
+
if (isDev) {
|
|
162
|
+
console.warn(`[Conloca] No MDX content found for fragment: ${title}`);
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
id: data.id || title,
|
|
166
|
+
title,
|
|
167
|
+
Component: () => null,
|
|
168
|
+
outline: [],
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const { Component, error, outline } = await evaluateMDXToComponent(mdx);
|
|
172
|
+
if (!Component || error) {
|
|
173
|
+
const errorMessage = error?.message || 'MDX evaluation failed';
|
|
174
|
+
console.error(`[Conloca] MDX compilation error in fragment "${title}": ${errorMessage}`);
|
|
175
|
+
return {
|
|
176
|
+
id: data.id || title,
|
|
177
|
+
title,
|
|
178
|
+
Component: isDev
|
|
179
|
+
? () => React.createElement('div', { className: 'p-4 bg-red-50 border border-red-200 rounded text-red-600' }, React.createElement('p', { className: 'font-semibold mb-2' }, 'MDX Compilation Error'), React.createElement('p', { className: 'text-sm' }, `Fragment: ${title}`), React.createElement('p', { className: 'text-xs mt-2' }, errorMessage))
|
|
180
|
+
: () => null,
|
|
181
|
+
outline: [],
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
id: data.id || title,
|
|
186
|
+
title,
|
|
187
|
+
Component,
|
|
188
|
+
outline,
|
|
189
|
+
};
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Assemble the data context every block of `entry` is rendered with: the page
|
|
194
|
+
* itself, plus the collections and pages-by-prefix its route's data bindings
|
|
195
|
+
* declare.
|
|
196
|
+
*/
|
|
197
|
+
export async function buildDataContext(source, routeConfig, config, entry) {
|
|
198
|
+
const dataBindings = routeConfig.dataBindings;
|
|
199
|
+
const collectionNames = dataBindings.collections;
|
|
200
|
+
const pagesConfig = dataBindings.pages;
|
|
201
|
+
const hasCollections = collectionNames !== undefined && collectionNames.length > 0;
|
|
202
|
+
const hasPages = pagesConfig?.prefix !== undefined && pagesConfig.prefix !== '';
|
|
203
|
+
const bindingsLocale = dataBindings.locale ?? config.locale;
|
|
204
|
+
const collections = {};
|
|
205
|
+
let pages;
|
|
206
|
+
if (hasCollections) {
|
|
207
|
+
for (const collectionName of collectionNames) {
|
|
208
|
+
try {
|
|
209
|
+
collections[collectionName] = await getDataCollectionEntries(source, collectionName, bindingsLocale);
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
console.error(`[Conloca] Failed to fetch collection '${collectionName}':`, error);
|
|
213
|
+
collections[collectionName] = [];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (hasPages && pagesConfig) {
|
|
218
|
+
try {
|
|
219
|
+
pages = await getPagesByPrefix(source, pagesConfig.prefix, bindingsLocale, config, {
|
|
220
|
+
sort: pagesConfig.sort,
|
|
221
|
+
limit: pagesConfig.limit,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
console.error(`[Conloca] Failed to fetch pages with prefix '${pagesConfig.prefix}':`, error);
|
|
226
|
+
pages = [];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
collections,
|
|
231
|
+
...(pages && { pages }),
|
|
232
|
+
locale: bindingsLocale,
|
|
233
|
+
siteName: config.siteName,
|
|
234
|
+
page: toPageReference(entry, routeConfig.collection),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Resolve a page's Puck data for render: apply component defaultProps, then run
|
|
239
|
+
* Puck's async data-resolution with the data context as each resolver's
|
|
240
|
+
* `metadata`. Falls back to the merged (unresolved) data on a resolver error,
|
|
241
|
+
* matching the handler's former behaviour.
|
|
242
|
+
*/
|
|
243
|
+
export async function resolvePuckData(puckData, puckConfig, dataContext) {
|
|
244
|
+
const mergedData = mergeDefaultProps(puckData, puckConfig);
|
|
245
|
+
try {
|
|
246
|
+
return await resolveAllData(mergedData, puckConfig, dataContext);
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
console.error('[Conloca] resolveAllData failed:', error);
|
|
250
|
+
return mergedData;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Reader-backed {@link PageContentSource} over a {@link ContentAPI}, the one a
|
|
255
|
+
* caller installs on `Astro.locals.contentApi`. It projects the reader's
|
|
256
|
+
* manifest listing + per-locale content into the SAME record shape the
|
|
257
|
+
* collection-backed source (and the Astro loader) produce, so the render core
|
|
258
|
+
* is oblivious to which backend served it: the page shows whatever that
|
|
259
|
+
* reader returns.
|
|
260
|
+
*
|
|
261
|
+
* The synthetic `__conloca_fragments` collection is not a real ContentAPI
|
|
262
|
+
* collection (the loader flattens every fragment collection into it), so it maps
|
|
263
|
+
* to a `kind: 'fragment'` query; `type: 'mdx'` PAGES are skipped exactly as the
|
|
264
|
+
* loader skips them (they belong to an external renderer).
|
|
265
|
+
*/
|
|
266
|
+
export function createReaderContentSource(api, renderLocale) {
|
|
267
|
+
const filtersFor = (collection) => collection === ALL_FRAGMENTS_COLLECTION ? { kind: 'fragment' } : { collection };
|
|
268
|
+
const shapeEntry = async (manifest, locale) => {
|
|
269
|
+
const localeVersion = manifest.locales[locale];
|
|
270
|
+
if (!localeVersion)
|
|
271
|
+
return null;
|
|
272
|
+
const localized = await api.getLocalized(manifest.id, locale);
|
|
273
|
+
const content = localized?.localized.content;
|
|
274
|
+
const record = {
|
|
275
|
+
id: manifest.id,
|
|
276
|
+
locale,
|
|
277
|
+
...(localeVersion.pathname !== undefined && { pathname: localeVersion.pathname }),
|
|
278
|
+
...(localeVersion.name !== undefined && { name: localeVersion.name }),
|
|
279
|
+
...localeVersion.meta,
|
|
280
|
+
created: localeVersion.created,
|
|
281
|
+
modified: localeVersion.modified,
|
|
282
|
+
publishAt: localeVersion.publishAt,
|
|
283
|
+
unpublishAt: localeVersion.unpublishAt,
|
|
284
|
+
...(content?.data !== undefined && { data: content.data }),
|
|
285
|
+
};
|
|
286
|
+
if (content?.mdx !== undefined)
|
|
287
|
+
record.mdx = content.mdx;
|
|
288
|
+
if (content?.puckData !== undefined)
|
|
289
|
+
record.puckData = content.puckData;
|
|
290
|
+
return record;
|
|
291
|
+
};
|
|
292
|
+
return {
|
|
293
|
+
async listEntries(collection) {
|
|
294
|
+
const records = [];
|
|
295
|
+
for (const manifest of api.listAllContent(filtersFor(collection))) {
|
|
296
|
+
// Mirror the loader's skip: `type: 'mdx'` pages are owned by an
|
|
297
|
+
// external renderer, not this puck-page handler.
|
|
298
|
+
if (manifest.kind === 'page' && manifest.type === 'mdx')
|
|
299
|
+
continue;
|
|
300
|
+
// Every consumer filters records to one locale, and each shaped
|
|
301
|
+
// locale is one getLocalized read, so with a render locale known,
|
|
302
|
+
// shaping the others is wasted work.
|
|
303
|
+
for (const locale of Object.keys(manifest.locales)) {
|
|
304
|
+
if (renderLocale !== undefined && locale !== renderLocale)
|
|
305
|
+
continue;
|
|
306
|
+
const record = await shapeEntry(manifest, locale);
|
|
307
|
+
if (record)
|
|
308
|
+
records.push(record);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return records;
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=page-render-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-render-core.js","sourceRoot":"","sources":["../../../../src/handlers/page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C;AACvG,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydration.js","sourceRoot":"","sources":["../../../src/hydration.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,mEAAmE;AACnE,kFAAkF;AAGlF,OAAO,EAAkD,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { defineMdxComponents, type MdxComponentDescriptor, type MdxComponentInsertHint, type MdxComponentProp, type MdxComponents, type MdxJsxComponentDescriptor, type MdxSnippetDescriptor, readStringAttribute, writeStringAttribute, } from '@conloca/cms-spa/mdx-components-define';
|
|
2
|
+
export { type CoreFieldsMode, definePageSchema, type FieldHint, type FieldHintCommon, type FieldHints, type FieldHintVariant, type PageSchemaDescriptor, type PageSchemaEntry, type PageSchemaGroup, type PageSchemas, } from '@conloca/cms-spa/page-schema-define';
|
|
3
|
+
export { type PageSettingAttributes, type PageSettingName, pageSettingAttributes, } from '@conloca/cms-spa/page-setting-attributes';
|
|
4
|
+
export { type FragmentMeta, fragmentMetaSchema, type PageMeta, pageMetaSchema, } from '@conloca/content-api/schemas';
|
|
5
|
+
export { type CollectionBackedContentAPIOptions, createCollectionBackedContentAPI, } from './handlers/collection-content-api.js';
|
|
6
|
+
export type { ComponentRegistry } from './lib/hydration-script.js';
|
|
7
|
+
export { findHydratableComponents, type HydratableComponent, type HydratableComponentConfig, hasHydratableComponents, isHydratable, } from './lib/hydration-utils.js';
|
|
8
|
+
export { entryIdFromPath, extractSlugFromPathname, isPublished, pathnameFromSlug, staticPathParams, toDate, } from './lib/route-utils.js';
|
|
9
|
+
export { serializeProps } from './lib/serialize-props.js';
|
|
10
|
+
export { type HydrationMeta, type WithHydrationStrategy, withHydration } from './lib/withHydration.js';
|
|
11
|
+
export { type ConlocaLocales, localesFromAstroI18n, localesFromStarlight } from './locales-helpers.js';
|
|
12
|
+
/**
|
|
13
|
+
* Migration stub: the integration moved to '@conloca/astro-cms/node' so the
|
|
14
|
+
* root entry stays static-safe. Published 0.1.x exported it from the root —
|
|
15
|
+
* without this stub those configs fail with an opaque "not a function".
|
|
16
|
+
*
|
|
17
|
+
* @deprecated Import { conlocaCMS } from '@conloca/astro-cms/node' instead.
|
|
18
|
+
*/
|
|
19
|
+
export declare function conlocaCMS(_options?: unknown): never;
|
|
20
|
+
export type { ContentFragmentSectionProps, DataCollectionEntry, DataContext, HydrationStrategy, LayoutProps, PageData, PageReference, ResolvedRoutingConfig, TemplateConfig, } from './types.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,mBAAmB,EACnB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAIhD,OAAO,EACL,KAAK,cAAc,EACnB,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,qBAAqB,GACtB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACL,KAAK,YAAY,EACjB,kBAAkB,EAClB,KAAK,QAAQ,EACb,cAAc,GACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,KAAK,iCAAiC,EACtC,gCAAgC,GACjC,MAAM,sCAAsC,CAAC;AAM9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EACL,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,uBAAuB,EACvB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,GACP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,qBAAqB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvG,OAAO,EAAE,KAAK,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAKvG;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAKpD;AACD,YAAY,EACV,2BAA2B,EAC3B,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Astro integration for Conloca CMS
|
|
2
|
+
// MDX component registry plugin API — hosts use these to register JSX
|
|
3
|
+
// components (e.g. Starlight's Steps/Tabs/Card) with typed insert editors
|
|
4
|
+
// and opt-in auto-import injection. Runtime registry also wires through
|
|
5
|
+
// the schemasPath option; hosts export `mdxComponents` from the same file.
|
|
6
|
+
//
|
|
7
|
+
// `readStringAttribute` / `writeStringAttribute` are mdast-level helpers
|
|
8
|
+
// for hosts writing their own typed `Editor` components — controlled
|
|
9
|
+
// inputs against a string prop. Re-exported here so a host's editor file
|
|
10
|
+
// can pull everything it needs from one place.
|
|
11
|
+
export { defineMdxComponents, readStringAttribute, writeStringAttribute, } from '@conloca/cms-spa/mdx-components-define';
|
|
12
|
+
// Page-schema plugin API — hosts use these to declare frontmatter form UI
|
|
13
|
+
// for the CMS page-settings dialog. Runtime registry lives in @conloca/cms-spa
|
|
14
|
+
// and is wired by the schemasPath option (see ConlocaCMSOptions).
|
|
15
|
+
export { definePageSchema, } from '@conloca/cms-spa/page-schema-define';
|
|
16
|
+
// Blocks mark the parts they render from the page's settings, so a click on
|
|
17
|
+
// the editor canvas opens Page settings at that field.
|
|
18
|
+
export { pageSettingAttributes, } from '@conloca/cms-spa/page-setting-attributes';
|
|
19
|
+
// Re-export Zod schemas and types for convenience
|
|
20
|
+
export { fragmentMetaSchema, pageMetaSchema, } from '@conloca/content-api/schemas';
|
|
21
|
+
// Read-only ContentAPI over the build's content collections.
|
|
22
|
+
export { createCollectionBackedContentAPI, } from './handlers/collection-content-api.js';
|
|
23
|
+
export { findHydratableComponents, hasHydratableComponents, isHydratable, } from './lib/hydration-utils.js';
|
|
24
|
+
export { entryIdFromPath, extractSlugFromPathname, isPublished, pathnameFromSlug, staticPathParams, toDate, } from './lib/route-utils.js';
|
|
25
|
+
export { serializeProps } from './lib/serialize-props.js';
|
|
26
|
+
// New hydration API: withHydration wrapper and build-time scanner
|
|
27
|
+
export { withHydration } from './lib/withHydration.js';
|
|
28
|
+
// Locale plumbing helpers — translate framework-native i18n configs
|
|
29
|
+
// into Conloca's locale shape. See locales-helpers.ts for the contract.
|
|
30
|
+
export { localesFromAstroI18n, localesFromStarlight } from './locales-helpers.js';
|
|
31
|
+
// Hydration support for interactive components
|
|
32
|
+
// NOTE: The root entry point is intentionally static-safe.
|
|
33
|
+
// Node/Astro integration APIs live under '@conloca/astro-cms/node'.
|
|
34
|
+
/**
|
|
35
|
+
* Migration stub: the integration moved to '@conloca/astro-cms/node' so the
|
|
36
|
+
* root entry stays static-safe. Published 0.1.x exported it from the root —
|
|
37
|
+
* without this stub those configs fail with an opaque "not a function".
|
|
38
|
+
*
|
|
39
|
+
* @deprecated Import { conlocaCMS } from '@conloca/astro-cms/node' instead.
|
|
40
|
+
*/
|
|
41
|
+
export function conlocaCMS(_options) {
|
|
42
|
+
throw new Error("conlocaCMS moved: import { conlocaCMS } from '@conloca/astro-cms/node'. " +
|
|
43
|
+
'The package root stays free of Node-only code so it can load in any runtime.');
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC,sEAAsE;AACtE,0EAA0E;AAC1E,wEAAwE;AACxE,2EAA2E;AAC3E,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,+CAA+C;AAC/C,OAAO,EACL,mBAAmB,EAOnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAChD,0EAA0E;AAC1E,+EAA+E;AAC/E,kEAAkE;AAClE,OAAO,EAEL,gBAAgB,GASjB,MAAM,qCAAqC,CAAC;AAC7C,4EAA4E;AAC5E,uDAAuD;AACvD,OAAO,EAGL,qBAAqB,GACtB,MAAM,0CAA0C,CAAC;AAClD,kDAAkD;AAClD,OAAO,EAEL,kBAAkB,EAElB,cAAc,GACf,MAAM,8BAA8B,CAAC;AACtC,6DAA6D;AAC7D,OAAO,EAEL,gCAAgC,GACjC,MAAM,sCAAsC,CAAC;AAO9C,OAAO,EACL,wBAAwB,EAGxB,uBAAuB,EACvB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,GACP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,kEAAkE;AAClE,OAAO,EAAkD,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvG,oEAAoE;AACpE,wEAAwE;AACxE,OAAO,EAAuB,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACvG,+CAA+C;AAC/C,2DAA2D;AAC3D,oEAAoE;AAEpE;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,QAAkB;IAC3C,MAAM,IAAI,KAAK,CACb,0EAA0E;QACxE,8EAA8E,CACjF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Loader } from 'astro/loaders';
|
|
2
|
+
export type ConlocaCollectionKind = 'page' | 'data' | 'fragment';
|
|
3
|
+
/** Registry entries carry their kind: a data collection `general` must not cover an undeclared fragment FOLDER `general`. */
|
|
4
|
+
export type QualifiedCollectionName = `${ConlocaCollectionKind}:${string}`;
|
|
5
|
+
/** Factories call this as content.config evaluates; the registry is complete before any loader runs. */
|
|
6
|
+
export declare function declareConlocaCollection(kind: ConlocaCollectionKind, name: string): void;
|
|
7
|
+
/** Test hook — the registry is module state shared across a config evaluation. */
|
|
8
|
+
export declare function resetDeclaredCollections(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Every Conloca collection on disk must be declared in content.config, or its
|
|
11
|
+
* entries silently never build. The reverse — declared with no directory yet —
|
|
12
|
+
* is the schema-first workflow (the directory appears with the first saved
|
|
13
|
+
* entry) and is allowed.
|
|
14
|
+
*/
|
|
15
|
+
export declare function assertCollectionsDeclared(onDisk: Iterable<QualifiedCollectionName>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Wraps a factory-created loader so a config evaluation checks the disk once
|
|
18
|
+
* per content root and site. createConlocaCollections' loaders are not wrapped
|
|
19
|
+
* — its contract IS discovery.
|
|
20
|
+
*
|
|
21
|
+
* Astro runs every loader concurrently through one Promise.all, so the check is
|
|
22
|
+
* memoised as a promise rather than a done-flag: one scan per root and site,
|
|
23
|
+
* and every loader awaits the same result instead of racing past a check still
|
|
24
|
+
* running.
|
|
25
|
+
*/
|
|
26
|
+
export declare function withDeclarationCheck(loader: Loader, options: {
|
|
27
|
+
contentRoot: string;
|
|
28
|
+
site: string;
|
|
29
|
+
}): Loader;
|
|
30
|
+
//# sourceMappingURL=declared-collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declared-collections.d.ts","sourceRoot":"","sources":["../../../../src/internal/declared-collections.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAa3D,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEjE,6HAA6H;AAC7H,MAAM,MAAM,uBAAuB,GAAG,GAAG,qBAAqB,IAAI,MAAM,EAAE,CAAC;AAU3E,wGAAwG;AACxG,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAExF;AAED,kFAAkF;AAClF,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAUzF;AAYD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAqB3G"}
|