@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,9 @@
|
|
|
1
|
+
import { buildNavigation } from "../../features/navigation/build";
|
|
2
|
+
import { getContentRuntimeConfig } from "./runtime-config.js";
|
|
3
|
+
export function createNav(contents, configs) {
|
|
4
|
+
const { navigation } = getContentRuntimeConfig().public.content;
|
|
5
|
+
if (navigation === false) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
return buildNavigation(contents, configs, navigation.fields);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pagefind.js'
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export async function writePagefindIndex(records, outputPath) {
|
|
2
|
+
const { createIndex } = await import("pagefind");
|
|
3
|
+
const { index } = await createIndex();
|
|
4
|
+
if (!index) {
|
|
5
|
+
throw new Error("Failed to initialize Pagefind index");
|
|
6
|
+
}
|
|
7
|
+
for (const record of records) {
|
|
8
|
+
const url = record.anchor ? `${record.path}#${record.anchor}` : record.path;
|
|
9
|
+
const content = [record.title, ...record.headings, record.content].filter(Boolean).join("\n");
|
|
10
|
+
const response2 = await index.addCustomRecord({
|
|
11
|
+
url,
|
|
12
|
+
content,
|
|
13
|
+
language: record.locale || "en",
|
|
14
|
+
meta: {
|
|
15
|
+
title: record.title,
|
|
16
|
+
excerpt: record.excerpt,
|
|
17
|
+
locale: record.locale || "",
|
|
18
|
+
anchor: record.anchor || "",
|
|
19
|
+
path: record.path
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
if (response2.errors.length) {
|
|
23
|
+
throw new Error(`Failed to add Pagefind record for ${url}: ${response2.errors.join(", ")}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const response = await index.writeFiles({ outputPath });
|
|
27
|
+
if (response.errors.length) {
|
|
28
|
+
throw new Error(`Failed to write Pagefind index: ${response.errors.join(", ")}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cache.js'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineNitroPlugin } from "nitropack/runtime";
|
|
2
|
+
import { clearContentCacheHint, getContentCacheHint } from "../cache-hints.js";
|
|
3
|
+
import { getContentCacheAdapter } from "../cache-adapter.js";
|
|
4
|
+
export default defineNitroPlugin((nitro) => {
|
|
5
|
+
nitro.hooks.hook("render:response", async (_response, { event }) => {
|
|
6
|
+
const hint = getContentCacheHint(event);
|
|
7
|
+
if (!hint) {
|
|
8
|
+
clearContentCacheHint(event);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const adapter = await getContentCacheAdapter();
|
|
12
|
+
if (adapter) {
|
|
13
|
+
await adapter.apply(event, hint);
|
|
14
|
+
}
|
|
15
|
+
clearContentCacheHint(event);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sitemap.js'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineNitroPlugin } from "nitropack/runtime";
|
|
2
|
+
import { getContentRuntimeConfig } from "../runtime-config.js";
|
|
3
|
+
const LEGACY_NUXT_CONTENT_V2_SOURCE = "@nuxt/content@v2:urls";
|
|
4
|
+
const GINKO_SOURCE = "@lupinum/ginko-content:urls";
|
|
5
|
+
export default defineNitroPlugin((nitro) => {
|
|
6
|
+
nitro.hooks.hook("sitemap:sources", (ctx) => {
|
|
7
|
+
const runtimeConfig = getContentRuntimeConfig();
|
|
8
|
+
const sitemap = runtimeConfig.public.content?.sitemap;
|
|
9
|
+
const apiBaseURL = runtimeConfig.public.content?.api?.baseURL;
|
|
10
|
+
if (!sitemap || !apiBaseURL) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const fetch = `${apiBaseURL}${sitemap.path || "/sitemap"}`;
|
|
14
|
+
ctx.sources = ctx.sources.filter((source) => {
|
|
15
|
+
return source.context?.name !== LEGACY_NUXT_CONTENT_V2_SOURCE && source.context?.name !== GINKO_SOURCE;
|
|
16
|
+
});
|
|
17
|
+
ctx.sources.push({
|
|
18
|
+
context: {
|
|
19
|
+
name: GINKO_SOURCE
|
|
20
|
+
},
|
|
21
|
+
fetch,
|
|
22
|
+
sourceType: "app"
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './preview.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getPreview, isPreview } from '../../integrations/nitro/preview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getPreview, isPreview } from "../../integrations/nitro/preview";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './provider-query.js'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
import type { ContentCollectionMap } from '@lupinum/ginko-content';
|
|
3
|
+
import type { ParsedContent } from '../../types/content';
|
|
4
|
+
import type { ContentQueryResponse } from '../../types/api';
|
|
5
|
+
import type { CollectionQueryBuilder, ContentQueryBuilderParams, ContentQueryRequest, ResolveContentReferenceOptions } from '../../types/query';
|
|
6
|
+
export declare const normalizeProviderQueryResult: <T>(response: ContentQueryResponse<T> | T[] | T | number | undefined) => T[];
|
|
7
|
+
export declare const resolveProviderContentVariants: (event: H3Event, identity: string, options: ResolveContentReferenceOptions) => Promise<{
|
|
8
|
+
canonicalKey: any;
|
|
9
|
+
selected: any;
|
|
10
|
+
variants: (ParsedContent | import(".").ContentProviderResult<number | ParsedContent | ParsedContent[] | ContentQueryResponse<ParsedContent> | undefined>)[];
|
|
11
|
+
availableLocales: string[];
|
|
12
|
+
variantPaths: any;
|
|
13
|
+
requestedLocale: string | undefined;
|
|
14
|
+
resolvedLocale: any;
|
|
15
|
+
fallback: boolean;
|
|
16
|
+
} | null>;
|
|
17
|
+
export declare const createServerProviderQueryFetch: <T = ParsedContent>(event: H3Event) => (query: ContentQueryRequest) => Promise<import(".").MaybeContentProviderResult<number | T | ContentQueryResponse<T> | T[] | undefined>>;
|
|
18
|
+
export declare const createServerContentQuery: <T = ParsedContent>(event: H3Event, query?: string | ContentQueryBuilderParams, ...pathParts: string[]) => import("@lupinum/ginko-content").ContentQueryBuilder<T>;
|
|
19
|
+
export declare function serverQueryCollection<K extends keyof ContentCollectionMap & string>(event: H3Event, collection: K): CollectionQueryBuilder<ContentCollectionMap[K]>;
|
|
20
|
+
export declare function serverQueryCollection<T = ParsedContent>(event: H3Event, collection: string): CollectionQueryBuilder<T>;
|
|
21
|
+
export declare const resolveContentReference: <T = ParsedContent>(event: H3Event, reference: string, options?: ResolveContentReferenceOptions) => Promise<(T & {
|
|
22
|
+
_requestedLocale?: string;
|
|
23
|
+
_resolvedLocale?: string;
|
|
24
|
+
_fallback?: boolean;
|
|
25
|
+
_availableLocales?: string[];
|
|
26
|
+
_variantPaths?: Record<string, string>;
|
|
27
|
+
}) | null>;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { joinURL, withLeadingSlash } from "ufo";
|
|
2
|
+
import { createQuery, wrapQueryBuilder } from "../../core/query/builder";
|
|
3
|
+
import { normalizeContentQueryParams } from "../../core/query/params";
|
|
4
|
+
import { normalizeI18nConfig, resolveRuntimeCollectionI18nConfig } from "../../features/localization/config";
|
|
5
|
+
import { normalizeReferenceValue } from "../../core/references/resolve";
|
|
6
|
+
import { getContentRuntimeConfig } from "./runtime-config.js";
|
|
7
|
+
export const normalizeProviderQueryResult = (response) => {
|
|
8
|
+
if (Array.isArray(response)) {
|
|
9
|
+
return response;
|
|
10
|
+
}
|
|
11
|
+
if (response && typeof response === "object" && "result" in response) {
|
|
12
|
+
return Array.isArray(response.result) ? response.result : [];
|
|
13
|
+
}
|
|
14
|
+
return [];
|
|
15
|
+
};
|
|
16
|
+
const identityMatchesDocument = (document, identity) => {
|
|
17
|
+
const normalizedIdentity = normalizeReferenceValue(identity);
|
|
18
|
+
if (!normalizedIdentity) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return [document._canonicalKey, document._path, document.ref].filter((value) => typeof value === "string").some((value) => normalizeReferenceValue(value) === normalizedIdentity);
|
|
22
|
+
};
|
|
23
|
+
export const resolveProviderContentVariants = async (event, identity, options) => {
|
|
24
|
+
if (!options.collection) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const normalizedReference = normalizeReferenceValue(identity);
|
|
28
|
+
if (!normalizedReference) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const runtimeContent = getContentRuntimeConfig().content || {};
|
|
32
|
+
const collectionI18n = resolveRuntimeCollectionI18nConfig(options.collection, runtimeContent);
|
|
33
|
+
const fallbackLocales = Array.isArray(options.fallback) ? options.fallback : options.fallback && options.locale ? runtimeContent.localeFallback?.[options.locale] || [] : [];
|
|
34
|
+
const localesToQuery = Array.from(/* @__PURE__ */ new Set([
|
|
35
|
+
...options.locale ? [options.locale] : [],
|
|
36
|
+
...fallbackLocales,
|
|
37
|
+
...collectionI18n?.locales || []
|
|
38
|
+
]));
|
|
39
|
+
const { getContentProvider } = await import("./providers/index.js");
|
|
40
|
+
const provider = await getContentProvider(event);
|
|
41
|
+
const baseQuery = {
|
|
42
|
+
collection: options.collection,
|
|
43
|
+
only: ["_path", "_canonicalKey", "_locale", "ref", "title", "description", "body"]
|
|
44
|
+
};
|
|
45
|
+
const documents = localesToQuery.length ? (await Promise.all(
|
|
46
|
+
localesToQuery.map(
|
|
47
|
+
async (locale) => normalizeProviderQueryResult(
|
|
48
|
+
await provider.query(event, {
|
|
49
|
+
...baseQuery,
|
|
50
|
+
resolveLocale: { locale, exact: true }
|
|
51
|
+
})
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
)).flat() : normalizeProviderQueryResult(await provider.query(event, baseQuery));
|
|
55
|
+
const matched = documents.find((document) => identityMatchesDocument(document, normalizedReference));
|
|
56
|
+
const canonicalKey = matched?._canonicalKey;
|
|
57
|
+
if (!canonicalKey) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const variants = documents.filter((document) => document._canonicalKey === canonicalKey);
|
|
61
|
+
if (!variants.length) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const selectByLocale = (locale) => locale ? variants.find((document) => document._locale === locale) : void 0;
|
|
65
|
+
const selected = selectByLocale(options.locale) || (!options.exact ? fallbackLocales.map(selectByLocale).find(Boolean) : void 0) || (!options.exact ? selectByLocale(collectionI18n?.defaultLocale || runtimeContent.defaultLocale) : void 0) || (!options.exact ? variants[0] : void 0);
|
|
66
|
+
if (!selected) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const availableLocales = Array.from(new Set(variants.map((document) => document._locale).filter(Boolean)));
|
|
70
|
+
const variantPaths = Object.fromEntries(
|
|
71
|
+
variants.filter((document) => document._locale && document._path).map((document) => [document._locale, document._path])
|
|
72
|
+
);
|
|
73
|
+
return {
|
|
74
|
+
canonicalKey,
|
|
75
|
+
selected,
|
|
76
|
+
variants,
|
|
77
|
+
availableLocales,
|
|
78
|
+
variantPaths,
|
|
79
|
+
requestedLocale: options.locale,
|
|
80
|
+
resolvedLocale: selected._locale,
|
|
81
|
+
fallback: Boolean(options.locale && selected._locale && selected._locale !== options.locale)
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export const createServerProviderQueryFetch = (event) => {
|
|
85
|
+
return async (query) => {
|
|
86
|
+
const { getContentProvider } = await import("./providers/index.js");
|
|
87
|
+
return await (await getContentProvider(event)).query(event, query.params());
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
const getServerCollectionI18n = (collection) => {
|
|
91
|
+
const config = getContentRuntimeConfig().content;
|
|
92
|
+
return collection ? resolveRuntimeCollectionI18nConfig(collection, config) : normalizeI18nConfig(config);
|
|
93
|
+
};
|
|
94
|
+
export const createServerContentQuery = (event, query, ...pathParts) => {
|
|
95
|
+
const config = getContentRuntimeConfig().content;
|
|
96
|
+
const queryBuilder = createQuery(createServerProviderQueryFetch(event), {
|
|
97
|
+
initialParams: typeof query !== "string" ? query || {} : {}
|
|
98
|
+
});
|
|
99
|
+
let path;
|
|
100
|
+
if (typeof query === "string") {
|
|
101
|
+
path = withLeadingSlash(joinURL(query, ...pathParts));
|
|
102
|
+
}
|
|
103
|
+
return wrapQueryBuilder(queryBuilder, (params) => {
|
|
104
|
+
const collectionI18n = getServerCollectionI18n(params.collection);
|
|
105
|
+
return normalizeContentQueryParams(params, {
|
|
106
|
+
path,
|
|
107
|
+
collectionI18n,
|
|
108
|
+
defaultLocale: config.defaultLocale,
|
|
109
|
+
localeFallback: config.localeFallback,
|
|
110
|
+
activeLocale: collectionI18n?.defaultLocale,
|
|
111
|
+
includeDraftFilter: !import.meta.dev
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
export function serverQueryCollection(event, collection) {
|
|
116
|
+
return createServerContentQuery(event, { collection });
|
|
117
|
+
}
|
|
118
|
+
export const resolveContentReference = async (event, reference, options = {}) => {
|
|
119
|
+
const resolved = await resolveProviderContentVariants(event, reference, options);
|
|
120
|
+
if (!resolved) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
...resolved.selected,
|
|
125
|
+
_requestedLocale: resolved.requestedLocale,
|
|
126
|
+
_resolvedLocale: resolved.resolvedLocale,
|
|
127
|
+
_fallback: resolved.fallback,
|
|
128
|
+
_availableLocales: resolved.availableLocales,
|
|
129
|
+
_variantPaths: resolved.variantPaths
|
|
130
|
+
};
|
|
131
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './provider-result.js'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
import type { ContentProvider, ContentProviderResult, MaybeContentProviderResult } from '../../public/provider';
|
|
3
|
+
export declare const isContentProviderResult: <T = unknown>(value: unknown) => value is ContentProviderResult<T>;
|
|
4
|
+
export declare const unwrapContentProviderResult: <T>(event: H3Event, result: MaybeContentProviderResult<T>) => T;
|
|
5
|
+
/**
|
|
6
|
+
* External providers may return `{ data, cache }` from any provider method.
|
|
7
|
+
* Runtime consumers should continue receiving the historical raw data shape,
|
|
8
|
+
* while the request-local cache collector records the cache hint.
|
|
9
|
+
*/
|
|
10
|
+
export declare const wrapContentProviderCacheResults: (event: H3Event, provider: ContentProvider) => ContentProvider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { contentProviderResultMarker } from "../../public/provider";
|
|
2
|
+
import { collectContentCacheHint } from "./cache-hints.js";
|
|
3
|
+
const isObject = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4
|
+
export const isContentProviderResult = (value) => isObject(value) && value[contentProviderResultMarker] === true;
|
|
5
|
+
export const unwrapContentProviderResult = (event, result) => {
|
|
6
|
+
if (isContentProviderResult(result)) {
|
|
7
|
+
collectContentCacheHint(event, result.cache);
|
|
8
|
+
return result.data;
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
const wrapProviderMethod = (event, method) => {
|
|
13
|
+
return (async (...args) => unwrapContentProviderResult(event, await method(...args)));
|
|
14
|
+
};
|
|
15
|
+
export const wrapContentProviderCacheResults = (event, provider) => {
|
|
16
|
+
const wrapped = {
|
|
17
|
+
...provider,
|
|
18
|
+
query: wrapProviderMethod(event, provider.query)
|
|
19
|
+
};
|
|
20
|
+
if (provider.navigationQuery) wrapped.navigationQuery = wrapProviderMethod(event, provider.navigationQuery);
|
|
21
|
+
if (provider.navigation) wrapped.navigation = wrapProviderMethod(event, provider.navigation);
|
|
22
|
+
if (provider.surroundings) wrapped.surroundings = wrapProviderMethod(event, provider.surroundings);
|
|
23
|
+
if (provider.searchSections) wrapped.searchSections = wrapProviderMethod(event, provider.searchSections);
|
|
24
|
+
if (provider.search) wrapped.search = wrapProviderMethod(event, provider.search);
|
|
25
|
+
if (provider.siteData) wrapped.siteData = wrapProviderMethod(event, provider.siteData);
|
|
26
|
+
if (provider.page) wrapped.page = wrapProviderMethod(event, provider.page);
|
|
27
|
+
if (provider.routeMeta) wrapped.routeMeta = wrapProviderMethod(event, provider.routeMeta);
|
|
28
|
+
if (provider.sitemapEntries) wrapped.sitemapEntries = wrapProviderMethod(event, provider.sitemapEntries);
|
|
29
|
+
return wrapped;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './filesystem.js'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { containsStandaloneRegexOptions, SUPPORTED_QUERY_OPERATORS } from "../../../core/query/operators";
|
|
2
|
+
import { executeFilesystemContentQuery } from "../query-executor.js";
|
|
3
|
+
import { resolveContentNavigation } from "../navigation-query.js";
|
|
4
|
+
import {
|
|
5
|
+
queryFilesystemCollectionItemSurroundings,
|
|
6
|
+
queryFilesystemCollectionNavigation,
|
|
7
|
+
queryFilesystemCollectionPage,
|
|
8
|
+
queryFilesystemCollectionRouteMeta,
|
|
9
|
+
queryFilesystemCollectionSearchSections
|
|
10
|
+
} from "../collection-helpers.js";
|
|
11
|
+
import { queryFilesystemCollectionsSitemapEntries } from "../sitemap.js";
|
|
12
|
+
export const filesystemProvider = {
|
|
13
|
+
name: "filesystem",
|
|
14
|
+
capabilities: {
|
|
15
|
+
routeBackedCollections: true,
|
|
16
|
+
dataCollections: true,
|
|
17
|
+
localizedRoutes: true,
|
|
18
|
+
translatedSlugs: true,
|
|
19
|
+
navigation: true,
|
|
20
|
+
surroundings: true,
|
|
21
|
+
searchSections: true,
|
|
22
|
+
sitemap: true,
|
|
23
|
+
query: {
|
|
24
|
+
operators: [
|
|
25
|
+
...SUPPORTED_QUERY_OPERATORS.filter((operator) => operator !== "$options"),
|
|
26
|
+
"$and",
|
|
27
|
+
"$or"
|
|
28
|
+
],
|
|
29
|
+
limit: true,
|
|
30
|
+
skip: true,
|
|
31
|
+
count: true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
query: (event, query) => {
|
|
35
|
+
if (containsStandaloneRegexOptions(query.where)) {
|
|
36
|
+
throw new TypeError("Query operator $options requires $regex.");
|
|
37
|
+
}
|
|
38
|
+
return executeFilesystemContentQuery(event, query);
|
|
39
|
+
},
|
|
40
|
+
navigationQuery: (event, query) => resolveContentNavigation(event, query),
|
|
41
|
+
navigation: (event, collection, options) => queryFilesystemCollectionNavigation(event, collection, options),
|
|
42
|
+
surroundings: (event, collection, path, options) => queryFilesystemCollectionItemSurroundings(event, collection, path, options),
|
|
43
|
+
searchSections: (event, collection, options) => queryFilesystemCollectionSearchSections(event, collection, options),
|
|
44
|
+
page: (event, collection, routeOrPath, options) => queryFilesystemCollectionPage(event, collection, routeOrPath, options),
|
|
45
|
+
routeMeta: (event, collection, routeOrPath, options) => queryFilesystemCollectionRouteMeta(event, collection, routeOrPath, options),
|
|
46
|
+
sitemapEntries: (event, options) => queryFilesystemCollectionsSitemapEntries(event, options)
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.js'
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nitropack/runtime";
|
|
2
|
+
import { loadExternalContentProvider } from "#content/virtual/providers";
|
|
3
|
+
import { createContentProviderError } from "../../../public/provider-errors";
|
|
4
|
+
import { wrapContentProviderCacheResults } from "../provider-result.js";
|
|
5
|
+
const isObject = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6
|
+
const requiredCapabilityBooleans = [
|
|
7
|
+
"routeBackedCollections",
|
|
8
|
+
"dataCollections",
|
|
9
|
+
"localizedRoutes",
|
|
10
|
+
"translatedSlugs",
|
|
11
|
+
"navigation",
|
|
12
|
+
"surroundings",
|
|
13
|
+
"searchSections",
|
|
14
|
+
"sitemap"
|
|
15
|
+
];
|
|
16
|
+
const assertProviderField = (providerName, condition, field) => {
|
|
17
|
+
if (!condition) {
|
|
18
|
+
throw createContentProviderError("provider_module_invalid", `Content provider ${providerName} has an invalid ${field} field.`, {
|
|
19
|
+
provider: providerName,
|
|
20
|
+
field
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const assertProviderMethod = (providerName, provider, method) => {
|
|
25
|
+
assertProviderField(providerName, typeof provider[method] === "function", method);
|
|
26
|
+
};
|
|
27
|
+
const findProviderUnsupportedOperator = (value, supportedOperators) => {
|
|
28
|
+
if (!value || typeof value !== "object") return void 0;
|
|
29
|
+
if (Array.isArray(value)) {
|
|
30
|
+
for (const child of value) {
|
|
31
|
+
const unsupported = findProviderUnsupportedOperator(child, supportedOperators);
|
|
32
|
+
if (unsupported) return unsupported;
|
|
33
|
+
}
|
|
34
|
+
return void 0;
|
|
35
|
+
}
|
|
36
|
+
for (const [key, child] of Object.entries(value)) {
|
|
37
|
+
if (key.startsWith("$") && !supportedOperators.has(key)) return key;
|
|
38
|
+
const unsupported = findProviderUnsupportedOperator(child, supportedOperators);
|
|
39
|
+
if (unsupported) return unsupported;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const assertProviderQuerySupported = (provider, query) => {
|
|
43
|
+
const capabilities = provider.capabilities.query;
|
|
44
|
+
const unsupportedOperator = findProviderUnsupportedOperator(query.where, new Set(capabilities.operators));
|
|
45
|
+
if (unsupportedOperator) {
|
|
46
|
+
throw createContentProviderError("unsupported_query_operator", `${provider.name} does not support query operator: ${unsupportedOperator}`, {
|
|
47
|
+
provider: provider.name,
|
|
48
|
+
operator: unsupportedOperator
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (!capabilities.limit && query.limit !== void 0) {
|
|
52
|
+
throw createContentProviderError("unsupported_query_shape", `${provider.name} does not support query limits.`, {
|
|
53
|
+
provider: provider.name,
|
|
54
|
+
field: "limit"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (!capabilities.skip && query.skip !== void 0) {
|
|
58
|
+
throw createContentProviderError("unsupported_query_shape", `${provider.name} does not support query offsets.`, {
|
|
59
|
+
provider: provider.name,
|
|
60
|
+
field: "skip"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (!capabilities.count && query.count === true) {
|
|
64
|
+
throw createContentProviderError("unsupported_query_shape", `${provider.name} does not support count queries.`, {
|
|
65
|
+
provider: provider.name,
|
|
66
|
+
field: "count"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const assertProviderOperationSupported = (provider, supported, operation) => {
|
|
71
|
+
if (!supported) {
|
|
72
|
+
throw createContentProviderError("unsupported_provider_operation", `${provider.name} does not support ${operation}.`, {
|
|
73
|
+
provider: provider.name,
|
|
74
|
+
operation
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const enforceProviderCapabilities = (provider) => ({
|
|
79
|
+
...provider,
|
|
80
|
+
query: async (event, query) => {
|
|
81
|
+
assertProviderQuerySupported(provider, query);
|
|
82
|
+
return await provider.query(event, query);
|
|
83
|
+
},
|
|
84
|
+
navigationQuery: provider.navigationQuery ? async (...args) => {
|
|
85
|
+
assertProviderOperationSupported(provider, provider.capabilities.navigation, "navigation");
|
|
86
|
+
return await provider.navigationQuery(...args);
|
|
87
|
+
} : void 0,
|
|
88
|
+
navigation: provider.navigation ? async (...args) => {
|
|
89
|
+
assertProviderOperationSupported(provider, provider.capabilities.navigation, "navigation");
|
|
90
|
+
return await provider.navigation(...args);
|
|
91
|
+
} : void 0,
|
|
92
|
+
surroundings: provider.surroundings ? async (...args) => {
|
|
93
|
+
assertProviderOperationSupported(provider, provider.capabilities.surroundings, "surroundings");
|
|
94
|
+
return await provider.surroundings(...args);
|
|
95
|
+
} : void 0,
|
|
96
|
+
searchSections: provider.searchSections ? async (...args) => {
|
|
97
|
+
assertProviderOperationSupported(provider, provider.capabilities.searchSections, "search sections");
|
|
98
|
+
return await provider.searchSections(...args);
|
|
99
|
+
} : void 0,
|
|
100
|
+
page: provider.page ? async (...args) => {
|
|
101
|
+
assertProviderOperationSupported(provider, provider.capabilities.routeBackedCollections, "route-backed pages");
|
|
102
|
+
return await provider.page(...args);
|
|
103
|
+
} : void 0,
|
|
104
|
+
routeMeta: provider.routeMeta ? async (...args) => {
|
|
105
|
+
assertProviderOperationSupported(provider, provider.capabilities.routeBackedCollections, "route metadata");
|
|
106
|
+
return await provider.routeMeta(...args);
|
|
107
|
+
} : void 0,
|
|
108
|
+
sitemapEntries: provider.sitemapEntries ? async (...args) => {
|
|
109
|
+
assertProviderOperationSupported(provider, provider.capabilities.sitemap, "sitemap entries");
|
|
110
|
+
return await provider.sitemapEntries(...args);
|
|
111
|
+
} : void 0
|
|
112
|
+
});
|
|
113
|
+
const validateContentProvider = (providerName, provider) => {
|
|
114
|
+
if (!isObject(provider)) {
|
|
115
|
+
throw createContentProviderError("provider_module_invalid", `Content provider module for ${providerName} did not export a provider object.`, {
|
|
116
|
+
provider: providerName
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (typeof provider.name !== "string") {
|
|
120
|
+
throw createContentProviderError("provider_module_invalid", `Content provider ${providerName} is missing a string name.`, {
|
|
121
|
+
provider: providerName,
|
|
122
|
+
field: "name"
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (!isObject(provider.capabilities) || !isObject(provider.capabilities.query)) {
|
|
126
|
+
throw createContentProviderError("provider_module_invalid", `Content provider ${providerName} is missing capabilities.`, {
|
|
127
|
+
provider: providerName,
|
|
128
|
+
field: "capabilities"
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
for (const key of requiredCapabilityBooleans) {
|
|
132
|
+
assertProviderField(providerName, typeof provider.capabilities[key] === "boolean", `capabilities.${key}`);
|
|
133
|
+
}
|
|
134
|
+
const queryCapabilities = provider.capabilities.query;
|
|
135
|
+
assertProviderField(
|
|
136
|
+
providerName,
|
|
137
|
+
Array.isArray(queryCapabilities.operators) && queryCapabilities.operators.every((operator) => typeof operator === "string"),
|
|
138
|
+
"capabilities.query.operators"
|
|
139
|
+
);
|
|
140
|
+
assertProviderField(providerName, typeof queryCapabilities.limit === "boolean", "capabilities.query.limit");
|
|
141
|
+
assertProviderField(providerName, typeof queryCapabilities.skip === "boolean", "capabilities.query.skip");
|
|
142
|
+
assertProviderField(providerName, typeof queryCapabilities.count === "boolean", "capabilities.query.count");
|
|
143
|
+
assertProviderMethod(providerName, provider, "query");
|
|
144
|
+
if (provider.capabilities.navigation) {
|
|
145
|
+
assertProviderMethod(providerName, provider, "navigationQuery");
|
|
146
|
+
assertProviderMethod(providerName, provider, "navigation");
|
|
147
|
+
}
|
|
148
|
+
if (provider.capabilities.surroundings) {
|
|
149
|
+
assertProviderMethod(providerName, provider, "surroundings");
|
|
150
|
+
}
|
|
151
|
+
if (provider.capabilities.searchSections) {
|
|
152
|
+
assertProviderMethod(providerName, provider, "searchSections");
|
|
153
|
+
}
|
|
154
|
+
if (provider.capabilities.sitemap) {
|
|
155
|
+
assertProviderMethod(providerName, provider, "sitemapEntries");
|
|
156
|
+
}
|
|
157
|
+
if (provider.capabilities.routeBackedCollections || provider.capabilities.localizedRoutes) {
|
|
158
|
+
assertProviderMethod(providerName, provider, "page");
|
|
159
|
+
assertProviderMethod(providerName, provider, "routeMeta");
|
|
160
|
+
}
|
|
161
|
+
return provider;
|
|
162
|
+
};
|
|
163
|
+
export const getContentProvider = async (event) => {
|
|
164
|
+
const runtime = event ? useRuntimeConfig(event) : useRuntimeConfig();
|
|
165
|
+
const eventContent = event?.context?.contentRuntime;
|
|
166
|
+
const provider = eventContent?.provider || runtime.content?.provider || runtime.public?.content?.provider || "filesystem";
|
|
167
|
+
if (provider === "filesystem") {
|
|
168
|
+
const { filesystemProvider } = await import("./filesystem.js");
|
|
169
|
+
const enforced = enforceProviderCapabilities(filesystemProvider);
|
|
170
|
+
return event ? wrapContentProviderCacheResults(event, enforced) : enforced;
|
|
171
|
+
}
|
|
172
|
+
if (typeof provider === "string") {
|
|
173
|
+
try {
|
|
174
|
+
const externalProvider = await loadExternalContentProvider(provider);
|
|
175
|
+
if (externalProvider) {
|
|
176
|
+
const validated = enforceProviderCapabilities(validateContentProvider(provider, externalProvider));
|
|
177
|
+
return event ? wrapContentProviderCacheResults(event, validated) : validated;
|
|
178
|
+
}
|
|
179
|
+
} catch (error) {
|
|
180
|
+
if (isObject(error) && error.statusMessage === "provider_module_invalid") {
|
|
181
|
+
throw error;
|
|
182
|
+
}
|
|
183
|
+
throw createContentProviderError("provider_module_missing", `Content provider module for ${provider} could not be loaded.`, {
|
|
184
|
+
provider,
|
|
185
|
+
cause: error instanceof Error ? error.message : String(error)
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
throw createContentProviderError("unknown_provider", `Unknown content provider: ${provider}`, { provider });
|
|
190
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './query-api.js'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
import type { ParsedContent } from '../../types/content';
|
|
3
|
+
import type { ContentCollectionHandle } from '../../types/config';
|
|
4
|
+
import type { BacklinksOptions, BacklinksResult, BacklinkSource, ContentVariant, ContentTreeItem, DocumentFromHandle, ManyOptions, LocalizedDoc, NeighborsOptions, NeighborsResult, OneOptions, PopulateSpec, PopulateFromOptions, PopulatedDocument, PaginationOptions, PaginationResult, ResolveOneOptions, ResolveOneResult, TreeOptions, VariantsOptions } from '../../types/query';
|
|
5
|
+
import { type ContentQueryContext } from '../query/unified';
|
|
6
|
+
export declare const createServerContentQueryContext: (event: H3Event) => Promise<ContentQueryContext>;
|
|
7
|
+
export declare function resolveOne<const H extends ContentCollectionHandle | string, O extends ResolveOneOptions<H, PopulateSpec | undefined>>(event: H3Event, handle: H, options: O): Promise<ResolveOneResult<PopulatedDocument<DocumentFromHandle<H>, PopulateFromOptions<O>>>>;
|
|
8
|
+
export declare function one<const H extends ContentCollectionHandle | string, O extends OneOptions<H, PopulateSpec | undefined>>(event: H3Event, handle: H, options: O): Promise<LocalizedDoc<PopulatedDocument<DocumentFromHandle<H>, PopulateFromOptions<O>>> | null>;
|
|
9
|
+
export declare function many<const H extends ContentCollectionHandle | string, O extends ManyOptions<H, PopulateSpec | undefined>>(event: H3Event, handle: H, options?: O): Promise<Array<LocalizedDoc<PopulatedDocument<DocumentFromHandle<H>, PopulateFromOptions<O>>>>>;
|
|
10
|
+
export declare function paginate<const H extends ContentCollectionHandle | string, O extends PaginationOptions<H, PopulateSpec | undefined>>(event: H3Event, handle: H, options: O): Promise<PaginationResult<PopulatedDocument<DocumentFromHandle<H>, PopulateFromOptions<O>>>>;
|
|
11
|
+
export declare function backlinks<const Target extends ContentCollectionHandle | string, const Source extends BacklinkSource | ReadonlyArray<BacklinkSource>, P extends PopulateSpec | undefined = undefined>(event: H3Event, handle: Target, options: BacklinksOptions<Target, Source, P>): Promise<BacklinksResult<Source, P>>;
|
|
12
|
+
export declare function variants<H extends ContentCollectionHandle | string>(event: H3Event, handle: H, options: VariantsOptions<H>): Promise<Array<ContentVariant<H extends {
|
|
13
|
+
__schema: {
|
|
14
|
+
_output: infer O;
|
|
15
|
+
};
|
|
16
|
+
} ? O & ParsedContent : ParsedContent>>>;
|
|
17
|
+
export declare function tree<H extends ContentCollectionHandle | string, Fields extends ReadonlyArray<string> | undefined = undefined>(event: H3Event, handle: H, options?: Omit<TreeOptions<H>, 'fields'> & {
|
|
18
|
+
fields?: Fields;
|
|
19
|
+
}): Promise<ContentTreeItem<H extends {
|
|
20
|
+
__schema: {
|
|
21
|
+
_output: infer O;
|
|
22
|
+
};
|
|
23
|
+
} ? O & ParsedContent : ParsedContent, Fields>[]>;
|
|
24
|
+
export declare function neighbors<H extends ContentCollectionHandle | string>(event: H3Event, handle: H, options: NeighborsOptions<H>): Promise<NeighborsResult<H extends {
|
|
25
|
+
__schema: {
|
|
26
|
+
_output: infer O;
|
|
27
|
+
};
|
|
28
|
+
} ? O & ParsedContent : ParsedContent>>;
|