@conloca/astro-cms 0.1.15 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +259 -247
- package/dist/internal/acorn-default.mjs +11 -3
- package/dist/internal/page-handler.astro +137 -358
- package/dist/ts/node/content.d.ts +4 -0
- package/dist/ts/node/content.d.ts.map +1 -0
- package/dist/ts/node/content.js +3 -0
- package/dist/ts/node/content.js.map +1 -0
- package/dist/ts/node/index.d.ts +9 -0
- package/dist/ts/node/index.d.ts.map +1 -0
- package/dist/ts/node/index.js +14 -0
- package/dist/ts/node/index.js.map +1 -0
- package/dist/ts/src/asset-ref-base.d.ts +3 -0
- package/dist/ts/src/asset-ref-base.d.ts.map +1 -0
- package/dist/ts/src/asset-ref-base.js +48 -0
- package/dist/ts/src/asset-ref-base.js.map +1 -0
- package/dist/ts/src/checks.d.ts +7 -0
- package/dist/ts/src/checks.d.ts.map +1 -0
- package/dist/ts/src/checks.js +7 -0
- package/dist/ts/src/checks.js.map +1 -0
- package/dist/ts/src/cms-handler.d.ts +18 -0
- package/dist/ts/src/cms-handler.d.ts.map +1 -0
- package/dist/ts/src/cms-handler.js +245 -0
- package/dist/ts/src/cms-handler.js.map +1 -0
- package/dist/ts/src/collections.d.ts +160 -0
- package/dist/ts/src/collections.d.ts.map +1 -0
- package/dist/ts/src/collections.js +170 -0
- package/dist/ts/src/collections.js.map +1 -0
- package/dist/ts/src/components/HydrationWrapper.d.ts +18 -0
- package/dist/ts/src/components/HydrationWrapper.d.ts.map +1 -0
- package/dist/ts/src/components/HydrationWrapper.js +22 -0
- package/dist/ts/src/components/HydrationWrapper.js.map +1 -0
- package/dist/ts/src/components/RenderWithFragments.d.ts +27 -0
- package/dist/ts/src/components/RenderWithFragments.d.ts.map +1 -0
- package/dist/ts/src/components/RenderWithFragments.js +133 -0
- package/dist/ts/src/components/RenderWithFragments.js.map +1 -0
- package/dist/ts/src/components/RenderWithHydration.d.ts +21 -0
- package/dist/ts/src/components/RenderWithHydration.d.ts.map +1 -0
- package/dist/ts/src/components/RenderWithHydration.js +39 -0
- package/dist/ts/src/components/RenderWithHydration.js.map +1 -0
- package/dist/ts/src/components.d.ts +4 -0
- package/dist/ts/src/components.d.ts.map +1 -0
- package/dist/ts/src/components.js +4 -0
- package/dist/ts/src/components.js.map +1 -0
- package/dist/ts/src/discovery/astro-frontmatter.d.ts +18 -0
- package/dist/ts/src/discovery/astro-frontmatter.d.ts.map +1 -0
- package/dist/ts/src/discovery/astro-frontmatter.js +25 -0
- package/dist/ts/src/discovery/astro-frontmatter.js.map +1 -0
- package/dist/ts/src/discovery/discover.d.ts +43 -0
- package/dist/ts/src/discovery/discover.d.ts.map +1 -0
- package/dist/ts/src/discovery/discover.js +87 -0
- package/dist/ts/src/discovery/discover.js.map +1 -0
- package/dist/ts/src/discovery/extract-props-ts.d.ts +41 -0
- package/dist/ts/src/discovery/extract-props-ts.d.ts.map +1 -0
- package/dist/ts/src/discovery/extract-props-ts.js +232 -0
- package/dist/ts/src/discovery/extract-props-ts.js.map +1 -0
- package/dist/ts/src/discovery/merge-registry.d.ts +58 -0
- package/dist/ts/src/discovery/merge-registry.d.ts.map +1 -0
- package/dist/ts/src/discovery/merge-registry.js +333 -0
- package/dist/ts/src/discovery/merge-registry.js.map +1 -0
- package/dist/ts/src/discovery/registry-endpoint.d.ts +27 -0
- package/dist/ts/src/discovery/registry-endpoint.d.ts.map +1 -0
- package/dist/ts/src/discovery/registry-endpoint.js +76 -0
- package/dist/ts/src/discovery/registry-endpoint.js.map +1 -0
- package/dist/ts/src/discovery/scan-components.d.ts +94 -0
- package/dist/ts/src/discovery/scan-components.d.ts.map +1 -0
- package/dist/ts/src/discovery/scan-components.js +397 -0
- package/dist/ts/src/discovery/scan-components.js.map +1 -0
- package/dist/ts/src/discovery/scan-mdx.d.ts +63 -0
- package/dist/ts/src/discovery/scan-mdx.d.ts.map +1 -0
- package/dist/ts/src/discovery/scan-mdx.js +113 -0
- package/dist/ts/src/discovery/scan-mdx.js.map +1 -0
- package/dist/ts/src/discovery/scan-overrides.d.ts +71 -0
- package/dist/ts/src/discovery/scan-overrides.d.ts.map +1 -0
- package/dist/ts/src/discovery/scan-overrides.js +34 -0
- package/dist/ts/src/discovery/scan-overrides.js.map +1 -0
- package/dist/ts/src/editor-descriptors.d.ts +31 -0
- package/dist/ts/src/editor-descriptors.d.ts.map +1 -0
- package/dist/ts/src/editor-descriptors.js +84 -0
- package/dist/ts/src/editor-descriptors.js.map +1 -0
- package/dist/ts/src/handlers/collection-content-api.d.ts +32 -0
- package/dist/ts/src/handlers/collection-content-api.d.ts.map +1 -0
- package/dist/ts/src/handlers/collection-content-api.js +166 -0
- package/dist/ts/src/handlers/collection-content-api.js.map +1 -0
- package/dist/ts/src/handlers/page-render-core.d.ts +137 -0
- package/dist/ts/src/handlers/page-render-core.d.ts.map +1 -0
- package/dist/ts/src/handlers/page-render-core.js +315 -0
- package/dist/ts/src/handlers/page-render-core.js.map +1 -0
- package/dist/ts/src/hydration.d.ts +4 -0
- package/dist/ts/src/hydration.d.ts.map +1 -0
- package/dist/ts/src/hydration.js +5 -0
- package/dist/ts/src/hydration.js.map +1 -0
- package/dist/ts/src/index.d.ts +21 -0
- package/dist/ts/src/index.d.ts.map +1 -0
- package/dist/ts/src/index.js +45 -0
- package/dist/ts/src/index.js.map +1 -0
- package/dist/ts/src/internal/declared-collections.d.ts +30 -0
- package/dist/ts/src/internal/declared-collections.d.ts.map +1 -0
- package/dist/ts/src/internal/declared-collections.js +84 -0
- package/dist/ts/src/internal/declared-collections.js.map +1 -0
- package/dist/ts/src/internal/page-collection-schema.d.ts +44 -0
- package/dist/ts/src/internal/page-collection-schema.d.ts.map +1 -0
- package/dist/ts/src/internal/page-collection-schema.js +152 -0
- package/dist/ts/src/internal/page-collection-schema.js.map +1 -0
- package/dist/ts/src/lib/content-config-guard.d.ts +11 -0
- package/dist/ts/src/lib/content-config-guard.d.ts.map +1 -0
- package/dist/ts/src/lib/content-config-guard.js +41 -0
- package/dist/ts/src/lib/content-config-guard.js.map +1 -0
- package/dist/ts/src/lib/hydration-scanner.d.ts +47 -0
- package/dist/ts/src/lib/hydration-scanner.d.ts.map +1 -0
- package/dist/ts/src/lib/hydration-scanner.js +136 -0
- package/dist/ts/src/lib/hydration-scanner.js.map +1 -0
- package/dist/{lib/hydration-script.d.mts → ts/src/lib/hydration-script.d.ts} +7 -10
- package/dist/ts/src/lib/hydration-script.d.ts.map +1 -0
- package/dist/ts/src/lib/hydration-script.js +89 -0
- package/dist/ts/src/lib/hydration-script.js.map +1 -0
- package/dist/ts/src/lib/hydration-utils.d.ts +51 -0
- package/dist/ts/src/lib/hydration-utils.d.ts.map +1 -0
- package/dist/ts/src/lib/hydration-utils.js +84 -0
- package/dist/ts/src/lib/hydration-utils.js.map +1 -0
- package/dist/ts/src/lib/resolve-locale.d.ts +15 -0
- package/dist/ts/src/lib/resolve-locale.d.ts.map +1 -0
- package/dist/ts/src/lib/resolve-locale.js +16 -0
- package/dist/ts/src/lib/resolve-locale.js.map +1 -0
- package/dist/ts/src/lib/resolve-site-name.d.ts +8 -0
- package/dist/ts/src/lib/resolve-site-name.d.ts.map +1 -0
- package/dist/ts/src/lib/resolve-site-name.js +12 -0
- package/dist/ts/src/lib/resolve-site-name.js.map +1 -0
- package/dist/ts/src/lib/route-utils.d.ts +61 -0
- package/dist/ts/src/lib/route-utils.d.ts.map +1 -0
- package/dist/ts/src/lib/route-utils.js +96 -0
- package/dist/ts/src/lib/route-utils.js.map +1 -0
- package/dist/ts/src/lib/routing-config.d.ts +38 -0
- package/dist/ts/src/lib/routing-config.d.ts.map +1 -0
- package/dist/ts/src/lib/routing-config.js +106 -0
- package/dist/ts/src/lib/routing-config.js.map +1 -0
- package/dist/ts/src/lib/serialize-props.d.ts +6 -0
- package/dist/ts/src/lib/serialize-props.d.ts.map +1 -0
- package/dist/ts/src/lib/serialize-props.js +8 -0
- package/dist/ts/src/lib/serialize-props.js.map +1 -0
- package/dist/ts/src/lib/unknown-components.d.ts +21 -0
- package/dist/ts/src/lib/unknown-components.d.ts.map +1 -0
- package/dist/ts/src/lib/unknown-components.js +49 -0
- package/dist/ts/src/lib/unknown-components.js.map +1 -0
- package/dist/ts/src/lib/virtual-module-generators.d.ts +33 -0
- package/dist/ts/src/lib/virtual-module-generators.d.ts.map +1 -0
- package/dist/ts/src/lib/virtual-module-generators.js +51 -0
- package/dist/ts/src/lib/virtual-module-generators.js.map +1 -0
- package/dist/{withHydration-HIvO9ysY.d.mts → ts/src/lib/withHydration.d.ts} +7 -11
- package/dist/ts/src/lib/withHydration.d.ts.map +1 -0
- package/dist/ts/src/lib/withHydration.js +50 -0
- package/dist/ts/src/lib/withHydration.js.map +1 -0
- package/dist/ts/src/loader.d.ts +27 -0
- package/dist/ts/src/loader.d.ts.map +1 -0
- package/dist/ts/src/loader.js +118 -0
- package/dist/ts/src/loader.js.map +1 -0
- package/dist/ts/src/locales-helpers.d.ts +61 -0
- package/dist/ts/src/locales-helpers.d.ts.map +1 -0
- package/dist/ts/src/locales-helpers.js +50 -0
- package/dist/ts/src/locales-helpers.js.map +1 -0
- package/dist/ts/src/mime-types.d.ts +3 -0
- package/dist/ts/src/mime-types.d.ts.map +1 -0
- package/dist/ts/src/mime-types.js +20 -0
- package/dist/ts/src/mime-types.js.map +1 -0
- package/dist/ts/src/page-feed.d.ts +13 -0
- package/dist/ts/src/page-feed.d.ts.map +1 -0
- package/dist/ts/src/page-feed.js +20 -0
- package/dist/ts/src/page-feed.js.map +1 -0
- package/dist/ts/src/page-schemas.d.ts +6 -0
- package/dist/ts/src/page-schemas.d.ts.map +1 -0
- package/dist/ts/src/page-schemas.js +6 -0
- package/dist/ts/src/page-schemas.js.map +1 -0
- package/dist/ts/src/path-validation.d.ts +8 -0
- package/dist/ts/src/path-validation.d.ts.map +1 -0
- package/dist/ts/src/path-validation.js +13 -0
- package/dist/ts/src/path-validation.js.map +1 -0
- package/dist/ts/src/plugin-spa.d.ts +182 -0
- package/dist/ts/src/plugin-spa.d.ts.map +1 -0
- package/dist/ts/src/plugin-spa.js +1165 -0
- package/dist/ts/src/plugin-spa.js.map +1 -0
- package/dist/ts/src/puck-manifest/components-endpoint.d.ts +30 -0
- package/dist/ts/src/puck-manifest/components-endpoint.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/components-endpoint.js +54 -0
- package/dist/ts/src/puck-manifest/components-endpoint.js.map +1 -0
- package/dist/ts/src/puck-manifest/field-projection.d.ts +91 -0
- package/dist/ts/src/puck-manifest/field-projection.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/field-projection.js +422 -0
- package/dist/ts/src/puck-manifest/field-projection.js.map +1 -0
- package/dist/ts/src/puck-manifest/index.d.ts +4 -0
- package/dist/ts/src/puck-manifest/index.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/index.js +3 -0
- package/dist/ts/src/puck-manifest/index.js.map +1 -0
- package/dist/ts/src/puck-manifest/literal.d.ts +163 -0
- package/dist/ts/src/puck-manifest/literal.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/literal.js +354 -0
- package/dist/ts/src/puck-manifest/literal.js.map +1 -0
- package/dist/ts/src/puck-manifest/read-config.d.ts +42 -0
- package/dist/ts/src/puck-manifest/read-config.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/read-config.js +517 -0
- package/dist/ts/src/puck-manifest/read-config.js.map +1 -0
- package/dist/ts/src/puck-manifest/read-field.d.ts +7 -0
- package/dist/ts/src/puck-manifest/read-field.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/read-field.js +11 -0
- package/dist/ts/src/puck-manifest/read-field.js.map +1 -0
- package/dist/ts/src/puck-manifest/read-wrapper.d.ts +147 -0
- package/dist/ts/src/puck-manifest/read-wrapper.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/read-wrapper.js +889 -0
- package/dist/ts/src/puck-manifest/read-wrapper.js.map +1 -0
- package/dist/ts/src/puck-manifest/reading-budget.d.ts +50 -0
- package/dist/ts/src/puck-manifest/reading-budget.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/reading-budget.js +113 -0
- package/dist/ts/src/puck-manifest/reading-budget.js.map +1 -0
- package/dist/ts/src/puck-manifest/resolve-reference.d.ts +4 -0
- package/dist/ts/src/puck-manifest/resolve-reference.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/resolve-reference.js +4 -0
- package/dist/ts/src/puck-manifest/resolve-reference.js.map +1 -0
- package/dist/ts/src/puck-manifest/source-reference.d.ts +96 -0
- package/dist/ts/src/puck-manifest/source-reference.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/source-reference.js +424 -0
- package/dist/ts/src/puck-manifest/source-reference.js.map +1 -0
- package/dist/ts/src/puck-manifest/syntax.d.ts +29 -0
- package/dist/ts/src/puck-manifest/syntax.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/syntax.js +79 -0
- package/dist/ts/src/puck-manifest/syntax.js.map +1 -0
- package/dist/ts/src/puck-manifest/types.d.ts +145 -0
- package/dist/ts/src/puck-manifest/types.d.ts.map +1 -0
- package/dist/ts/src/puck-manifest/types.js +2 -0
- package/dist/ts/src/puck-manifest/types.js.map +1 -0
- package/dist/ts/src/safe-json-stringify.d.ts +13 -0
- package/dist/ts/src/safe-json-stringify.d.ts.map +1 -0
- package/dist/ts/src/safe-json-stringify.js +7 -0
- package/dist/ts/src/safe-json-stringify.js.map +1 -0
- package/dist/ts/src/sandbox-frame-handler.d.ts +19 -0
- package/dist/ts/src/sandbox-frame-handler.d.ts.map +1 -0
- package/dist/ts/src/sandbox-frame-handler.js +27 -0
- package/dist/ts/src/sandbox-frame-handler.js.map +1 -0
- package/dist/ts/src/site-styles/content-wrapper-endpoint.d.ts +73 -0
- package/dist/ts/src/site-styles/content-wrapper-endpoint.d.ts.map +1 -0
- package/dist/ts/src/site-styles/content-wrapper-endpoint.js +224 -0
- package/dist/ts/src/site-styles/content-wrapper-endpoint.js.map +1 -0
- package/dist/ts/src/site-styles/render-endpoint.d.ts +50 -0
- package/dist/ts/src/site-styles/render-endpoint.d.ts.map +1 -0
- package/dist/ts/src/site-styles/render-endpoint.js +264 -0
- package/dist/ts/src/site-styles/render-endpoint.js.map +1 -0
- package/dist/ts/src/site-styles/styles-endpoint.d.ts +59 -0
- package/dist/ts/src/site-styles/styles-endpoint.d.ts.map +1 -0
- package/dist/ts/src/site-styles/styles-endpoint.js +156 -0
- package/dist/ts/src/site-styles/styles-endpoint.js.map +1 -0
- package/dist/ts/src/sitemap-options.d.ts +21 -0
- package/dist/ts/src/sitemap-options.d.ts.map +1 -0
- package/dist/ts/src/sitemap-options.js +92 -0
- package/dist/ts/src/sitemap-options.js.map +1 -0
- package/dist/ts/src/tiptap-html-static.d.ts +15 -0
- package/dist/ts/src/tiptap-html-static.d.ts.map +1 -0
- package/dist/ts/src/tiptap-html-static.js +67 -0
- package/dist/ts/src/tiptap-html-static.js.map +1 -0
- package/dist/ts/src/types.d.ts +543 -0
- package/dist/ts/src/types.d.ts.map +1 -0
- package/dist/ts/src/types.js +2 -0
- package/dist/ts/src/types.js.map +1 -0
- package/dist/virtual-modules.d.ts +74 -0
- package/node/content.ts +14 -0
- package/node/index.ts +22 -0
- package/package.json +198 -56
- package/src/asset-ref-base.ts +48 -0
- package/src/checks.ts +10 -0
- package/src/cms-handler.ts +280 -0
- package/src/collections.ts +262 -0
- package/src/components/HydrationWrapper.tsx +41 -0
- package/src/components/RenderWithFragments.tsx +204 -0
- package/src/components/RenderWithHydration.tsx +55 -0
- package/src/components.ts +3 -0
- package/src/discovery/astro-frontmatter.ts +24 -0
- package/src/discovery/discover.ts +108 -0
- package/src/discovery/extract-props-ts.ts +255 -0
- package/src/discovery/merge-registry.ts +411 -0
- package/src/discovery/registry-endpoint.ts +80 -0
- package/src/discovery/scan-components.ts +458 -0
- package/src/discovery/scan-mdx.ts +190 -0
- package/src/discovery/scan-overrides.ts +92 -0
- package/src/editor-descriptors.ts +96 -0
- package/src/env.d.ts +31 -0
- package/src/handlers/collection-content-api.ts +196 -0
- package/src/handlers/page-handler.astro +320 -0
- package/src/handlers/page-render-core.ts +456 -0
- package/src/hydration.ts +7 -0
- package/src/index.ts +111 -0
- package/src/internal/acorn-default.mjs +37 -0
- package/src/internal/declared-collections.ts +98 -0
- package/src/internal/page-collection-schema.ts +210 -0
- package/src/lib/content-config-guard.ts +48 -0
- package/src/lib/hydration-scanner.ts +176 -0
- package/src/lib/hydration-script.ts +126 -0
- package/src/lib/hydration-utils.ts +120 -0
- package/src/lib/resolve-locale.ts +22 -0
- package/src/lib/resolve-site-name.ts +10 -0
- package/src/lib/route-utils.ts +106 -0
- package/src/lib/routing-config.ts +126 -0
- package/src/lib/serialize-props.ts +7 -0
- package/src/lib/unknown-components.ts +64 -0
- package/src/lib/virtual-module-generators.ts +58 -0
- package/src/lib/withHydration.ts +71 -0
- package/src/loader.ts +145 -0
- package/src/locales-helpers.ts +68 -0
- package/src/mime-types.ts +19 -0
- package/src/page-feed.ts +26 -0
- package/src/page-schemas.ts +19 -0
- package/src/path-validation.ts +13 -0
- package/src/plugin-spa.ts +1480 -0
- package/src/puck-manifest/components-endpoint.ts +55 -0
- package/src/puck-manifest/field-projection.ts +510 -0
- package/src/puck-manifest/index.ts +3 -0
- package/src/puck-manifest/literal.ts +459 -0
- package/src/puck-manifest/read-config.ts +577 -0
- package/src/puck-manifest/read-field.ts +19 -0
- package/src/puck-manifest/read-wrapper.ts +1056 -0
- package/src/puck-manifest/reading-budget.ts +127 -0
- package/src/puck-manifest/resolve-reference.ts +9 -0
- package/src/puck-manifest/source-reference.ts +484 -0
- package/src/puck-manifest/syntax.ts +104 -0
- package/src/puck-manifest/types.ts +139 -0
- package/src/safe-json-stringify.ts +17 -0
- package/src/sandbox-frame-handler.ts +31 -0
- package/src/site-styles/content-wrapper-endpoint.ts +327 -0
- package/src/site-styles/render-endpoint.ts +331 -0
- package/src/site-styles/styles-endpoint.ts +184 -0
- package/src/sitemap-options.ts +115 -0
- package/src/tiptap-html-static.ts +84 -0
- package/{dist/types-CVQNmPxF.d.mts → src/types.ts} +232 -79
- package/src/virtual-modules.d.ts +74 -0
- package/dist/collections.d.mts +0 -36
- package/dist/collections.d.mts.map +0 -1
- package/dist/collections.mjs +0 -65
- package/dist/collections.mjs.map +0 -1
- package/dist/components.d.mts +0 -46
- package/dist/components.d.mts.map +0 -1
- package/dist/components.mjs +0 -226
- package/dist/components.mjs.map +0 -1
- package/dist/hydration-scanner-B0NjYkZ_.mjs +0 -109
- package/dist/hydration-scanner-B0NjYkZ_.mjs.map +0 -1
- package/dist/hydration.d.mts +0 -4
- package/dist/hydration.mjs +0 -3
- package/dist/index.d.mts +0 -139
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -66
- package/dist/index.mjs.map +0 -1
- package/dist/internal/cms-handler.d.mts +0 -26
- package/dist/internal/cms-handler.d.mts.map +0 -1
- package/dist/internal/cms-handler.mjs +0 -267
- package/dist/internal/cms-handler.mjs.map +0 -1
- package/dist/lib/hydration-script.d.mts.map +0 -1
- package/dist/lib/hydration-script.mjs +0 -85
- package/dist/lib/hydration-script.mjs.map +0 -1
- package/dist/loader-By-AQWHc.mjs +0 -68
- package/dist/loader-By-AQWHc.mjs.map +0 -1
- package/dist/node/content.d.mts +0 -19
- package/dist/node/content.d.mts.map +0 -1
- package/dist/node/content.mjs +0 -4
- package/dist/node/index.d.mts +0 -52
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.mjs +0 -753
- package/dist/node/index.mjs.map +0 -1
- package/dist/serialize-props-Dhv_MnkY.mjs +0 -73
- package/dist/serialize-props-Dhv_MnkY.mjs.map +0 -1
- package/dist/types-CVQNmPxF.d.mts.map +0 -1
- package/dist/withHydration-EzyzBQ-Y.mjs +0 -49
- package/dist/withHydration-EzyzBQ-Y.mjs.map +0 -1
- package/dist/withHydration-HIvO9ysY.d.mts.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate the virtual:conloca-routing-config module.
|
|
3
|
+
*
|
|
4
|
+
* Returns a module that exports the resolved routing configuration as default.
|
|
5
|
+
*
|
|
6
|
+
* @param config - Resolved routing configuration with all defaults applied
|
|
7
|
+
* @returns JavaScript module code as a string
|
|
8
|
+
*/
|
|
9
|
+
export function generateRoutingConfigModule(config) {
|
|
10
|
+
return `export default ${JSON.stringify(config, null, 2)};`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Generate the virtual:conloca-layout module.
|
|
14
|
+
*
|
|
15
|
+
* Returns a module that re-exports the layout component or exports undefined
|
|
16
|
+
* if no layout is configured.
|
|
17
|
+
*
|
|
18
|
+
* Currently uses the first route's layout. Multi-layout support is future work.
|
|
19
|
+
*
|
|
20
|
+
* @param routing - Routing configuration (may be undefined if routing disabled)
|
|
21
|
+
* @returns JavaScript module code as a string
|
|
22
|
+
*/
|
|
23
|
+
export function generateLayoutModule(routing) {
|
|
24
|
+
// Get layout from first route (for now - multi-layout is future work)
|
|
25
|
+
const routes = routing?.routes || {};
|
|
26
|
+
const firstRoute = Object.values(routes)[0];
|
|
27
|
+
const layoutPath = firstRoute?.layout;
|
|
28
|
+
if (layoutPath) {
|
|
29
|
+
// Convert relative path to absolute for Vite resolution
|
|
30
|
+
// ./src/... -> /src/...
|
|
31
|
+
const absolutePath = layoutPath.startsWith('.') ? `/${layoutPath.slice(2)}` : layoutPath;
|
|
32
|
+
return `export { default } from '${absolutePath}';`;
|
|
33
|
+
}
|
|
34
|
+
return 'export default undefined;';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generate the virtual:conloca-puck-config module.
|
|
38
|
+
*
|
|
39
|
+
* Returns a module that re-exports the Puck configuration.
|
|
40
|
+
* This is separate from the HMR-enabled puck-entry.js used by the CMS SPA.
|
|
41
|
+
*
|
|
42
|
+
* @param puckConfigPath - Path to the puck config module
|
|
43
|
+
* @returns JavaScript module code as a string
|
|
44
|
+
*/
|
|
45
|
+
export function generatePuckConfigModule(puckConfigPath) {
|
|
46
|
+
// Convert relative path to absolute for Vite resolution
|
|
47
|
+
// ./src/... -> /src/...
|
|
48
|
+
const absolutePath = puckConfigPath.startsWith('.') ? `/${puckConfigPath.slice(2)}` : puckConfigPath;
|
|
49
|
+
return `export { default } from '${absolutePath}';`;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=virtual-module-generators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-module-generators.js","sourceRoot":"","sources":["../../../../src/lib/virtual-module-generators.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAA6B;IACvE,OAAO,kBAAkB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAkC;IACrE,sEAAsE;IACtE,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,EAAE,CAAC;IACrC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,UAAU,GAAG,UAAU,EAAE,MAAM,CAAC;IAEtC,IAAI,UAAU,EAAE,CAAC;QACf,wDAAwD;QACxD,wBAAwB;QACxB,MAAM,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;QAEzF,OAAO,4BAA4B,YAAY,IAAI,CAAC;IACtD,CAAC;IAED,OAAO,2BAA2B,CAAC;AACrC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CAAC,cAAsB;IAC7D,wDAAwD;IACxD,wBAAwB;IACxB,MAAM,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC;IAErG,OAAO,4BAA4B,YAAY,IAAI,CAAC;AACtD,CAAC"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
3
|
-
//#region src/lib/withHydration.d.ts
|
|
1
|
+
import type React from 'react';
|
|
4
2
|
/**
|
|
5
3
|
* Metadata attached to components marked for hydration.
|
|
6
4
|
* Used by the build-time scanner and runtime hydration system.
|
|
7
5
|
*/
|
|
8
|
-
interface HydrationMeta {
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export interface HydrationMeta {
|
|
7
|
+
strategy: 'load' | 'visible' | 'idle';
|
|
8
|
+
__isHydratable: true;
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
13
11
|
* Hydration strategy for the withHydration wrapper.
|
|
14
12
|
* Does not include 'none' since wrapping implies hydration is desired.
|
|
15
13
|
*/
|
|
16
|
-
type WithHydrationStrategy = 'load' | 'visible' | 'idle';
|
|
14
|
+
export type WithHydrationStrategy = 'load' | 'visible' | 'idle';
|
|
17
15
|
/**
|
|
18
16
|
* Marks a component's render function for client-side hydration.
|
|
19
17
|
*
|
|
@@ -49,7 +47,5 @@ type WithHydrationStrategy = 'load' | 'visible' | 'idle';
|
|
|
49
47
|
* }
|
|
50
48
|
* ```
|
|
51
49
|
*/
|
|
52
|
-
declare function withHydration<T extends (props: any) => React.ReactNode>(Component: T, strategy: WithHydrationStrategy): T;
|
|
53
|
-
//#
|
|
54
|
-
export { WithHydrationStrategy as n, withHydration as r, HydrationMeta as t };
|
|
55
|
-
//# sourceMappingURL=withHydration-HIvO9ysY.d.mts.map
|
|
50
|
+
export declare function withHydration<T extends (props: any) => React.ReactNode>(Component: T, strategy: WithHydrationStrategy): T;
|
|
51
|
+
//# sourceMappingURL=withHydration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withHydration.d.ts","sourceRoot":"","sources":["../../../../src/lib/withHydration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACtC,cAAc,EAAE,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,EACrE,SAAS,EAAE,CAAC,EACZ,QAAQ,EAAE,qBAAqB,GAC9B,CAAC,CAeH"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks a component's render function for client-side hydration.
|
|
3
|
+
*
|
|
4
|
+
* This wrapper attaches metadata to the component function, enabling:
|
|
5
|
+
* 1. Build-time discovery via static analysis of source files
|
|
6
|
+
* 2. Runtime hydration strategy determination
|
|
7
|
+
*
|
|
8
|
+
* The wrapper does NOT create a new component or add runtime overhead.
|
|
9
|
+
* It simply attaches a `__hydration` property to the existing function.
|
|
10
|
+
*
|
|
11
|
+
* **Constraint:** Hydratable components must not use `puck.renderDropZone`,
|
|
12
|
+
* `puck.isEditing`, or `puck.metadata` — the `puck` prop is stripped during
|
|
13
|
+
* serialization and not available at hydration time.
|
|
14
|
+
*
|
|
15
|
+
* @param Component - The React component to mark for hydration
|
|
16
|
+
* @param strategy - When to hydrate: 'load', 'visible', or 'idle'
|
|
17
|
+
* @returns The same component with hydration metadata attached
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // In a Puck component file (e.g., TestimonialGrid.tsx)
|
|
22
|
+
* import { withHydration } from '@conloca/astro-cms'
|
|
23
|
+
*
|
|
24
|
+
* const TestimonialGridComponent = ({ title, testimonials }) => {
|
|
25
|
+
* const [currentPage, setCurrentPage] = useState(0)
|
|
26
|
+
* // ... interactive logic
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* export const TestimonialGrid: ComponentConfig<Props> = {
|
|
30
|
+
* fields: { ... },
|
|
31
|
+
* defaultProps: { ... },
|
|
32
|
+
* render: withHydration(TestimonialGridComponent, 'visible'),
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function withHydration(Component, strategy) {
|
|
37
|
+
// Environment variable escape hatch for debugging
|
|
38
|
+
if (typeof process !== 'undefined' && process.env?.CONLOCA_DISABLE_HYDRATION === 'true') {
|
|
39
|
+
return Component;
|
|
40
|
+
}
|
|
41
|
+
// Attach metadata directly to the function object
|
|
42
|
+
// This avoids creating a wrapper component and keeps bundle size minimal
|
|
43
|
+
const HydratableComponent = Component;
|
|
44
|
+
HydratableComponent.__hydration = {
|
|
45
|
+
strategy,
|
|
46
|
+
__isHydratable: true,
|
|
47
|
+
};
|
|
48
|
+
return HydratableComponent;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=withHydration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withHydration.js","sourceRoot":"","sources":["../../../../src/lib/withHydration.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,aAAa,CAC3B,SAAY,EACZ,QAA+B;IAE/B,kDAAkD;IAClD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,yBAAyB,KAAK,MAAM,EAAE,CAAC;QACxF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,kDAAkD;IAClD,yEAAyE;IACzE,MAAM,mBAAmB,GAAG,SAA+C,CAAC;IAC5E,mBAAmB,CAAC,WAAW,GAAG;QAChC,QAAQ;QACR,cAAc,EAAE,IAAI;KACrB,CAAC;IAEF,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Loader } from 'astro/loaders';
|
|
2
|
+
export interface ConlocaLoaderOptions {
|
|
3
|
+
/** Must equal the content.config key this loader is mounted under — load() asserts it. */
|
|
4
|
+
collection?: string;
|
|
5
|
+
contentRoot: string;
|
|
6
|
+
site?: string;
|
|
7
|
+
/** Collection kind. If not provided, defaults to 'fragment' for 'fragments' collection, 'page' otherwise. */
|
|
8
|
+
kind?: 'page' | 'fragment' | 'data';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Entry fields this loader owns, written into every entry's data in load().
|
|
12
|
+
*
|
|
13
|
+
* None of them belong to `pageMetaSchema`, so under a page collection's schema
|
|
14
|
+
* they survive only through the loose index signature. A host page-meta field
|
|
15
|
+
* of the same name would replace the loader's value — a host `puckData` shape
|
|
16
|
+
* would empty the page tree of every page in the built site.
|
|
17
|
+
* `buildPageCollectionSchema` refuses those names with an error.
|
|
18
|
+
*
|
|
19
|
+
* Adding a field to the record built in load() also means reserving it here.
|
|
20
|
+
*/
|
|
21
|
+
export declare const LOADER_RESERVED_FIELDS: readonly ['created', 'modified', 'name', 'data', 'mdx', 'puckData'];
|
|
22
|
+
/**
|
|
23
|
+
* Custom Astro content loader for Conloca CMS.
|
|
24
|
+
* Loads content from the Conloca content directory into Astro collections.
|
|
25
|
+
*/
|
|
26
|
+
export declare function conlocaLoader(options: ConlocaLoaderOptions): Loader;
|
|
27
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACnC,0FAA0F;IAC1F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6GAA6G;IAC7G,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;CACrC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,YAAI,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAU,CAAC;AAE1G;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAmHnE"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createContentAPI } from '@conloca/content-api/reader';
|
|
2
|
+
/**
|
|
3
|
+
* Entry fields this loader owns, written into every entry's data in load().
|
|
4
|
+
*
|
|
5
|
+
* None of them belong to `pageMetaSchema`, so under a page collection's schema
|
|
6
|
+
* they survive only through the loose index signature. A host page-meta field
|
|
7
|
+
* of the same name would replace the loader's value — a host `puckData` shape
|
|
8
|
+
* would empty the page tree of every page in the built site.
|
|
9
|
+
* `buildPageCollectionSchema` refuses those names with an error.
|
|
10
|
+
*
|
|
11
|
+
* Adding a field to the record built in load() also means reserving it here.
|
|
12
|
+
*/
|
|
13
|
+
export const LOADER_RESERVED_FIELDS = ['created', 'modified', 'name', 'data', 'mdx', 'puckData'];
|
|
14
|
+
/**
|
|
15
|
+
* Custom Astro content loader for Conloca CMS.
|
|
16
|
+
* Loads content from the Conloca content directory into Astro collections.
|
|
17
|
+
*/
|
|
18
|
+
export function conlocaLoader(options) {
|
|
19
|
+
return {
|
|
20
|
+
name: 'conloca-loader',
|
|
21
|
+
async load(context) {
|
|
22
|
+
const { store, parseData, generateDigest, logger } = context;
|
|
23
|
+
// The config key IS the name Astro types and queries; a mismatched
|
|
24
|
+
// mount (`landing: conlocaPages(...)`) would silently serve another
|
|
25
|
+
// collection's content under the wrong name.
|
|
26
|
+
if (options.collection && context.collection !== options.collection) {
|
|
27
|
+
throw new Error(`[conloca] collection mismatch: this loader is mounted under "${context.collection}" ` +
|
|
28
|
+
`but loads "${options.collection}". The content.config key must match the Conloca collection name.`);
|
|
29
|
+
}
|
|
30
|
+
// Create content API instance
|
|
31
|
+
const api = await createContentAPI({ contentRoot: options.contentRoot });
|
|
32
|
+
// Use provided kind, or fall back to inferring from collection name
|
|
33
|
+
const kind = options.kind ?? (options.collection === 'fragments' ? 'fragment' : 'page');
|
|
34
|
+
// List all content for this collection
|
|
35
|
+
// Note: fragments and data don't have a site, so only pass site for pages
|
|
36
|
+
const content = Array.from(api.listAllContent({
|
|
37
|
+
collection: options.collection,
|
|
38
|
+
kind,
|
|
39
|
+
site: kind === 'page' ? options.site : undefined,
|
|
40
|
+
}));
|
|
41
|
+
store.clear();
|
|
42
|
+
for (const manifest of content) {
|
|
43
|
+
// Skip type:'mdx' pages — they're owned by an external renderer
|
|
44
|
+
// (any Astro loader reading from a site's `mdxPages` path in
|
|
45
|
+
// sites.json, such as Starlight's stock docsLoader) and would
|
|
46
|
+
// otherwise collide with the puck-page route handler.
|
|
47
|
+
if (kind === 'page' && manifest.type === 'mdx')
|
|
48
|
+
continue;
|
|
49
|
+
for (const [locale, localeVersion] of Object.entries(manifest.locales)) {
|
|
50
|
+
if (!localeVersion)
|
|
51
|
+
continue;
|
|
52
|
+
const entryId = `${manifest.id}/${locale}`;
|
|
53
|
+
// For data and page collections, fetch full content to get the actual content fields
|
|
54
|
+
let dataContent;
|
|
55
|
+
let mdxContent;
|
|
56
|
+
let puckData;
|
|
57
|
+
if (kind === 'data') {
|
|
58
|
+
const fullContent = await api.getLocalized(manifest.id, locale);
|
|
59
|
+
if (fullContent?.localized.content?.data) {
|
|
60
|
+
dataContent = fullContent.localized.content.data;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else if (kind === 'fragment') {
|
|
64
|
+
const fullContent = await api.getLocalized(manifest.id, locale);
|
|
65
|
+
if (fullContent?.localized.content?.mdx) {
|
|
66
|
+
mdxContent = fullContent.localized.content.mdx;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else if (kind === 'page') {
|
|
70
|
+
// For page collections, fetch full content to get puckData
|
|
71
|
+
// This enables getCollection('pages') to return entries with puckData included
|
|
72
|
+
const fullContent = await api.getLocalized(manifest.id, locale);
|
|
73
|
+
if (fullContent?.localized.content?.puckData) {
|
|
74
|
+
puckData = fullContent.localized.content.puckData;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Any key added here that is not part of pageMetaSchema must also be
|
|
78
|
+
// listed in LOADER_RESERVED_FIELDS, or a host page-meta field of the
|
|
79
|
+
// same name will replace it on every page.
|
|
80
|
+
const data = {
|
|
81
|
+
id: manifest.id,
|
|
82
|
+
locale,
|
|
83
|
+
...(localeVersion.pathname && { pathname: localeVersion.pathname }),
|
|
84
|
+
...(localeVersion.name && { name: localeVersion.name }),
|
|
85
|
+
...localeVersion.meta,
|
|
86
|
+
created: localeVersion.created,
|
|
87
|
+
modified: localeVersion.modified,
|
|
88
|
+
publishAt: localeVersion.publishAt,
|
|
89
|
+
unpublishAt: localeVersion.unpublishAt,
|
|
90
|
+
// Include the data content for data collections
|
|
91
|
+
...(dataContent && { data: dataContent }),
|
|
92
|
+
};
|
|
93
|
+
if (mdxContent !== undefined) {
|
|
94
|
+
data.mdx = mdxContent;
|
|
95
|
+
}
|
|
96
|
+
// Include puckData for page collections (added separately to avoid spread type issues)
|
|
97
|
+
if (puckData !== undefined) {
|
|
98
|
+
data.puckData = puckData;
|
|
99
|
+
}
|
|
100
|
+
// filePath feeds Astro's error location: without it a validation
|
|
101
|
+
// failure names only the opaque content id, not a file to open.
|
|
102
|
+
const parsedData = await parseData({
|
|
103
|
+
id: entryId,
|
|
104
|
+
data,
|
|
105
|
+
...(localeVersion.sourcePath ? { filePath: localeVersion.sourcePath } : {}),
|
|
106
|
+
});
|
|
107
|
+
store.set({
|
|
108
|
+
id: entryId,
|
|
109
|
+
data: parsedData,
|
|
110
|
+
digest: generateDigest(localeVersion.etag),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
logger.info(`Loaded ${store.keys().length} entries from ${options.collection || `${kind} content`}`);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../src/loader.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conloca's view of a site's locales.
|
|
3
|
+
*
|
|
4
|
+
* `list` is the full set of locales the site supports; `defaultLocale`
|
|
5
|
+
* is the one that lives at the root in the `'directory'` mdx-pages
|
|
6
|
+
* strategy. Pass this shape into `conlocaCMS({ locales })`.
|
|
7
|
+
*/
|
|
8
|
+
export interface ConlocaLocales {
|
|
9
|
+
list: string[];
|
|
10
|
+
defaultLocale: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Translate Astro's native `i18n` config into Conloca's locale shape.
|
|
14
|
+
*
|
|
15
|
+
* Astro 4+ accepts both bare strings and `{ codes, path }` objects in
|
|
16
|
+
* its `locales` array — this helper flattens both forms.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { conlocaCMS, localesFromAstroI18n } from '@conloca/astro-cms/node';
|
|
21
|
+
* const i18n = { defaultLocale: 'en', locales: ['en', 'de'] };
|
|
22
|
+
* defineConfig({
|
|
23
|
+
* i18n,
|
|
24
|
+
* integrations: [conlocaCMS({ locales: localesFromAstroI18n(i18n) })],
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function localesFromAstroI18n(i18n: {
|
|
29
|
+
defaultLocale: string;
|
|
30
|
+
locales: ReadonlyArray<string | {
|
|
31
|
+
codes: string[];
|
|
32
|
+
path: string;
|
|
33
|
+
}>;
|
|
34
|
+
}): ConlocaLocales;
|
|
35
|
+
/**
|
|
36
|
+
* Translate Starlight's i18n config into Conloca's locale shape.
|
|
37
|
+
*
|
|
38
|
+
* Starlight shape: `{ defaultLocale: 'en', locales: { en: { label, lang? }, de: { ... } } }`.
|
|
39
|
+
* The default locale falls back to the first key in `locales` if unset,
|
|
40
|
+
* then to `'en'`.
|
|
41
|
+
*
|
|
42
|
+
* Usage:
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { conlocaCMS, localesFromStarlight } from '@conloca/astro-cms/node';
|
|
45
|
+
* const starlightConfig = { defaultLocale: 'en', locales: { en: { label: 'English' } } };
|
|
46
|
+
* defineConfig({
|
|
47
|
+
* integrations: [
|
|
48
|
+
* starlight(starlightConfig),
|
|
49
|
+
* conlocaCMS({ locales: localesFromStarlight(starlightConfig) }),
|
|
50
|
+
* ],
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function localesFromStarlight(starlight: {
|
|
55
|
+
defaultLocale?: string;
|
|
56
|
+
locales?: Record<string, {
|
|
57
|
+
label?: string;
|
|
58
|
+
lang?: string;
|
|
59
|
+
}>;
|
|
60
|
+
}): ConlocaLocales;
|
|
61
|
+
//# sourceMappingURL=locales-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales-helpers.d.ts","sourceRoot":"","sources":["../../../src/locales-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,aAAa,CAAC,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE,GAAG,cAAc,CAKjB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7D,GAAG,cAAc,CAOjB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translate Astro's native `i18n` config into Conloca's locale shape.
|
|
3
|
+
*
|
|
4
|
+
* Astro 4+ accepts both bare strings and `{ codes, path }` objects in
|
|
5
|
+
* its `locales` array — this helper flattens both forms.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { conlocaCMS, localesFromAstroI18n } from '@conloca/astro-cms/node';
|
|
10
|
+
* const i18n = { defaultLocale: 'en', locales: ['en', 'de'] };
|
|
11
|
+
* defineConfig({
|
|
12
|
+
* i18n,
|
|
13
|
+
* integrations: [conlocaCMS({ locales: localesFromAstroI18n(i18n) })],
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function localesFromAstroI18n(i18n) {
|
|
18
|
+
return {
|
|
19
|
+
defaultLocale: i18n.defaultLocale,
|
|
20
|
+
list: i18n.locales.flatMap((l) => (typeof l === 'string' ? [l] : l.codes)),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Translate Starlight's i18n config into Conloca's locale shape.
|
|
25
|
+
*
|
|
26
|
+
* Starlight shape: `{ defaultLocale: 'en', locales: { en: { label, lang? }, de: { ... } } }`.
|
|
27
|
+
* The default locale falls back to the first key in `locales` if unset,
|
|
28
|
+
* then to `'en'`.
|
|
29
|
+
*
|
|
30
|
+
* Usage:
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { conlocaCMS, localesFromStarlight } from '@conloca/astro-cms/node';
|
|
33
|
+
* const starlightConfig = { defaultLocale: 'en', locales: { en: { label: 'English' } } };
|
|
34
|
+
* defineConfig({
|
|
35
|
+
* integrations: [
|
|
36
|
+
* starlight(starlightConfig),
|
|
37
|
+
* conlocaCMS({ locales: localesFromStarlight(starlightConfig) }),
|
|
38
|
+
* ],
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function localesFromStarlight(starlight) {
|
|
43
|
+
const list = Object.keys(starlight.locales ?? {});
|
|
44
|
+
const fallback = starlight.defaultLocale ?? list[0] ?? 'en';
|
|
45
|
+
return {
|
|
46
|
+
defaultLocale: fallback,
|
|
47
|
+
list: list.length > 0 ? list : [fallback],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=locales-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales-helpers.js","sourceRoot":"","sources":["../../../src/locales-helpers.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAGpC;IACC,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAGpC;IACC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC5D,OAAO;QACL,aAAa,EAAE,QAAQ;QACvB,IAAI,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime-types.d.ts","sourceRoot":"","sources":["../../../src/mime-types.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiBjD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** MIME types for SPA static asset serving. Covers all file types produced by the cms-spa build. */
|
|
2
|
+
export const SPA_MIME_TYPES = {
|
|
3
|
+
'.js': 'application/javascript',
|
|
4
|
+
'.mjs': 'application/javascript',
|
|
5
|
+
'.css': 'text/css',
|
|
6
|
+
'.html': 'text/html',
|
|
7
|
+
'.json': 'application/json',
|
|
8
|
+
'.svg': 'image/svg+xml',
|
|
9
|
+
'.png': 'image/png',
|
|
10
|
+
'.jpg': 'image/jpeg',
|
|
11
|
+
'.jpeg': 'image/jpeg',
|
|
12
|
+
'.gif': 'image/gif',
|
|
13
|
+
'.webp': 'image/webp',
|
|
14
|
+
'.woff': 'font/woff',
|
|
15
|
+
'.woff2': 'font/woff2',
|
|
16
|
+
'.ttf': 'font/ttf',
|
|
17
|
+
'.map': 'application/json',
|
|
18
|
+
'.ico': 'image/x-icon',
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=mime-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime-types.js","sourceRoot":"","sources":["../../../src/mime-types.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,CAAC,MAAM,cAAc,GAA2B;IACpD,KAAK,EAAE,wBAAwB;IAC/B,MAAM,EAAE,wBAAwB;IAChC,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,kBAAkB;IAC3B,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,cAAc;CACvB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DataBindingConfig, PageReference } from './types.js';
|
|
2
|
+
/** How to order and cap the list, plus the language to read; the site's own language by default. */
|
|
3
|
+
export type PageFeedOptions = Omit<NonNullable<DataBindingConfig['pages']>, 'prefix'> & {
|
|
4
|
+
locale?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The same list a route's `dataBindings.pages` hands its blocks as
|
|
8
|
+
* `DataContext.pages`: one language, published pages only, newest publish date
|
|
9
|
+
* first unless `sort` says otherwise, and metadata without the fields the
|
|
10
|
+
* content store keeps for itself.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getPagesByPrefix(prefix: string, options?: PageFeedOptions): Promise<PageReference[]>;
|
|
13
|
+
//# sourceMappingURL=page-feed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-feed.d.ts","sourceRoot":"","sources":["../../../src/page-feed.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEnE,oGAAoG;AACpG,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5G;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAW9G"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getCollection } from 'astro:content';
|
|
2
|
+
import routingConfig from 'virtual:conloca-routing-config';
|
|
3
|
+
import { createCollectionContentSource, getPagesByPrefix as readPagesByPrefix } from './handlers/page-render-core.js';
|
|
4
|
+
/**
|
|
5
|
+
* The same list a route's `dataBindings.pages` hands its blocks as
|
|
6
|
+
* `DataContext.pages`: one language, published pages only, newest publish date
|
|
7
|
+
* first unless `sort` says otherwise, and metadata without the fields the
|
|
8
|
+
* content store keeps for itself.
|
|
9
|
+
*/
|
|
10
|
+
export async function getPagesByPrefix(prefix, options = {}) {
|
|
11
|
+
// With routing off there are no page collections to read and no resolved
|
|
12
|
+
// language, so the list would come back empty with nothing to say why.
|
|
13
|
+
if (!routingConfig.enabled) {
|
|
14
|
+
throw new Error(`[Conloca] getPagesByPrefix('${prefix}') found no content routes: pass \`layout\` or \`routing\` to conlocaCMS() in astro.config.`);
|
|
15
|
+
}
|
|
16
|
+
const { locale = routingConfig.locale, ...order } = options;
|
|
17
|
+
const source = createCollectionContentSource({ getCollection, isDev: import.meta.env.DEV });
|
|
18
|
+
return readPagesByPrefix(source, prefix, locale, routingConfig, order);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=page-feed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-feed.js","sourceRoot":"","sources":["../../../src/page-feed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAMtH;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAc,EAAE,OAAO,GAAoB,EAAE;IAClF,yEAAyE;IACzE,uEAAuE;IACvE,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,+BAA+B,MAAM,6FAA6F,CACnI,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAC5D,MAAM,MAAM,GAAG,6BAA6B,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5F,OAAO,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Light page-schema helpers for Astro content configs and host schema modules.
|
|
3
|
+
* Does not import the CMS SPA / MDX editor.
|
|
4
|
+
*/
|
|
5
|
+
export { type CoreFieldsMode, definePageSchema, type FieldHint, type FieldHintCommon, type FieldHints, type FieldHintVariant, type PageSchemaDescriptor, type PageSchemaEntry, type PageSchemaGroup, type PageSchemas, type ResolveSchemaContext, resolvePageSchemaEntry, toPageSchemaDescriptor, } from '@conloca/cms-spa/page-schema-define';
|
|
6
|
+
//# sourceMappingURL=page-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-schemas.d.ts","sourceRoot":"","sources":["../../../src/page-schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,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,EAChB,KAAK,oBAAoB,EACzB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Light page-schema helpers for Astro content configs and host schema modules.
|
|
3
|
+
* Does not import the CMS SPA / MDX editor.
|
|
4
|
+
*/
|
|
5
|
+
export { definePageSchema, resolvePageSchemaEntry, toPageSchemaDescriptor, } from '@conloca/cms-spa/page-schema-define';
|
|
6
|
+
//# sourceMappingURL=page-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-schemas.js","sourceRoot":"","sources":["../../../src/page-schemas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAEL,gBAAgB,EAUhB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates that a target path resolves within a base directory.
|
|
3
|
+
* Prevents path traversal attacks by canonicalizing both paths
|
|
4
|
+
* and checking that the target starts with the base path + separator
|
|
5
|
+
* (or is exactly the base path).
|
|
6
|
+
*/
|
|
7
|
+
export declare function isPathWithinBase(basePath: string, targetPath: string): boolean;
|
|
8
|
+
//# sourceMappingURL=path-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-validation.d.ts","sourceRoot":"","sources":["../../../src/path-validation.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAI9E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { resolve, sep } from 'node:path';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that a target path resolves within a base directory.
|
|
4
|
+
* Prevents path traversal attacks by canonicalizing both paths
|
|
5
|
+
* and checking that the target starts with the base path + separator
|
|
6
|
+
* (or is exactly the base path).
|
|
7
|
+
*/
|
|
8
|
+
export function isPathWithinBase(basePath, targetPath) {
|
|
9
|
+
const resolvedBase = resolve(basePath);
|
|
10
|
+
const resolvedTarget = resolve(targetPath);
|
|
11
|
+
return resolvedTarget === resolvedBase || resolvedTarget.startsWith(resolvedBase + sep);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=path-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-validation.js","sourceRoot":"","sources":["../../../src/path-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,UAAkB;IACnE,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,OAAO,cAAc,KAAK,YAAY,IAAI,cAAc,CAAC,UAAU,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC;AAC1F,CAAC"}
|