@lupinum/ginko-content 0.1.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/LICENSE +21 -0
- package/README.md +90 -0
- package/compatibility.json +27 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +690 -0
- package/dist/cms-contract/build +1 -0
- package/dist/cms-contract/build.d.ts +44 -0
- package/dist/cms-contract/build.js +513 -0
- package/dist/cms-contract/index +1 -0
- package/dist/cms-contract/index.d.ts +25 -0
- package/dist/cms-contract/index.js +37 -0
- package/dist/cms-contract/mdc +1 -0
- package/dist/cms-contract/mdc.d.ts +32 -0
- package/dist/cms-contract/mdc.js +52 -0
- package/dist/cms-contract/path +1 -0
- package/dist/cms-contract/path.d.ts +12 -0
- package/dist/cms-contract/path.js +18 -0
- package/dist/cms-contract/schema +1 -0
- package/dist/cms-contract/schema.d.ts +18 -0
- package/dist/cms-contract/schema.js +13 -0
- package/dist/cms-contract/types +1 -0
- package/dist/cms-contract/types.d.ts +177 -0
- package/dist/cms-contract/types.js +0 -0
- package/dist/cms-import/index +1 -0
- package/dist/cms-import/index.d.ts +21 -0
- package/dist/cms-import/index.js +57 -0
- package/dist/config.d.mts +3 -0
- package/dist/config.mjs +3 -0
- package/dist/core/cache +1 -0
- package/dist/core/cache-hints +1 -0
- package/dist/core/cache-hints.d.ts +3 -0
- package/dist/core/cache-hints.js +55 -0
- package/dist/core/cache.d.ts +29 -0
- package/dist/core/cache.js +0 -0
- package/dist/core/content/collection +1 -0
- package/dist/core/content/collection.d.ts +3 -0
- package/dist/core/content/collection.js +52 -0
- package/dist/core/content/graph +1 -0
- package/dist/core/content/graph.d.ts +147 -0
- package/dist/core/content/graph.js +189 -0
- package/dist/core/content/ignore +1 -0
- package/dist/core/content/ignore.d.ts +5 -0
- package/dist/core/content/ignore.js +10 -0
- package/dist/core/content/locale +1 -0
- package/dist/core/content/locale.d.ts +61 -0
- package/dist/core/content/locale.js +77 -0
- package/dist/core/content/path +1 -0
- package/dist/core/content/path.d.ts +36 -0
- package/dist/core/content/path.js +143 -0
- package/dist/core/content/slug +1 -0
- package/dist/core/content/slug.d.ts +4 -0
- package/dist/core/content/slug.js +41 -0
- package/dist/core/content/sources +1 -0
- package/dist/core/content/sources.d.ts +2 -0
- package/dist/core/content/sources.js +6 -0
- package/dist/core/errors +1 -0
- package/dist/core/errors.d.ts +15 -0
- package/dist/core/errors.js +10 -0
- package/dist/core/markdown/tree +1 -0
- package/dist/core/markdown/tree.d.ts +9 -0
- package/dist/core/markdown/tree.js +47 -0
- package/dist/core/query/builder +1 -0
- package/dist/core/query/builder.d.ts +18 -0
- package/dist/core/query/builder.js +186 -0
- package/dist/core/query/execute +1 -0
- package/dist/core/query/execute.d.ts +52 -0
- package/dist/core/query/execute.js +304 -0
- package/dist/core/query/filter +1 -0
- package/dist/core/query/filter.d.ts +42 -0
- package/dist/core/query/filter.js +118 -0
- package/dist/core/query/json +1 -0
- package/dist/core/query/json.d.ts +2 -0
- package/dist/core/query/json.js +20 -0
- package/dist/core/query/lower +1 -0
- package/dist/core/query/lower.d.ts +14 -0
- package/dist/core/query/lower.js +121 -0
- package/dist/core/query/operators +1 -0
- package/dist/core/query/operators.d.ts +23 -0
- package/dist/core/query/operators.js +126 -0
- package/dist/core/query/params +1 -0
- package/dist/core/query/params.d.ts +15 -0
- package/dist/core/query/params.js +83 -0
- package/dist/core/query/plan +1 -0
- package/dist/core/query/plan.d.ts +110 -0
- package/dist/core/query/plan.js +0 -0
- package/dist/core/references/resolve +1 -0
- package/dist/core/references/resolve.d.ts +31 -0
- package/dist/core/references/resolve.js +121 -0
- package/dist/core/references/schema +1 -0
- package/dist/core/references/schema.d.ts +8 -0
- package/dist/core/references/schema.js +70 -0
- package/dist/core/result +1 -0
- package/dist/core/result.d.ts +27 -0
- package/dist/core/result.js +2 -0
- package/dist/features/collections/resolve +1 -0
- package/dist/features/collections/resolve.d.ts +63 -0
- package/dist/features/collections/resolve.js +76 -0
- package/dist/features/localization/config +1 -0
- package/dist/features/localization/config.d.ts +18 -0
- package/dist/features/localization/config.js +25 -0
- package/dist/features/localization/links +1 -0
- package/dist/features/localization/links.d.ts +1 -0
- package/dist/features/localization/links.js +69 -0
- package/dist/features/localization/path +1 -0
- package/dist/features/localization/path.d.ts +32 -0
- package/dist/features/localization/path.js +80 -0
- package/dist/features/localization/results +1 -0
- package/dist/features/localization/results.d.ts +42 -0
- package/dist/features/localization/results.js +149 -0
- package/dist/features/localization/translated-slugs +1 -0
- package/dist/features/localization/translated-slugs.d.ts +11 -0
- package/dist/features/localization/translated-slugs.js +80 -0
- package/dist/features/navigation/build +1 -0
- package/dist/features/navigation/build.d.ts +28 -0
- package/dist/features/navigation/build.js +104 -0
- package/dist/features/navigation/canonical +1 -0
- package/dist/features/navigation/canonical.d.ts +33 -0
- package/dist/features/navigation/canonical.js +149 -0
- package/dist/features/navigation/query +1 -0
- package/dist/features/navigation/query.d.ts +19 -0
- package/dist/features/navigation/query.js +51 -0
- package/dist/features/navigation/resolve +1 -0
- package/dist/features/navigation/resolve.d.ts +20 -0
- package/dist/features/navigation/resolve.js +79 -0
- package/dist/features/navigation/tree +1 -0
- package/dist/features/navigation/tree.d.ts +6 -0
- package/dist/features/navigation/tree.js +32 -0
- package/dist/features/search/navigation +1 -0
- package/dist/features/search/navigation.d.ts +6 -0
- package/dist/features/search/navigation.js +21 -0
- package/dist/features/search/sections +1 -0
- package/dist/features/search/sections.d.ts +21 -0
- package/dist/features/search/sections.js +98 -0
- package/dist/features/sitemap/query +1 -0
- package/dist/features/sitemap/query.d.ts +68 -0
- package/dist/features/sitemap/query.js +171 -0
- package/dist/integrations/nitro/context +1 -0
- package/dist/integrations/nitro/context.d.ts +63 -0
- package/dist/integrations/nitro/context.js +28 -0
- package/dist/integrations/nitro/ingest +1 -0
- package/dist/integrations/nitro/ingest.d.ts +18 -0
- package/dist/integrations/nitro/ingest.js +120 -0
- package/dist/integrations/nitro/preview +1 -0
- package/dist/integrations/nitro/preview.d.ts +5 -0
- package/dist/integrations/nitro/preview.js +21 -0
- package/dist/integrations/nitro/runtime-config +1 -0
- package/dist/integrations/nitro/runtime-config.d.ts +1 -0
- package/dist/integrations/nitro/runtime-config.js +4 -0
- package/dist/integrations/nitro/storage +1 -0
- package/dist/integrations/nitro/storage.d.ts +9 -0
- package/dist/integrations/nitro/storage.js +113 -0
- package/dist/integrations/vue/content-components +1 -0
- package/dist/integrations/vue/content-components.d.ts +24 -0
- package/dist/integrations/vue/content-components.js +67 -0
- package/dist/integrations/vue/html-tags +1 -0
- package/dist/integrations/vue/html-tags.d.ts +2 -0
- package/dist/integrations/vue/html-tags.js +119 -0
- package/dist/integrations/vue/markdown-refs +1 -0
- package/dist/integrations/vue/markdown-refs.d.ts +1 -0
- package/dist/integrations/vue/markdown-refs.js +1 -0
- package/dist/module.d.mts +2044 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +1381 -0
- package/dist/parsers/csv +1 -0
- package/dist/parsers/csv.d.ts +2 -0
- package/dist/parsers/csv.js +38 -0
- package/dist/parsers/from-csv +1 -0
- package/dist/parsers/from-csv.d.ts +20 -0
- package/dist/parsers/from-csv.js +85 -0
- package/dist/parsers/index +1 -0
- package/dist/parsers/index.d.ts +10 -0
- package/dist/parsers/index.js +50 -0
- package/dist/parsers/json +1 -0
- package/dist/parsers/json.d.ts +2 -0
- package/dist/parsers/json.js +29 -0
- package/dist/parsers/markdown +1 -0
- package/dist/parsers/markdown-plugins +1 -0
- package/dist/parsers/markdown-plugins.d.ts +3 -0
- package/dist/parsers/markdown-plugins.js +58 -0
- package/dist/parsers/markdown.d.ts +2 -0
- package/dist/parsers/markdown.js +64 -0
- package/dist/parsers/path-meta +1 -0
- package/dist/parsers/path-meta.d.ts +4 -0
- package/dist/parsers/path-meta.js +37 -0
- package/dist/parsers/utils +1 -0
- package/dist/parsers/utils.d.ts +2 -0
- package/dist/parsers/utils.js +3 -0
- package/dist/parsers/yaml +1 -0
- package/dist/parsers/yaml.d.ts +2 -0
- package/dist/parsers/yaml.js +19 -0
- package/dist/public/client +1 -0
- package/dist/public/client.d.ts +19 -0
- package/dist/public/client.js +26 -0
- package/dist/public/provider +1 -0
- package/dist/public/provider-errors +1 -0
- package/dist/public/provider-errors.d.ts +4 -0
- package/dist/public/provider-errors.js +28 -0
- package/dist/public/provider.d.ts +74 -0
- package/dist/public/provider.js +6 -0
- package/dist/public/server +1 -0
- package/dist/public/server.d.ts +19 -0
- package/dist/public/server.js +28 -0
- package/dist/runtime/app/components/ContentRenderer.d.vue.ts +62 -0
- package/dist/runtime/app/components/ContentRenderer.vue +84 -0
- package/dist/runtime/app/components/ContentRenderer.vue.d.ts +62 -0
- package/dist/runtime/app/components/ContentRendererInline.d.vue.ts +50 -0
- package/dist/runtime/app/components/ContentRendererInline.vue +97 -0
- package/dist/runtime/app/components/ContentRendererInline.vue.d.ts +50 -0
- package/dist/runtime/app/components/Prose/ProseCode.d.vue.ts +61 -0
- package/dist/runtime/app/components/Prose/ProseCode.vue +32 -0
- package/dist/runtime/app/components/Prose/ProseCode.vue.d.ts +61 -0
- package/dist/runtime/app/components/Prose/ProseCodeInline.d.vue.ts +13 -0
- package/dist/runtime/app/components/Prose/ProseCodeInline.vue +3 -0
- package/dist/runtime/app/components/Prose/ProseCodeInline.vue.d.ts +13 -0
- package/dist/runtime/app/components/Prose/ProseImg.d.vue.ts +59 -0
- package/dist/runtime/app/components/Prose/ProseImg.vue +59 -0
- package/dist/runtime/app/components/Prose/ProseImg.vue.d.ts +59 -0
- package/dist/runtime/app/components/Prose/ProsePre.d.vue.ts +79 -0
- package/dist/runtime/app/components/Prose/ProsePre.vue +42 -0
- package/dist/runtime/app/components/Prose/ProsePre.vue.d.ts +79 -0
- package/dist/runtime/app/components/internal/ContentRendererMarkdown.d.vue.ts +68 -0
- package/dist/runtime/app/components/internal/ContentRendererMarkdown.vue +99 -0
- package/dist/runtime/app/components/internal/ContentRendererMarkdown.vue.d.ts +68 -0
- package/dist/runtime/app/components/internal/MarkdownRenderer +1 -0
- package/dist/runtime/app/components/internal/MarkdownRenderer.d.ts +90 -0
- package/dist/runtime/app/components/internal/MarkdownRenderer.js +191 -0
- package/dist/runtime/app/composables/async-data +1 -0
- package/dist/runtime/app/composables/async-data.d.ts +2 -0
- package/dist/runtime/app/composables/async-data.js +4 -0
- package/dist/runtime/app/composables/content-i18n +1 -0
- package/dist/runtime/app/composables/content-i18n.d.ts +5 -0
- package/dist/runtime/app/composables/content-i18n.js +1 -0
- package/dist/runtime/app/composables/head +1 -0
- package/dist/runtime/app/composables/head.d.ts +11 -0
- package/dist/runtime/app/composables/head.js +98 -0
- package/dist/runtime/app/composables/locale +1 -0
- package/dist/runtime/app/composables/locale-context +1 -0
- package/dist/runtime/app/composables/locale-context.d.ts +5 -0
- package/dist/runtime/app/composables/locale-context.js +8 -0
- package/dist/runtime/app/composables/locale.d.ts +8 -0
- package/dist/runtime/app/composables/locale.js +15 -0
- package/dist/runtime/app/composables/navigation +1 -0
- package/dist/runtime/app/composables/navigation.d.ts +3 -0
- package/dist/runtime/app/composables/navigation.js +7 -0
- package/dist/runtime/app/composables/preview +1 -0
- package/dist/runtime/app/composables/preview.d.ts +5 -0
- package/dist/runtime/app/composables/preview.js +52 -0
- package/dist/runtime/app/composables/query-api +1 -0
- package/dist/runtime/app/composables/query-api.d.ts +27 -0
- package/dist/runtime/app/composables/query-api.js +46 -0
- package/dist/runtime/app/composables/route +1 -0
- package/dist/runtime/app/composables/route.d.ts +11 -0
- package/dist/runtime/app/composables/route.js +150 -0
- package/dist/runtime/app/composables/runtime +1 -0
- package/dist/runtime/app/composables/runtime.d.ts +2 -0
- package/dist/runtime/app/composables/runtime.js +7 -0
- package/dist/runtime/app/composables/search +1 -0
- package/dist/runtime/app/composables/search.d.ts +58 -0
- package/dist/runtime/app/composables/search.js +321 -0
- package/dist/runtime/app/composables/site-data +1 -0
- package/dist/runtime/app/composables/site-data.d.ts +12 -0
- package/dist/runtime/app/composables/site-data.js +12 -0
- package/dist/runtime/app/composables/toc +1 -0
- package/dist/runtime/app/composables/toc.d.ts +10 -0
- package/dist/runtime/app/composables/toc.js +31 -0
- package/dist/runtime/app/composables/use-content +1 -0
- package/dist/runtime/app/composables/use-content.d.ts +188 -0
- package/dist/runtime/app/composables/use-content.js +307 -0
- package/dist/runtime/app/composables/useUnwrap +1 -0
- package/dist/runtime/app/composables/useUnwrap.d.ts +8 -0
- package/dist/runtime/app/composables/useUnwrap.js +35 -0
- package/dist/runtime/app/composables/utils +1 -0
- package/dist/runtime/app/composables/utils.d.ts +22 -0
- package/dist/runtime/app/composables/utils.js +76 -0
- package/dist/runtime/app/composables/web-socket +1 -0
- package/dist/runtime/app/composables/web-socket.d.ts +3 -0
- package/dist/runtime/app/composables/web-socket.js +65 -0
- package/dist/runtime/app/pages/content.d.vue.ts +3 -0
- package/dist/runtime/app/pages/content.vue +14 -0
- package/dist/runtime/app/pages/content.vue.d.ts +3 -0
- package/dist/runtime/app/plugins/markdown-components +1 -0
- package/dist/runtime/app/plugins/markdown-components.d.ts +2 -0
- package/dist/runtime/app/plugins/markdown-components.js +19 -0
- package/dist/runtime/app/plugins/ws +1 -0
- package/dist/runtime/app/plugins/ws.d.ts +2 -0
- package/dist/runtime/app/plugins/ws.js +7 -0
- package/dist/runtime/app.d.vue.ts +3 -0
- package/dist/runtime/app.vue +3 -0
- package/dist/runtime/app.vue.d.ts +3 -0
- package/dist/runtime/markdown/plugins +1 -0
- package/dist/runtime/markdown/plugins.d.ts +3 -0
- package/dist/runtime/markdown/plugins.js +39 -0
- package/dist/runtime/query/public-limits +1 -0
- package/dist/runtime/query/public-limits.d.ts +2 -0
- package/dist/runtime/query/public-limits.js +2 -0
- package/dist/runtime/query/resolve +1 -0
- package/dist/runtime/query/resolve.d.ts +5 -0
- package/dist/runtime/query/resolve.js +9 -0
- package/dist/runtime/query/routes +1 -0
- package/dist/runtime/query/routes.d.ts +33 -0
- package/dist/runtime/query/routes.js +21 -0
- package/dist/runtime/query/unified +1 -0
- package/dist/runtime/query/unified.d.ts +94 -0
- package/dist/runtime/query/unified.js +473 -0
- package/dist/runtime/server/api/cache +1 -0
- package/dist/runtime/server/api/cache.d.ts +8 -0
- package/dist/runtime/server/api/cache.js +26 -0
- package/dist/runtime/server/api/locales +1 -0
- package/dist/runtime/server/api/locales.d.ts +6 -0
- package/dist/runtime/server/api/locales.js +28 -0
- package/dist/runtime/server/api/navigation +1 -0
- package/dist/runtime/server/api/navigation.d.ts +2 -0
- package/dist/runtime/server/api/navigation.js +21 -0
- package/dist/runtime/server/api/query +1 -0
- package/dist/runtime/server/api/query.d.ts +2 -0
- package/dist/runtime/server/api/query.js +6 -0
- package/dist/runtime/server/api/revalidate +1 -0
- package/dist/runtime/server/api/revalidate.d.ts +6 -0
- package/dist/runtime/server/api/revalidate.js +156 -0
- package/dist/runtime/server/api/search +1 -0
- package/dist/runtime/server/api/search-index +1 -0
- package/dist/runtime/server/api/search-index.d.ts +2 -0
- package/dist/runtime/server/api/search-index.js +20 -0
- package/dist/runtime/server/api/search.d.ts +2 -0
- package/dist/runtime/server/api/search.js +40 -0
- package/dist/runtime/server/api/site-data +1 -0
- package/dist/runtime/server/api/site-data.d.ts +2 -0
- package/dist/runtime/server/api/site-data.js +22 -0
- package/dist/runtime/server/api/sitemap +1 -0
- package/dist/runtime/server/api/sitemap.d.ts +2 -0
- package/dist/runtime/server/api/sitemap.js +11 -0
- package/dist/runtime/server/cache-adapter +1 -0
- package/dist/runtime/server/cache-adapter.d.ts +2 -0
- package/dist/runtime/server/cache-adapter.js +11 -0
- package/dist/runtime/server/cache-adapters +1 -0
- package/dist/runtime/server/cache-adapters.d.ts +9 -0
- package/dist/runtime/server/cache-adapters.js +50 -0
- package/dist/runtime/server/cache-hints +1 -0
- package/dist/runtime/server/cache-hints.d.ts +5 -0
- package/dist/runtime/server/cache-hints.js +17 -0
- package/dist/runtime/server/collection-helpers +1 -0
- package/dist/runtime/server/collection-helpers.d.ts +13 -0
- package/dist/runtime/server/collection-helpers.js +99 -0
- package/dist/runtime/server/index +1 -0
- package/dist/runtime/server/index.d.ts +9 -0
- package/dist/runtime/server/index.js +15 -0
- package/dist/runtime/server/manifest +1 -0
- package/dist/runtime/server/manifest.d.ts +1 -0
- package/dist/runtime/server/manifest.js +1 -0
- package/dist/runtime/server/navigation +1 -0
- package/dist/runtime/server/navigation-query +1 -0
- package/dist/runtime/server/navigation-query.d.ts +4 -0
- package/dist/runtime/server/navigation-query.js +80 -0
- package/dist/runtime/server/navigation.d.ts +2 -0
- package/dist/runtime/server/navigation.js +9 -0
- package/dist/runtime/server/pagefind +1 -0
- package/dist/runtime/server/pagefind.d.ts +2 -0
- package/dist/runtime/server/pagefind.js +30 -0
- package/dist/runtime/server/plugins/cache +1 -0
- package/dist/runtime/server/plugins/cache.d.ts +2 -0
- package/dist/runtime/server/plugins/cache.js +17 -0
- package/dist/runtime/server/plugins/sitemap +1 -0
- package/dist/runtime/server/plugins/sitemap.d.ts +2 -0
- package/dist/runtime/server/plugins/sitemap.js +25 -0
- package/dist/runtime/server/preview +1 -0
- package/dist/runtime/server/preview.d.ts +1 -0
- package/dist/runtime/server/preview.js +1 -0
- package/dist/runtime/server/provider-query +1 -0
- package/dist/runtime/server/provider-query.d.ts +27 -0
- package/dist/runtime/server/provider-query.js +131 -0
- package/dist/runtime/server/provider-result +1 -0
- package/dist/runtime/server/provider-result.d.ts +10 -0
- package/dist/runtime/server/provider-result.js +30 -0
- package/dist/runtime/server/providers/filesystem +1 -0
- package/dist/runtime/server/providers/filesystem.d.ts +2 -0
- package/dist/runtime/server/providers/filesystem.js +47 -0
- package/dist/runtime/server/providers/index +1 -0
- package/dist/runtime/server/providers/index.d.ts +3 -0
- package/dist/runtime/server/providers/index.js +190 -0
- package/dist/runtime/server/query-api +1 -0
- package/dist/runtime/server/query-api.d.ts +28 -0
- package/dist/runtime/server/query-api.js +54 -0
- package/dist/runtime/server/query-executor +1 -0
- package/dist/runtime/server/query-executor.d.ts +4 -0
- package/dist/runtime/server/query-executor.js +121 -0
- package/dist/runtime/server/runtime-config +1 -0
- package/dist/runtime/server/runtime-config.d.ts +1 -0
- package/dist/runtime/server/runtime-config.js +1 -0
- package/dist/runtime/server/search +1 -0
- package/dist/runtime/server/search.d.ts +18 -0
- package/dist/runtime/server/search.js +134 -0
- package/dist/runtime/server/sitemap +1 -0
- package/dist/runtime/server/sitemap-provider +1 -0
- package/dist/runtime/server/sitemap-provider.d.ts +10 -0
- package/dist/runtime/server/sitemap-provider.js +11 -0
- package/dist/runtime/server/sitemap.d.ts +6 -0
- package/dist/runtime/server/sitemap.js +45 -0
- package/dist/runtime/server/storage +1 -0
- package/dist/runtime/server/storage-access +1 -0
- package/dist/runtime/server/storage-access.d.ts +1 -0
- package/dist/runtime/server/storage-access.js +9 -0
- package/dist/runtime/server/storage.d.ts +2 -0
- package/dist/runtime/server/storage.js +2 -0
- package/dist/runtime/server/validation +1 -0
- package/dist/runtime/server/validation.d.ts +1 -0
- package/dist/runtime/server/validation.js +6 -0
- package/dist/runtime/shared/search +1 -0
- package/dist/runtime/shared/search.d.ts +2 -0
- package/dist/runtime/shared/search.js +89 -0
- package/dist/runtime/transformers/component-resolver +1 -0
- package/dist/runtime/transformers/component-resolver.d.ts +10 -0
- package/dist/runtime/transformers/component-resolver.js +30 -0
- package/dist/runtime/transformers/csv/from-csv +1 -0
- package/dist/runtime/transformers/csv/from-csv.d.ts +1 -0
- package/dist/runtime/transformers/csv/from-csv.js +1 -0
- package/dist/runtime/transformers/csv/index +1 -0
- package/dist/runtime/transformers/csv/index.d.ts +1 -0
- package/dist/runtime/transformers/csv/index.js +1 -0
- package/dist/runtime/transformers/define +1 -0
- package/dist/runtime/transformers/define.d.ts +1 -0
- package/dist/runtime/transformers/define.js +1 -0
- package/dist/runtime/transformers/index +1 -0
- package/dist/runtime/transformers/index.d.ts +1 -0
- package/dist/runtime/transformers/index.js +1 -0
- package/dist/runtime/transformers/json +1 -0
- package/dist/runtime/transformers/json.d.ts +1 -0
- package/dist/runtime/transformers/json.js +1 -0
- package/dist/runtime/transformers/markdown +1 -0
- package/dist/runtime/transformers/markdown.d.ts +1 -0
- package/dist/runtime/transformers/markdown.js +1 -0
- package/dist/runtime/transformers/path-meta +1 -0
- package/dist/runtime/transformers/path-meta.d.ts +2 -0
- package/dist/runtime/transformers/path-meta.js +2 -0
- package/dist/runtime/transformers/utils +1 -0
- package/dist/runtime/transformers/utils.d.ts +1 -0
- package/dist/runtime/transformers/utils.js +1 -0
- package/dist/runtime/transformers/yaml +1 -0
- package/dist/runtime/transformers/yaml.d.ts +1 -0
- package/dist/runtime/transformers/yaml.js +1 -0
- package/dist/runtime/utils/content-components +1 -0
- package/dist/runtime/utils/content-components.d.ts +9 -0
- package/dist/runtime/utils/content-components.js +16 -0
- package/dist/runtime/utils/query +1 -0
- package/dist/runtime/utils/query.d.ts +5 -0
- package/dist/runtime/utils/query.js +18 -0
- package/dist/runtime/virtual/transformers.d.ts +4 -0
- package/dist/runtime/virtual.d.ts +7 -0
- package/dist/storage/cache +1 -0
- package/dist/storage/cache.d.ts +32 -0
- package/dist/storage/cache.js +42 -0
- package/dist/storage/content +1 -0
- package/dist/storage/content.d.ts +41 -0
- package/dist/storage/content.js +86 -0
- package/dist/storage/contents +1 -0
- package/dist/storage/contents.d.ts +5 -0
- package/dist/storage/contents.js +116 -0
- package/dist/storage/driver +1 -0
- package/dist/storage/driver.d.ts +28 -0
- package/dist/storage/driver.js +22 -0
- package/dist/storage/graph +1 -0
- package/dist/storage/graph.d.ts +3 -0
- package/dist/storage/graph.js +14 -0
- package/dist/storage/manifest +1 -0
- package/dist/storage/manifest.d.ts +18 -0
- package/dist/storage/manifest.js +68 -0
- package/dist/storage/references +1 -0
- package/dist/storage/references.d.ts +13 -0
- package/dist/storage/references.js +78 -0
- package/dist/storage/validation +1 -0
- package/dist/storage/validation.d.ts +46 -0
- package/dist/storage/validation.js +341 -0
- package/dist/testing/provider-contract +1 -0
- package/dist/testing/provider-contract.d.ts +31 -0
- package/dist/testing/provider-contract.js +237 -0
- package/dist/testing/provider-fixture +1 -0
- package/dist/testing/provider-fixture.d.ts +65 -0
- package/dist/testing/provider-fixture.js +606 -0
- package/dist/types/api +1 -0
- package/dist/types/api.d.ts +47 -0
- package/dist/types/api.js +1 -0
- package/dist/types/config +1 -0
- package/dist/types/config.d.ts +281 -0
- package/dist/types/config.js +28 -0
- package/dist/types/content +1 -0
- package/dist/types/content.d.ts +311 -0
- package/dist/types/content.js +1 -0
- package/dist/types/fields +1 -0
- package/dist/types/fields.d.ts +81 -0
- package/dist/types/fields.js +146 -0
- package/dist/types/index +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +6 -0
- package/dist/types/module +1 -0
- package/dist/types/module.d.ts +428 -0
- package/dist/types/module.js +0 -0
- package/dist/types/picomatch.d.ts +8 -0
- package/dist/types/query +1 -0
- package/dist/types/query.d.ts +862 -0
- package/dist/types/query.js +1 -0
- package/dist/types/reference +1 -0
- package/dist/types/reference.d.ts +1 -0
- package/dist/types/reference.js +1 -0
- package/dist/types/runtime +1 -0
- package/dist/types/runtime.d.ts +45 -0
- package/dist/types/runtime.js +1 -0
- package/dist/types/search +1 -0
- package/dist/types/search.d.ts +64 -0
- package/dist/types/search.js +0 -0
- package/dist/types/virtual.d.ts +19 -0
- package/dist/types.d.mts +11 -0
- package/dist/web-types.json +466 -0
- package/package.json +135 -0
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
import { contentProviderResultMarker } from "../public/provider";
|
|
2
|
+
import { buildContentGraph } from "../core/content/graph";
|
|
3
|
+
import { executeQueryPlan } from "../core/query/execute";
|
|
4
|
+
import { lowerQueryPlan } from "../core/query/lower";
|
|
5
|
+
import { findUnsupportedQueryOperator, SUPPORTED_QUERY_OPERATORS } from "../core/query/operators";
|
|
6
|
+
import { normalizeRouteMounts, projectContentPathToLocale } from "../features/localization/path";
|
|
7
|
+
import { createRouteMeta, localizePageResult } from "../features/localization/results";
|
|
8
|
+
import { createContentProviderError } from "../public/provider-errors";
|
|
9
|
+
import { collectContentCacheHint } from "../runtime/server/cache-hints";
|
|
10
|
+
const trimSlashes = (value) => value.replace(/^\/+|\/+$/g, "");
|
|
11
|
+
const unwrapResponseResult = (response) => {
|
|
12
|
+
if (response && typeof response === "object" && response[contentProviderResultMarker] === true) {
|
|
13
|
+
return unwrapResponseResult(response.data);
|
|
14
|
+
}
|
|
15
|
+
if (response && typeof response === "object" && "result" in response) {
|
|
16
|
+
return response.result;
|
|
17
|
+
}
|
|
18
|
+
return response;
|
|
19
|
+
};
|
|
20
|
+
const normalizeQueryResult = (value) => {
|
|
21
|
+
if (Array.isArray(value)) return value;
|
|
22
|
+
return value && typeof value === "object" ? [value] : [];
|
|
23
|
+
};
|
|
24
|
+
const routeMountsFor = (fixture, collection) => {
|
|
25
|
+
const config = fixture.collections[collection];
|
|
26
|
+
const collectionI18n = config?.i18n && typeof config.i18n === "object" ? config.i18n : void 0;
|
|
27
|
+
return normalizeRouteMounts(
|
|
28
|
+
config?.route,
|
|
29
|
+
collectionI18n?.locales || fixture.locales,
|
|
30
|
+
collectionI18n?.defaultLocale || fixture.defaultLocale
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
const localizePath = (fixture, collection, path, locale) => {
|
|
34
|
+
const config = fixture.collections[collection];
|
|
35
|
+
const collectionI18n = config?.i18n && typeof config.i18n === "object" ? config.i18n : void 0;
|
|
36
|
+
return projectContentPathToLocale(
|
|
37
|
+
path,
|
|
38
|
+
locale,
|
|
39
|
+
collectionI18n?.defaultLocale || fixture.defaultLocale,
|
|
40
|
+
routeMountsFor(fixture, collection)
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
const navFieldsFromDoc = (doc, fields = []) => Object.fromEntries(fields.filter((field) => field in doc).map((field) => [field, doc[field]]));
|
|
44
|
+
const navIdentityFromDoc = (doc) => ({
|
|
45
|
+
ref: doc.ref,
|
|
46
|
+
stableId: doc.ref || doc._canonicalKey || doc._id
|
|
47
|
+
});
|
|
48
|
+
const normalizeCachePath = (path) => {
|
|
49
|
+
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
50
|
+
return normalized.replace(/\/{2,}/g, "/");
|
|
51
|
+
};
|
|
52
|
+
const documentEntryTag = (doc) => `entry:${doc._collection}:${String(doc.ref || doc._canonicalKey || doc._id)}`;
|
|
53
|
+
const collectionTag = (collection) => `collection:${collection}`;
|
|
54
|
+
const routeTag = (path) => `route:${normalizeCachePath(path)}`;
|
|
55
|
+
const collectStringValues = (value) => {
|
|
56
|
+
if (typeof value === "string") {
|
|
57
|
+
return [value];
|
|
58
|
+
}
|
|
59
|
+
if (Array.isArray(value)) {
|
|
60
|
+
return value.flatMap(collectStringValues);
|
|
61
|
+
}
|
|
62
|
+
if (value && typeof value === "object") {
|
|
63
|
+
return Object.values(value).flatMap(collectStringValues);
|
|
64
|
+
}
|
|
65
|
+
return [];
|
|
66
|
+
};
|
|
67
|
+
const referenceEntryTags = (fixture, doc) => {
|
|
68
|
+
const knownRefs = new Map(fixture.documents.filter((document) => document !== doc).flatMap((document) => {
|
|
69
|
+
const ref = typeof document.ref === "string" ? document.ref : void 0;
|
|
70
|
+
const [collection, ...id] = ref?.split(".") || [];
|
|
71
|
+
return ref && collection && id.length ? [[ref, `entry:${collection}:${id.join(".")}`]] : [];
|
|
72
|
+
}));
|
|
73
|
+
return Array.from(new Set(collectStringValues(doc).map((value) => knownRefs.get(value)).filter((tag) => typeof tag === "string")));
|
|
74
|
+
};
|
|
75
|
+
const createCacheHintForDocument = (fixture, doc, path) => {
|
|
76
|
+
const collection = doc._collection || "content";
|
|
77
|
+
return {
|
|
78
|
+
tags: Array.from(/* @__PURE__ */ new Set([
|
|
79
|
+
documentEntryTag(doc),
|
|
80
|
+
collectionTag(collection),
|
|
81
|
+
routeTag(path),
|
|
82
|
+
...referenceEntryTags(fixture, doc)
|
|
83
|
+
])),
|
|
84
|
+
paths: [normalizeCachePath(path)],
|
|
85
|
+
lastModified: fixture.documents.map((document) => document.updatedAt || document.date).filter((value) => typeof value === "string").map((value) => new Date(value)).filter((date) => Number.isFinite(date.getTime())).sort((left, right) => right.getTime() - left.getTime())[0]
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
const createProviderFixtureCacheState = () => ({
|
|
89
|
+
events: [],
|
|
90
|
+
dependenciesByPath: /* @__PURE__ */ new Map(),
|
|
91
|
+
pathsByTag: /* @__PURE__ */ new Map(),
|
|
92
|
+
renderedPaths: /* @__PURE__ */ new Set()
|
|
93
|
+
});
|
|
94
|
+
const recordRouteDependencies = (cache, path, tags) => {
|
|
95
|
+
const normalizedPath = normalizeCachePath(path);
|
|
96
|
+
const normalizedTags = Array.from(new Set(tags.filter(Boolean)));
|
|
97
|
+
for (const oldTag of cache.dependenciesByPath.get(normalizedPath) || []) {
|
|
98
|
+
const oldPaths = cache.pathsByTag.get(oldTag);
|
|
99
|
+
oldPaths?.delete(normalizedPath);
|
|
100
|
+
if (oldPaths && oldPaths.size === 0) {
|
|
101
|
+
cache.pathsByTag.delete(oldTag);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
cache.events.push({
|
|
105
|
+
type: cache.renderedPaths.has(normalizedPath) ? "hit" : "miss",
|
|
106
|
+
key: normalizedPath,
|
|
107
|
+
tags: normalizedTags,
|
|
108
|
+
paths: [normalizedPath]
|
|
109
|
+
});
|
|
110
|
+
cache.renderedPaths.add(normalizedPath);
|
|
111
|
+
cache.dependenciesByPath.set(normalizedPath, new Set(normalizedTags));
|
|
112
|
+
for (const tag of normalizedTags) {
|
|
113
|
+
const paths = cache.pathsByTag.get(tag) || /* @__PURE__ */ new Set();
|
|
114
|
+
paths.add(normalizedPath);
|
|
115
|
+
cache.pathsByTag.set(tag, paths);
|
|
116
|
+
}
|
|
117
|
+
cache.events.push({ type: "set", key: normalizedPath, tags: normalizedTags, paths: [normalizedPath] });
|
|
118
|
+
};
|
|
119
|
+
const invalidateFixtureCache = (cache, input) => {
|
|
120
|
+
const paths = new Set((input.paths || []).map(normalizeCachePath));
|
|
121
|
+
for (const tag of input.tags || []) {
|
|
122
|
+
for (const path of cache.pathsByTag.get(tag) || []) {
|
|
123
|
+
paths.add(path);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
for (const path of paths) {
|
|
127
|
+
const tags = Array.from(cache.dependenciesByPath.get(path) || []);
|
|
128
|
+
cache.renderedPaths.delete(path);
|
|
129
|
+
cache.dependenciesByPath.delete(path);
|
|
130
|
+
for (const tag of tags) {
|
|
131
|
+
const tagPaths = cache.pathsByTag.get(tag);
|
|
132
|
+
tagPaths?.delete(path);
|
|
133
|
+
if (tagPaths && tagPaths.size === 0) {
|
|
134
|
+
cache.pathsByTag.delete(tag);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
cache.events.push({ type: "purge", key: path, tags, paths: [path] });
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
export const createProviderFixtureDocument = (input) => {
|
|
141
|
+
const collection = String(input._collection || "docs");
|
|
142
|
+
const locale = String(input._locale || "en");
|
|
143
|
+
const path = String(input._path || "/");
|
|
144
|
+
const canonicalKey = String(input._canonicalKey || `${collection}:${trimSlashes(path) || "index"}`);
|
|
145
|
+
const extension = input._extension || (input._type === "yaml" ? "yml" : "md");
|
|
146
|
+
return {
|
|
147
|
+
_id: String(input._id || `content:${locale}:${trimSlashes(path).replace(/\//g, ":") || "index"}.${extension}`),
|
|
148
|
+
_source: String(input._source || "content"),
|
|
149
|
+
_collection: collection,
|
|
150
|
+
_locale: locale,
|
|
151
|
+
_canonicalKey: canonicalKey,
|
|
152
|
+
_path: path,
|
|
153
|
+
_file: String(input._file || `/${locale}/${trimSlashes(path) || "index"}.${extension}`),
|
|
154
|
+
_type: input._type || "markdown",
|
|
155
|
+
_extension: extension,
|
|
156
|
+
title: String(input.title || canonicalKey),
|
|
157
|
+
body: {
|
|
158
|
+
type: "root",
|
|
159
|
+
children: []
|
|
160
|
+
},
|
|
161
|
+
...input
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
export const createProviderFixture = (input) => {
|
|
165
|
+
const defaultLocale = input.defaultLocale || "en";
|
|
166
|
+
const locales = Array.from(/* @__PURE__ */ new Set([defaultLocale, ...input.locales || []]));
|
|
167
|
+
const documents = input.documents.map(createProviderFixtureDocument);
|
|
168
|
+
const graph = buildContentGraph(documents, { defaultLocale, locales });
|
|
169
|
+
const localeFallback = input.localeFallback || Object.fromEntries(
|
|
170
|
+
locales.filter((locale) => locale !== defaultLocale).map((locale) => [locale, [defaultLocale]])
|
|
171
|
+
);
|
|
172
|
+
return {
|
|
173
|
+
name: input.name || "provider-fixture",
|
|
174
|
+
providerName: input.providerName || "fixture",
|
|
175
|
+
defaultLocale,
|
|
176
|
+
locales,
|
|
177
|
+
localeFallback,
|
|
178
|
+
collections: input.collections,
|
|
179
|
+
documents,
|
|
180
|
+
graph,
|
|
181
|
+
runtime: {
|
|
182
|
+
defaultLocale,
|
|
183
|
+
locales,
|
|
184
|
+
localeFallback,
|
|
185
|
+
collections: input.collections
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
export const createProviderFixtureEvent = (options = {}) => {
|
|
190
|
+
const query = options.query;
|
|
191
|
+
const queryString = query ? `?${new URLSearchParams(Object.entries(query).map(([key, value]) => [key, String(value)])).toString()}` : "";
|
|
192
|
+
return {
|
|
193
|
+
path: `/${queryString}`,
|
|
194
|
+
context: {
|
|
195
|
+
...options.fixture ? {
|
|
196
|
+
contentRuntime: {
|
|
197
|
+
...options.fixture.runtime,
|
|
198
|
+
provider: options.provider?.name || options.fixture.providerName
|
|
199
|
+
},
|
|
200
|
+
contentProvider: options.provider
|
|
201
|
+
} : {},
|
|
202
|
+
...options.params ? { params: options.params } : {},
|
|
203
|
+
...options.context
|
|
204
|
+
},
|
|
205
|
+
node: {
|
|
206
|
+
req: {
|
|
207
|
+
url: `/${queryString}`
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
export const createFixtureContentProvider = (fixture, name = fixture.providerName) => {
|
|
213
|
+
const cache = createProviderFixtureCacheState();
|
|
214
|
+
const assertCollection = (collection) => {
|
|
215
|
+
if (collection && !fixture.collections[collection]) {
|
|
216
|
+
throw createContentProviderError("unknown_collection", `Unknown collection: ${collection}`, { collection });
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const query = async (event, params) => {
|
|
220
|
+
assertCollection(params.collection);
|
|
221
|
+
const unsupported = findUnsupportedQueryOperator(params.where);
|
|
222
|
+
if (unsupported) {
|
|
223
|
+
throw createContentProviderError("unsupported_query_operator", `Unsupported query operator: ${unsupported}`, {
|
|
224
|
+
operator: unsupported
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
collectContentCacheHint(event, {
|
|
228
|
+
tags: params.collection ? [collectionTag(params.collection)] : []
|
|
229
|
+
});
|
|
230
|
+
return executeQueryPlan(
|
|
231
|
+
fixture.graph,
|
|
232
|
+
lowerQueryPlan(params),
|
|
233
|
+
fixture.runtime
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
const docsForNavigation = async (event, params) => {
|
|
237
|
+
const response = await query(event, params);
|
|
238
|
+
return normalizeQueryResult(unwrapResponseResult(response)).filter((doc) => !doc._draft && !doc._partial && !doc._navigation && doc.navigation !== false && doc._path);
|
|
239
|
+
};
|
|
240
|
+
const provider = {
|
|
241
|
+
name,
|
|
242
|
+
capabilities: {
|
|
243
|
+
routeBackedCollections: true,
|
|
244
|
+
dataCollections: true,
|
|
245
|
+
localizedRoutes: true,
|
|
246
|
+
translatedSlugs: true,
|
|
247
|
+
navigation: true,
|
|
248
|
+
surroundings: true,
|
|
249
|
+
searchSections: true,
|
|
250
|
+
sitemap: true,
|
|
251
|
+
query: {
|
|
252
|
+
operators: [...SUPPORTED_QUERY_OPERATORS],
|
|
253
|
+
limit: true,
|
|
254
|
+
skip: true,
|
|
255
|
+
count: true
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
query,
|
|
259
|
+
navigationQuery: async (event, params) => {
|
|
260
|
+
const docs = await docsForNavigation(event, params);
|
|
261
|
+
collectContentCacheHint(event, {
|
|
262
|
+
tags: [
|
|
263
|
+
...params.collection ? [collectionTag(params.collection)] : [],
|
|
264
|
+
...params.resolveLocale?.locale ? [`nav:${params.collection || "all"}:${params.resolveLocale.locale}`] : []
|
|
265
|
+
]
|
|
266
|
+
});
|
|
267
|
+
const queryLocale = params.resolveLocale?.locale;
|
|
268
|
+
return docs.map((doc) => ({
|
|
269
|
+
title: doc.title,
|
|
270
|
+
...navIdentityFromDoc(doc),
|
|
271
|
+
_path: doc._path,
|
|
272
|
+
path: localizePath(fixture, doc._collection || params.collection || "", doc._path || "/", queryLocale || doc._requestedLocale || doc._locale),
|
|
273
|
+
_locale: doc._locale
|
|
274
|
+
}));
|
|
275
|
+
},
|
|
276
|
+
navigation: async (event, collection, options = {}) => {
|
|
277
|
+
assertCollection(collection);
|
|
278
|
+
const fields = Array.isArray(options) ? options : options.fields || [];
|
|
279
|
+
const locale = typeof options === "object" && !Array.isArray(options) ? options.locale : void 0;
|
|
280
|
+
collectContentCacheHint(event, {
|
|
281
|
+
tags: [`nav:${collection}:${locale || fixture.defaultLocale}`, collectionTag(collection)]
|
|
282
|
+
});
|
|
283
|
+
const docs = await docsForNavigation(event, {
|
|
284
|
+
collection,
|
|
285
|
+
resolveLocale: locale ? {
|
|
286
|
+
locale,
|
|
287
|
+
fallback: fixture.localeFallback[locale] || [fixture.defaultLocale]
|
|
288
|
+
} : void 0,
|
|
289
|
+
sort: [{ _path: 1 }]
|
|
290
|
+
});
|
|
291
|
+
return docs.map((doc) => ({
|
|
292
|
+
title: doc.title,
|
|
293
|
+
...navFieldsFromDoc(doc, fields),
|
|
294
|
+
...navIdentityFromDoc(doc),
|
|
295
|
+
_path: doc._path,
|
|
296
|
+
path: localizePath(fixture, collection, doc._path || "/", locale || doc._locale),
|
|
297
|
+
_locale: doc._locale
|
|
298
|
+
}));
|
|
299
|
+
},
|
|
300
|
+
surroundings: async (event, collection, path, options = {}) => {
|
|
301
|
+
assertCollection(collection);
|
|
302
|
+
const locale = options.locale;
|
|
303
|
+
const docs = await docsForNavigation(event, {
|
|
304
|
+
collection,
|
|
305
|
+
resolveLocale: locale ? {
|
|
306
|
+
locale,
|
|
307
|
+
fallback: fixture.localeFallback[locale] || [fixture.defaultLocale]
|
|
308
|
+
} : void 0,
|
|
309
|
+
sort: [{ _path: 1 }]
|
|
310
|
+
});
|
|
311
|
+
const index = docs.findIndex((doc) => doc._path === path || localizePath(fixture, collection, doc._path || "/", locale || doc._locale) === path);
|
|
312
|
+
if (index === -1) return [null, null];
|
|
313
|
+
return [docs[index - 1] || null, docs[index + 1] || null].map((doc) => doc ? {
|
|
314
|
+
title: doc.title,
|
|
315
|
+
_path: doc._path,
|
|
316
|
+
path: localizePath(fixture, collection, doc._path || "/", locale || doc._locale)
|
|
317
|
+
} : null);
|
|
318
|
+
},
|
|
319
|
+
searchSections: async (event, collection, options = {}) => {
|
|
320
|
+
assertCollection(collection);
|
|
321
|
+
collectContentCacheHint(event, {
|
|
322
|
+
tags: [`search:${options.locale || fixture.defaultLocale}`, collectionTag(collection)]
|
|
323
|
+
});
|
|
324
|
+
const docs = await docsForNavigation(event, {
|
|
325
|
+
collection,
|
|
326
|
+
where: options.filterQuery,
|
|
327
|
+
resolveLocale: options.locale ? {
|
|
328
|
+
locale: options.locale,
|
|
329
|
+
fallback: fixture.localeFallback[options.locale] || [fixture.defaultLocale]
|
|
330
|
+
} : void 0
|
|
331
|
+
});
|
|
332
|
+
const extraFields = options.extraFields || [];
|
|
333
|
+
return docs.map((doc) => ({
|
|
334
|
+
...Object.fromEntries(extraFields.filter((field) => field in doc).map((field) => [field, doc[field]])),
|
|
335
|
+
id: localizePath(fixture, collection, doc._path || "/", options.locale || doc._locale),
|
|
336
|
+
title: doc.title || "",
|
|
337
|
+
titles: [doc.title || ""],
|
|
338
|
+
content: String(doc.description || doc.title || "")
|
|
339
|
+
}));
|
|
340
|
+
},
|
|
341
|
+
search: async (_event, request) => {
|
|
342
|
+
const term = request.term.toLocaleLowerCase();
|
|
343
|
+
return fixture.documents.filter((doc) => !request.collections?.length || request.collections.includes(doc._collection || "")).filter((doc) => !request.locale || doc._locale === request.locale).filter((doc) => String(doc.title || "").toLocaleLowerCase().includes(term)).map((doc) => ({
|
|
344
|
+
score: 1,
|
|
345
|
+
title: doc.title || "",
|
|
346
|
+
excerpt: String(doc.description || ""),
|
|
347
|
+
path: localizePath(fixture, doc._collection || "", doc._path || "/", doc._locale),
|
|
348
|
+
locale: doc._locale
|
|
349
|
+
}));
|
|
350
|
+
},
|
|
351
|
+
siteData: async (event, request) => {
|
|
352
|
+
collectContentCacheHint(event, {
|
|
353
|
+
tags: [`site-data:${request.key}:${request.locale || fixture.defaultLocale}`]
|
|
354
|
+
});
|
|
355
|
+
return {
|
|
356
|
+
key: request.key,
|
|
357
|
+
locale: request.locale,
|
|
358
|
+
data: null,
|
|
359
|
+
updatedAt: 0
|
|
360
|
+
};
|
|
361
|
+
},
|
|
362
|
+
page: async (event, collection, routeOrPath = "/", options = {}) => {
|
|
363
|
+
assertCollection(collection);
|
|
364
|
+
if (fixture.collections[collection]?.type === "data") {
|
|
365
|
+
throw createContentProviderError("data_collection_route_access", `${collection} is a data collection.`, { collection });
|
|
366
|
+
}
|
|
367
|
+
const segments = routeOrPath.split("/").filter(Boolean);
|
|
368
|
+
const routeLocale = segments[0] && fixture.locales.includes(segments[0]) ? segments[0] : void 0;
|
|
369
|
+
const providerRoute = routeLocale ? `/${segments.slice(1).join("/")}` : routeOrPath;
|
|
370
|
+
const requestedLocale = options.locale || routeLocale;
|
|
371
|
+
const response = await query(event, {
|
|
372
|
+
collection,
|
|
373
|
+
first: true,
|
|
374
|
+
resolveVariant: {
|
|
375
|
+
route: providerRoute,
|
|
376
|
+
locale: requestedLocale,
|
|
377
|
+
fallback: options.fallback === false ? [] : fixture.localeFallback[requestedLocale || ""] || [fixture.defaultLocale],
|
|
378
|
+
exact: options.exact
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
const doc = unwrapResponseResult(response);
|
|
382
|
+
if (!doc) return null;
|
|
383
|
+
const page = localizePageResult(
|
|
384
|
+
doc,
|
|
385
|
+
requestedLocale || doc._resolvedLocale || doc._locale,
|
|
386
|
+
fixture.defaultLocale,
|
|
387
|
+
fixture.locales,
|
|
388
|
+
routeMountsFor(fixture, collection)
|
|
389
|
+
);
|
|
390
|
+
const hint = createCacheHintForDocument(fixture, doc, page.path);
|
|
391
|
+
collectContentCacheHint(event, hint);
|
|
392
|
+
recordRouteDependencies(cache, page.path, hint.tags || []);
|
|
393
|
+
return page;
|
|
394
|
+
},
|
|
395
|
+
routeMeta: async (event, collection, routeOrPath = "/", options = {}) => {
|
|
396
|
+
const page = await provider.page(event, collection, routeOrPath, options);
|
|
397
|
+
return page ? createRouteMeta(page, options.locale || page.locale, fixture.defaultLocale, routeMountsFor(fixture, collection)) : null;
|
|
398
|
+
},
|
|
399
|
+
sitemapEntries: async (event, options = {}) => {
|
|
400
|
+
collectContentCacheHint(event, { tags: ["sitemap"] });
|
|
401
|
+
const explicitInclude = Boolean(options.include?.length);
|
|
402
|
+
const include = explicitInclude ? options.include : Object.keys(fixture.collections);
|
|
403
|
+
const entries = [];
|
|
404
|
+
for (const collection of include) {
|
|
405
|
+
assertCollection(collection);
|
|
406
|
+
if (fixture.collections[collection]?.type === "data" || fixture.collections[collection]?.sitemap === false) {
|
|
407
|
+
if (explicitInclude) {
|
|
408
|
+
throw createContentProviderError("data_collection_sitemap_access", `${collection} cannot be listed in the sitemap.`, { collection });
|
|
409
|
+
}
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
for (const doc of fixture.documents.filter((doc2) => doc2._collection === collection && !doc2._draft && !doc2._partial && !doc2._navigation)) {
|
|
413
|
+
entries.push({
|
|
414
|
+
loc: localizePath(fixture, collection, doc._path || "/", doc._locale)
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return entries;
|
|
419
|
+
},
|
|
420
|
+
invalidate: async (_event, input) => {
|
|
421
|
+
invalidateFixtureCache(cache, input);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
return Object.assign(provider, { cache });
|
|
425
|
+
};
|
|
426
|
+
export const createSaasProviderFixture = () => createProviderFixture({
|
|
427
|
+
name: "saas-i18n",
|
|
428
|
+
providerName: "fixture",
|
|
429
|
+
defaultLocale: "en",
|
|
430
|
+
locales: ["en", "de"],
|
|
431
|
+
localeFallback: { de: ["en"] },
|
|
432
|
+
collections: {
|
|
433
|
+
docs: {
|
|
434
|
+
type: "page",
|
|
435
|
+
i18n: { defaultLocale: "en", locales: ["en", "de"] },
|
|
436
|
+
route: { en: "/docs", de: "/dokumentation" }
|
|
437
|
+
},
|
|
438
|
+
posts: {
|
|
439
|
+
type: "page",
|
|
440
|
+
i18n: { defaultLocale: "en", locales: ["en", "de"] },
|
|
441
|
+
route: { en: "/blog", de: "/magazin" }
|
|
442
|
+
},
|
|
443
|
+
authors: {
|
|
444
|
+
type: "page",
|
|
445
|
+
i18n: { defaultLocale: "en", locales: ["en", "de"] },
|
|
446
|
+
route: { en: "/authors", de: "/autoren" }
|
|
447
|
+
},
|
|
448
|
+
versions: {
|
|
449
|
+
type: "data",
|
|
450
|
+
i18n: { defaultLocale: "en", locales: ["en", "de"] },
|
|
451
|
+
sitemap: false
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
documents: [
|
|
455
|
+
{
|
|
456
|
+
_collection: "docs",
|
|
457
|
+
_locale: "en",
|
|
458
|
+
_canonicalKey: "docs:getting-started",
|
|
459
|
+
_path: "/docs/getting-started",
|
|
460
|
+
ref: "docs.getting-started",
|
|
461
|
+
title: "Getting Started",
|
|
462
|
+
description: "Start here",
|
|
463
|
+
order: 1
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
_collection: "docs",
|
|
467
|
+
_locale: "de",
|
|
468
|
+
_canonicalKey: "docs:getting-started",
|
|
469
|
+
_path: "/dokumentation/einstieg",
|
|
470
|
+
ref: "docs.getting-started",
|
|
471
|
+
title: "Einstieg",
|
|
472
|
+
description: "Hier starten",
|
|
473
|
+
order: 1
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
_collection: "docs",
|
|
477
|
+
_locale: "de",
|
|
478
|
+
_canonicalKey: "docs:getting-started-installation",
|
|
479
|
+
_path: "/dokumentation/einstieg/installation",
|
|
480
|
+
ref: "docs.getting-started.installation",
|
|
481
|
+
title: "Installation",
|
|
482
|
+
description: "Installieren",
|
|
483
|
+
order: 2
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
_collection: "docs",
|
|
487
|
+
_locale: "de",
|
|
488
|
+
_canonicalKey: "docs:getting-started-everyday",
|
|
489
|
+
_path: "/dokumentation/einstieg/alltag",
|
|
490
|
+
ref: "docs.getting-started.everyday",
|
|
491
|
+
title: "Alltag",
|
|
492
|
+
description: "Arbeiten",
|
|
493
|
+
order: 3
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
_collection: "docs",
|
|
497
|
+
_locale: "en",
|
|
498
|
+
_canonicalKey: "docs:markdown-syntax",
|
|
499
|
+
_path: "/docs/essentials/markdown-syntax",
|
|
500
|
+
ref: "docs.markdown-syntax",
|
|
501
|
+
title: "Markdown Syntax",
|
|
502
|
+
description: "Writing docs",
|
|
503
|
+
order: 4
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
_collection: "docs",
|
|
507
|
+
_locale: "en",
|
|
508
|
+
_canonicalKey: "docs:draft-roadmap",
|
|
509
|
+
_path: "/docs/draft-roadmap",
|
|
510
|
+
ref: "docs.draft-roadmap",
|
|
511
|
+
title: "Draft Roadmap",
|
|
512
|
+
description: "Unpublished draft",
|
|
513
|
+
_draft: true,
|
|
514
|
+
order: 5
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
_collection: "docs",
|
|
518
|
+
_locale: "de",
|
|
519
|
+
_canonicalKey: "docs:markdown-syntax",
|
|
520
|
+
_path: "/dokumentation/grundlagen/markdown-syntax",
|
|
521
|
+
ref: "docs.markdown-syntax",
|
|
522
|
+
title: "Markdown Syntax DE",
|
|
523
|
+
description: "Dokumentation schreiben",
|
|
524
|
+
order: 4
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
_collection: "posts",
|
|
528
|
+
_locale: "en",
|
|
529
|
+
_canonicalKey: "posts:onboarding",
|
|
530
|
+
_path: "/blog/multilingual-onboarding",
|
|
531
|
+
ref: "posts.onboarding",
|
|
532
|
+
title: "Multilingual Onboarding",
|
|
533
|
+
description: "Launch notes",
|
|
534
|
+
date: "2026-01-02",
|
|
535
|
+
authors: ["authors.emily"]
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
_collection: "posts",
|
|
539
|
+
_locale: "de",
|
|
540
|
+
_canonicalKey: "posts:onboarding",
|
|
541
|
+
_path: "/magazin/mehrsprachiges-onboarding",
|
|
542
|
+
ref: "posts.onboarding",
|
|
543
|
+
title: "Mehrsprachiges Onboarding",
|
|
544
|
+
description: "Startnotizen",
|
|
545
|
+
date: "2026-01-03",
|
|
546
|
+
authors: ["authors.emily"]
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
_collection: "authors",
|
|
550
|
+
_locale: "en",
|
|
551
|
+
_canonicalKey: "authors:emily",
|
|
552
|
+
_path: "/authors/emily",
|
|
553
|
+
ref: "authors.emily",
|
|
554
|
+
title: "Emily",
|
|
555
|
+
name: "Emily",
|
|
556
|
+
description: "Author"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
_collection: "authors",
|
|
560
|
+
_locale: "de",
|
|
561
|
+
_canonicalKey: "authors:emily",
|
|
562
|
+
_path: "/autoren/emily",
|
|
563
|
+
ref: "authors.emily",
|
|
564
|
+
title: "Emily DE",
|
|
565
|
+
name: "Emily",
|
|
566
|
+
description: "Autorin"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
_collection: "versions",
|
|
570
|
+
_locale: "en",
|
|
571
|
+
_canonicalKey: "versions:launch-readiness",
|
|
572
|
+
_path: "/changelog/launch-readiness",
|
|
573
|
+
ref: "versions.launch-readiness",
|
|
574
|
+
title: "Launch readiness",
|
|
575
|
+
date: "2026-01-01"
|
|
576
|
+
}
|
|
577
|
+
]
|
|
578
|
+
});
|
|
579
|
+
export const createAuthorDependencyProviderFixture = () => createProviderFixture({
|
|
580
|
+
name: "author-dependencies",
|
|
581
|
+
providerName: "fixture",
|
|
582
|
+
defaultLocale: "en",
|
|
583
|
+
locales: ["en"],
|
|
584
|
+
collections: {
|
|
585
|
+
blog: { type: "page", route: "/blog" },
|
|
586
|
+
authors: { type: "page", route: "/authors" }
|
|
587
|
+
},
|
|
588
|
+
documents: [
|
|
589
|
+
{ _collection: "authors", _path: "/authors/alice", ref: "authors.alice", title: "Alice", name: "Alice" },
|
|
590
|
+
{ _collection: "authors", _path: "/authors/bob", ref: "authors.bob", title: "Bob", name: "Bob" },
|
|
591
|
+
...Array.from({ length: 5 }, (_, index) => ({
|
|
592
|
+
_collection: "blog",
|
|
593
|
+
_path: `/blog/post-${index + 1}`,
|
|
594
|
+
ref: `blog.post-${index + 1}`,
|
|
595
|
+
title: `Post ${index + 1}`,
|
|
596
|
+
authors: ["authors.alice"]
|
|
597
|
+
})),
|
|
598
|
+
{
|
|
599
|
+
_collection: "blog",
|
|
600
|
+
_path: "/blog/post-6",
|
|
601
|
+
ref: "blog.post-6",
|
|
602
|
+
title: "Post 6",
|
|
603
|
+
authors: ["authors.bob"]
|
|
604
|
+
}
|
|
605
|
+
]
|
|
606
|
+
});
|
package/dist/types/api
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api.js'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response envelope returned when a query resolves to a list.
|
|
3
|
+
*/
|
|
4
|
+
export interface ContentQueryFindResponse<T> {
|
|
5
|
+
/**
|
|
6
|
+
* Matched documents after filtering, sorting, and projection.
|
|
7
|
+
*/
|
|
8
|
+
result: Array<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Number of records skipped before the returned page.
|
|
11
|
+
*/
|
|
12
|
+
skip: number;
|
|
13
|
+
/**
|
|
14
|
+
* Requested page size.
|
|
15
|
+
*/
|
|
16
|
+
limit: number;
|
|
17
|
+
/**
|
|
18
|
+
* Total match count before paging is applied.
|
|
19
|
+
*/
|
|
20
|
+
total: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Response envelope returned when a query resolves to one document.
|
|
24
|
+
*/
|
|
25
|
+
export interface ContentQueryFindOneResponse<T> {
|
|
26
|
+
/**
|
|
27
|
+
* First matched document, or `undefined` when nothing matched.
|
|
28
|
+
*/
|
|
29
|
+
result: T | undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Response envelope returned when a query resolves to a count.
|
|
33
|
+
*/
|
|
34
|
+
export interface ContentQueryCountResponse {
|
|
35
|
+
/**
|
|
36
|
+
* Number of matched documents.
|
|
37
|
+
*/
|
|
38
|
+
result: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Low-level transport response for the content query engine.
|
|
42
|
+
*
|
|
43
|
+
* Most application code should use the builder helpers (`.all()`, `.first()`,
|
|
44
|
+
* `.count()`) instead of reading this union directly.
|
|
45
|
+
*/
|
|
46
|
+
export type ContentQueryResponse<T> = ContentQueryFindResponse<T> | ContentQueryFindOneResponse<T> | ContentQueryCountResponse;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './config.js'
|