@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,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
backlinks as backlinksWithContext,
|
|
3
|
+
many as manyWithContext,
|
|
4
|
+
neighbors as neighborsWithContext,
|
|
5
|
+
one as oneWithContext,
|
|
6
|
+
paginate as paginateWithContext,
|
|
7
|
+
resolveOne as resolveOneWithContext,
|
|
8
|
+
tree as treeWithContext,
|
|
9
|
+
variants as variantsWithContext
|
|
10
|
+
} from "../query/unified.js";
|
|
11
|
+
import { getContentProvider } from "./providers/index.js";
|
|
12
|
+
import { createContentProviderError } from "../../public/provider-errors";
|
|
13
|
+
import { getContentRuntimeConfig } from "./runtime-config.js";
|
|
14
|
+
export const createServerContentQueryContext = async (event) => {
|
|
15
|
+
const provider = await getContentProvider(event);
|
|
16
|
+
return {
|
|
17
|
+
runtime: getContentRuntimeConfig().content,
|
|
18
|
+
transport: async (endpoint, params) => {
|
|
19
|
+
if (endpoint === "navigation") {
|
|
20
|
+
if (!provider.navigationQuery) {
|
|
21
|
+
throw createContentProviderError("unsupported_provider_operation", `${provider.name} does not support navigation queries`, {
|
|
22
|
+
provider: provider.name
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return await provider.navigationQuery(event, params);
|
|
26
|
+
}
|
|
27
|
+
return await provider.query(event, params);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export async function resolveOne(event, handle, options) {
|
|
32
|
+
return await resolveOneWithContext(await createServerContentQueryContext(event), handle, options);
|
|
33
|
+
}
|
|
34
|
+
export async function one(event, handle, options) {
|
|
35
|
+
return await oneWithContext(await createServerContentQueryContext(event), handle, options);
|
|
36
|
+
}
|
|
37
|
+
export async function many(event, handle, options = {}) {
|
|
38
|
+
return await manyWithContext(await createServerContentQueryContext(event), handle, options);
|
|
39
|
+
}
|
|
40
|
+
export async function paginate(event, handle, options) {
|
|
41
|
+
return await paginateWithContext(await createServerContentQueryContext(event), handle, options);
|
|
42
|
+
}
|
|
43
|
+
export async function backlinks(event, handle, options) {
|
|
44
|
+
return await backlinksWithContext(await createServerContentQueryContext(event), handle, options);
|
|
45
|
+
}
|
|
46
|
+
export async function variants(event, handle, options) {
|
|
47
|
+
return await variantsWithContext(await createServerContentQueryContext(event), handle, options);
|
|
48
|
+
}
|
|
49
|
+
export async function tree(event, handle, options = {}) {
|
|
50
|
+
return await treeWithContext(await createServerContentQueryContext(event), handle, options);
|
|
51
|
+
}
|
|
52
|
+
export async function neighbors(event, handle, options) {
|
|
53
|
+
return await neighborsWithContext(await createServerContentQueryContext(event), handle, options);
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './query-executor.js'
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type H3Event } from 'h3';
|
|
2
|
+
import type { ContentQueryBuilderParams } from '../../types/query';
|
|
3
|
+
export declare const executeFilesystemContentQuery: <T = unknown>(event: H3Event, inputQuery: ContentQueryBuilderParams) => Promise<T | T[]>;
|
|
4
|
+
export declare const executeContentQuery: <T = unknown>(event: H3Event, inputQuery: ContentQueryBuilderParams) => Promise<T | T[]>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { createError } from "h3";
|
|
2
|
+
import { lowerQueryPlan } from "../../core/query/lower";
|
|
3
|
+
import { executeQueryPlan } from "../../core/query/execute";
|
|
4
|
+
import { ContentError } from "../../core/errors";
|
|
5
|
+
import { normalizeContentQueryParams } from "../../core/query/params";
|
|
6
|
+
import { compileWhere } from "../../core/query/filter";
|
|
7
|
+
import { containsStandaloneRegexOptions, findUnsupportedQueryOperator } from "../../core/query/operators";
|
|
8
|
+
import { withResolvedRefs, withResolvedRefsList } from "../../storage/references";
|
|
9
|
+
import { getContentGraph } from "../../storage/graph";
|
|
10
|
+
import { getContentRuntimeConfig } from "./runtime-config.js";
|
|
11
|
+
import { isPreview } from "../../integrations/nitro/preview";
|
|
12
|
+
import { createContentProviderError } from "../../public/provider-errors";
|
|
13
|
+
import { MAX_PUBLIC_QUERY_LIMIT, MAX_PUBLIC_QUERY_SKIP } from "../query/public-limits.js";
|
|
14
|
+
const notFound = (query, description = "Could not find document for the given query.") => {
|
|
15
|
+
throw createError({
|
|
16
|
+
statusMessage: "Document not found!",
|
|
17
|
+
statusCode: 404,
|
|
18
|
+
data: {
|
|
19
|
+
description,
|
|
20
|
+
query
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const statusForContentError = {
|
|
25
|
+
INVALID_REF_VALUE: 422
|
|
26
|
+
};
|
|
27
|
+
const toHttpError = (error, query) => createError({
|
|
28
|
+
statusCode: statusForContentError[error.code] ?? 500,
|
|
29
|
+
statusMessage: error.code,
|
|
30
|
+
message: error.message,
|
|
31
|
+
data: { code: error.code, context: error.context, query }
|
|
32
|
+
});
|
|
33
|
+
const badQuery = (message) => {
|
|
34
|
+
throw createError({
|
|
35
|
+
statusCode: 400,
|
|
36
|
+
statusMessage: "Invalid content query",
|
|
37
|
+
message
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const containsPublicRegex = (value) => {
|
|
41
|
+
if (value instanceof RegExp) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
if (!value || typeof value !== "object") {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(value)) {
|
|
48
|
+
return value.some(containsPublicRegex);
|
|
49
|
+
}
|
|
50
|
+
const record = value;
|
|
51
|
+
return Object.entries(record).some(([key, child]) => key === "$regex" || containsPublicRegex(child));
|
|
52
|
+
};
|
|
53
|
+
const normalizePublicQuery = (event, query, config) => {
|
|
54
|
+
if (!query.collection) {
|
|
55
|
+
badQuery("Public content queries must target a collection.");
|
|
56
|
+
}
|
|
57
|
+
if (containsPublicRegex(query.where)) {
|
|
58
|
+
badQuery("Public content queries do not accept RegExp filters.");
|
|
59
|
+
}
|
|
60
|
+
if (containsStandaloneRegexOptions(query.where)) {
|
|
61
|
+
badQuery("Query operator $options requires $regex.");
|
|
62
|
+
}
|
|
63
|
+
const enforceProductionVisibility = !import.meta.dev && !isPreview(event);
|
|
64
|
+
const normalized = normalizeContentQueryParams({
|
|
65
|
+
...query,
|
|
66
|
+
limit: typeof query.limit === "number" ? Math.max(0, Math.min(query.limit, MAX_PUBLIC_QUERY_LIMIT)) : query.limit,
|
|
67
|
+
skip: typeof query.skip === "number" ? Math.max(0, Math.min(query.skip, MAX_PUBLIC_QUERY_SKIP)) : query.skip
|
|
68
|
+
}, {
|
|
69
|
+
collectionI18n: query.collection ? config.collections?.[query.collection]?.i18n : void 0,
|
|
70
|
+
defaultLocale: config.defaultLocale,
|
|
71
|
+
localeFallback: config.localeFallback,
|
|
72
|
+
includeDraftFilter: false
|
|
73
|
+
});
|
|
74
|
+
if (enforceProductionVisibility) {
|
|
75
|
+
normalized.where = [
|
|
76
|
+
...normalized.where || [],
|
|
77
|
+
{ _draft: { $ne: true } },
|
|
78
|
+
{ _partial: { $ne: true } }
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
normalized.where = (normalized.where || []).map((condition) => compileWhere(condition)).filter((condition) => Boolean(condition));
|
|
82
|
+
const unsupported = findUnsupportedQueryOperator(normalized.where);
|
|
83
|
+
if (unsupported) {
|
|
84
|
+
throw createContentProviderError("unsupported_query_operator", `Unsupported query operator: ${unsupported}`, {
|
|
85
|
+
operator: unsupported
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return normalized;
|
|
89
|
+
};
|
|
90
|
+
export const executeFilesystemContentQuery = async (event, inputQuery) => {
|
|
91
|
+
const config = getContentRuntimeConfig().content || {};
|
|
92
|
+
const query = normalizePublicQuery(event, inputQuery, config);
|
|
93
|
+
let graph;
|
|
94
|
+
try {
|
|
95
|
+
graph = await getContentGraph(event);
|
|
96
|
+
} catch (cause) {
|
|
97
|
+
if (cause instanceof ContentError) {
|
|
98
|
+
throw toHttpError(cause, query);
|
|
99
|
+
}
|
|
100
|
+
throw cause;
|
|
101
|
+
}
|
|
102
|
+
const plan = lowerQueryPlan(query);
|
|
103
|
+
const response = executeQueryPlan(graph, plan, {
|
|
104
|
+
defaultLocale: config.defaultLocale,
|
|
105
|
+
localeFallback: config.localeFallback,
|
|
106
|
+
collections: config.collections
|
|
107
|
+
});
|
|
108
|
+
if (plan.mode === "count") {
|
|
109
|
+
return response.result;
|
|
110
|
+
}
|
|
111
|
+
const requestedLocale = plan.resolveVariant?.locale || plan.resolveLocale?.locale;
|
|
112
|
+
if (plan.mode === "first") {
|
|
113
|
+
const content = response.result;
|
|
114
|
+
if (!content) {
|
|
115
|
+
notFound(query, plan.resolveVariant ? "Could not find document for the given route variant." : void 0);
|
|
116
|
+
}
|
|
117
|
+
return await withResolvedRefs(event, content, requestedLocale);
|
|
118
|
+
}
|
|
119
|
+
return await withResolvedRefsList(event, Array.isArray(response.result) ? response.result : [], requestedLocale);
|
|
120
|
+
};
|
|
121
|
+
export const executeContentQuery = executeFilesystemContentQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './runtime-config.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getContentRuntimeConfig } from '../../integrations/nitro/runtime-config';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getContentRuntimeConfig } from "../../integrations/nitro/runtime-config";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './search.js'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
import type { ParsedContent } from '../../types/content';
|
|
3
|
+
import type { ContentQueryBuilderWhere } from '../../types/query';
|
|
4
|
+
import type { ContentSearchIndexRecord } from '../../types/search';
|
|
5
|
+
export { searchRecords } from '../shared/search';
|
|
6
|
+
type SearchablePage = Pick<ParsedContent, '_path' | '_locale' | 'title' | 'description' | 'body'> & Record<string, unknown>;
|
|
7
|
+
export declare const clearSearchRecordsCache: () => void;
|
|
8
|
+
export declare function serverSearchContent(event: H3Event, filterQuery?: ContentQueryBuilderWhere, locale?: string, collectionsOverride?: string[], opts?: {
|
|
9
|
+
allLocales?: boolean;
|
|
10
|
+
}): Promise<SearchablePage[]>;
|
|
11
|
+
export declare function buildSearchIndex(event: H3Event, opts?: {
|
|
12
|
+
collections?: string[];
|
|
13
|
+
ignoredTags?: string[];
|
|
14
|
+
extraFields?: string[];
|
|
15
|
+
filterQuery?: ContentQueryBuilderWhere;
|
|
16
|
+
locale?: string;
|
|
17
|
+
allLocales?: boolean;
|
|
18
|
+
}): Promise<ContentSearchIndexRecord[]>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nitropack/runtime";
|
|
2
|
+
import { resolveCollectionI18n } from "../../features/localization/path";
|
|
3
|
+
import { getContentProvider } from "./providers/index.js";
|
|
4
|
+
import { serverQueryCollection } from "./provider-query.js";
|
|
5
|
+
import { createContentProviderError } from "../../public/provider-errors";
|
|
6
|
+
export { searchRecords } from "../shared/search.js";
|
|
7
|
+
const unique = (values) => Array.from(new Set(values.filter(Boolean)));
|
|
8
|
+
const searchRecordsCache = /* @__PURE__ */ new Map();
|
|
9
|
+
const MAX_SEARCH_RECORDS_CACHE_ENTRIES = 12;
|
|
10
|
+
export const clearSearchRecordsCache = () => {
|
|
11
|
+
searchRecordsCache.clear();
|
|
12
|
+
};
|
|
13
|
+
const rememberSearchRecords = (cacheKey, records) => {
|
|
14
|
+
if (searchRecordsCache.has(cacheKey)) {
|
|
15
|
+
searchRecordsCache.delete(cacheKey);
|
|
16
|
+
}
|
|
17
|
+
searchRecordsCache.set(cacheKey, records);
|
|
18
|
+
while (searchRecordsCache.size > MAX_SEARCH_RECORDS_CACHE_ENTRIES) {
|
|
19
|
+
const oldest = searchRecordsCache.keys().next().value;
|
|
20
|
+
if (typeof oldest !== "string") {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
searchRecordsCache.delete(oldest);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const mergeSearchFilter = (filterQuery, locale) => {
|
|
27
|
+
const localeFilter = locale ? { _locale: locale } : void 0;
|
|
28
|
+
if (filterQuery && localeFilter) {
|
|
29
|
+
return { $and: [filterQuery, localeFilter] };
|
|
30
|
+
}
|
|
31
|
+
return filterQuery || localeFilter;
|
|
32
|
+
};
|
|
33
|
+
export async function serverSearchContent(event, filterQuery, locale, collectionsOverride, opts = {}) {
|
|
34
|
+
const runtimeConfig = useRuntimeConfig(event);
|
|
35
|
+
const configuredCollections = collectionsOverride || runtimeConfig.content.search?.collections;
|
|
36
|
+
const contentCollections = Object.keys(runtimeConfig.content.collections || {});
|
|
37
|
+
const collections = (configuredCollections?.length ? configuredCollections : contentCollections).filter(Boolean);
|
|
38
|
+
const results = await Promise.all(collections.map(async (collection) => {
|
|
39
|
+
const loadPages = async (queryLocale) => {
|
|
40
|
+
const query = serverQueryCollection(event, collection).select("_path", "_locale", "title", "description", "body");
|
|
41
|
+
const mergedFilter = mergeSearchFilter(filterQuery, queryLocale);
|
|
42
|
+
if (mergedFilter) {
|
|
43
|
+
return await query.where(mergedFilter).find();
|
|
44
|
+
}
|
|
45
|
+
return await query.find();
|
|
46
|
+
};
|
|
47
|
+
if (locale) {
|
|
48
|
+
return await loadPages(locale);
|
|
49
|
+
}
|
|
50
|
+
const collectionI18n = opts.allLocales ? resolveCollectionI18n(collection, runtimeConfig.content) : void 0;
|
|
51
|
+
if (opts.allLocales && collectionI18n?.locales.length) {
|
|
52
|
+
const localizedResults = await Promise.all(collectionI18n.locales.map(async (collectionLocale) => await loadPages(collectionLocale)));
|
|
53
|
+
return localizedResults.flat();
|
|
54
|
+
}
|
|
55
|
+
return await loadPages();
|
|
56
|
+
}));
|
|
57
|
+
return results.flat();
|
|
58
|
+
}
|
|
59
|
+
const toSearchRecord = (section) => {
|
|
60
|
+
const [path = "", anchor = ""] = section.id.split("#");
|
|
61
|
+
const extraFields = Object.fromEntries(
|
|
62
|
+
Object.entries(section).filter(([key]) => !["id", "title", "titles", "content", "level"].includes(key))
|
|
63
|
+
);
|
|
64
|
+
return {
|
|
65
|
+
...extraFields,
|
|
66
|
+
id: section.id,
|
|
67
|
+
path,
|
|
68
|
+
title: section.title,
|
|
69
|
+
excerpt: section.content.slice(0, 240),
|
|
70
|
+
content: section.content,
|
|
71
|
+
headings: section.titles,
|
|
72
|
+
anchor: anchor || void 0,
|
|
73
|
+
locale: typeof section._locale === "string" ? section._locale : void 0
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const buildProviderSearchSections = async (event, collections, provider, opts) => {
|
|
77
|
+
const runtimeConfig = useRuntimeConfig(event);
|
|
78
|
+
const sections = await Promise.all(collections.map(async (collection) => {
|
|
79
|
+
const loadCollectionLocale = async (locale) => await provider.searchSections(event, collection, {
|
|
80
|
+
ignoredTags: opts.ignoredTags || [],
|
|
81
|
+
extraFields: unique(["_locale", ...opts.extraFields || []]),
|
|
82
|
+
filterQuery: opts.filterQuery,
|
|
83
|
+
locale
|
|
84
|
+
});
|
|
85
|
+
if (opts.locale) {
|
|
86
|
+
return await loadCollectionLocale(opts.locale);
|
|
87
|
+
}
|
|
88
|
+
const collectionI18n = opts.allLocales ? resolveCollectionI18n(collection, runtimeConfig.content) : void 0;
|
|
89
|
+
if (opts.allLocales && collectionI18n?.locales.length) {
|
|
90
|
+
const localizedSections = await Promise.all(collectionI18n.locales.map((locale) => loadCollectionLocale(locale)));
|
|
91
|
+
return localizedSections.flat();
|
|
92
|
+
}
|
|
93
|
+
return await loadCollectionLocale();
|
|
94
|
+
}));
|
|
95
|
+
return sections.flat();
|
|
96
|
+
};
|
|
97
|
+
export async function buildSearchIndex(event, opts = {}) {
|
|
98
|
+
const runtimeConfig = useRuntimeConfig(event);
|
|
99
|
+
const provider = await getContentProvider(event);
|
|
100
|
+
const cacheKey = JSON.stringify({
|
|
101
|
+
provider: provider.name,
|
|
102
|
+
integrity: runtimeConfig.content.cacheIntegrity || runtimeConfig.public.content?.integrity,
|
|
103
|
+
collections: opts.collections || runtimeConfig.content.search?.collections,
|
|
104
|
+
ignoredTags: opts.ignoredTags || [],
|
|
105
|
+
extraFields: opts.extraFields || runtimeConfig.content.search?.extraFields || [],
|
|
106
|
+
filterQuery: opts.filterQuery,
|
|
107
|
+
locale: opts.locale,
|
|
108
|
+
allLocales: opts.allLocales
|
|
109
|
+
});
|
|
110
|
+
const cached = searchRecordsCache.get(cacheKey);
|
|
111
|
+
if (cached) {
|
|
112
|
+
return cached;
|
|
113
|
+
}
|
|
114
|
+
const collections = (opts.collections || runtimeConfig.content.search?.collections || Object.keys(runtimeConfig.content.collections || {})).filter(Boolean);
|
|
115
|
+
if (!provider.capabilities.searchSections) {
|
|
116
|
+
throw createContentProviderError("unsupported_provider_search_index", `${provider.name} does not support search index generation`, {
|
|
117
|
+
provider: provider.name
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (!provider.searchSections) {
|
|
121
|
+
throw createContentProviderError("unsupported_provider_search_index", `${provider.name} does not support search section generation`, {
|
|
122
|
+
provider: provider.name
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const records = (await buildProviderSearchSections(event, collections, provider, {
|
|
126
|
+
ignoredTags: opts.ignoredTags,
|
|
127
|
+
extraFields: opts.extraFields || runtimeConfig.content.search?.extraFields || [],
|
|
128
|
+
filterQuery: opts.filterQuery,
|
|
129
|
+
locale: opts.locale,
|
|
130
|
+
allLocales: opts.allLocales
|
|
131
|
+
})).map(toSearchRecord);
|
|
132
|
+
rememberSearchRecords(cacheKey, records);
|
|
133
|
+
return records;
|
|
134
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sitemap.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sitemap-provider.js'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
import type { ContentSitemapEntry } from '../../types/query';
|
|
3
|
+
import type { QueryCollectionsSitemapEntriesOptions } from './sitemap';
|
|
4
|
+
/**
|
|
5
|
+
* Generate sitemap entries for one or more content collections.
|
|
6
|
+
*
|
|
7
|
+
* Entries include locale alternatives when i18n metadata is available and
|
|
8
|
+
* attempt to collect images from page metadata and markdown bodies.
|
|
9
|
+
*/
|
|
10
|
+
export declare function queryCollectionsSitemapEntries(event: H3Event, options?: QueryCollectionsSitemapEntriesOptions): Promise<ContentSitemapEntry[]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContentProviderError } from "../../public/provider-errors";
|
|
2
|
+
export async function queryCollectionsSitemapEntries(event, options = {}) {
|
|
3
|
+
const { getContentProvider } = await import("./providers/index.js");
|
|
4
|
+
const provider = await getContentProvider(event);
|
|
5
|
+
if (!provider.sitemapEntries) {
|
|
6
|
+
throw createContentProviderError("unsupported_provider_operation", `${provider.name} does not support sitemap entries`, {
|
|
7
|
+
provider: provider.name
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
return await provider.sitemapEntries(event, options);
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
import type { ContentSitemapEntry } from '../../types/query';
|
|
3
|
+
import { type QueryCollectionsSitemapEntriesOptions } from '../../features/sitemap/query';
|
|
4
|
+
export type { QueryCollectionsSitemapEntriesOptions };
|
|
5
|
+
export declare function queryFilesystemCollectionsSitemapEntries(event: H3Event, options?: QueryCollectionsSitemapEntriesOptions): Promise<ContentSitemapEntry[]>;
|
|
6
|
+
export declare const queryCollectionsSitemapEntries: typeof queryFilesystemCollectionsSitemapEntries;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getRequestURL } from "h3";
|
|
2
|
+
import { useRuntimeConfig } from "nitropack/runtime";
|
|
3
|
+
import { queryCollectionsSitemapEntriesData } from "../../features/sitemap/query";
|
|
4
|
+
import { queryFilesystemCollectionPage, queryFilesystemCollectionRouteMeta } from "./collection-helpers.js";
|
|
5
|
+
import { serverQueryCollection } from "./storage.js";
|
|
6
|
+
import { contentConfig } from "./storage-access.js";
|
|
7
|
+
import { resolveCollectionI18n } from "../../features/localization/path";
|
|
8
|
+
const sitemapPageFields = [
|
|
9
|
+
"_path",
|
|
10
|
+
"_file",
|
|
11
|
+
"_locale",
|
|
12
|
+
"_draft",
|
|
13
|
+
"_canonicalKey",
|
|
14
|
+
"sitemap",
|
|
15
|
+
"image",
|
|
16
|
+
"seo",
|
|
17
|
+
"ogImage"
|
|
18
|
+
];
|
|
19
|
+
export async function queryFilesystemCollectionsSitemapEntries(event, options = {}) {
|
|
20
|
+
const runtimeConfig = useRuntimeConfig(event);
|
|
21
|
+
const requestUrl = event?.node?.req ? getRequestURL(event) : null;
|
|
22
|
+
return await queryCollectionsSitemapEntriesData({
|
|
23
|
+
collections: contentConfig().collections,
|
|
24
|
+
defaultLocale: contentConfig().defaultLocale,
|
|
25
|
+
runtimeSiteUrl: runtimeConfig.public.siteUrl,
|
|
26
|
+
localeConfigs: runtimeConfig.public.i18n?.locales || [],
|
|
27
|
+
requestSiteUrl: requestUrl ? `${requestUrl.protocol}//${requestUrl.host}` : void 0
|
|
28
|
+
}, {
|
|
29
|
+
loadCollectionPages: async (collection) => {
|
|
30
|
+
const config = contentConfig();
|
|
31
|
+
const collectionI18n = resolveCollectionI18n(collection, config);
|
|
32
|
+
const pages = collectionI18n.locales.length ? (await Promise.all(collectionI18n.locales.map(
|
|
33
|
+
(locale) => serverQueryCollection(event, collection).locale(locale).select(...sitemapPageFields).all()
|
|
34
|
+
))).flat() : await serverQueryCollection(event, collection).select(...sitemapPageFields).all();
|
|
35
|
+
return pages;
|
|
36
|
+
},
|
|
37
|
+
loadRouteMeta: async (collection, path, locale) => {
|
|
38
|
+
return await queryFilesystemCollectionRouteMeta(event, collection, path, { locale });
|
|
39
|
+
},
|
|
40
|
+
loadPage: async (collection, path, locale) => {
|
|
41
|
+
return await queryFilesystemCollectionPage(event, collection, path, { locale });
|
|
42
|
+
}
|
|
43
|
+
}, options);
|
|
44
|
+
}
|
|
45
|
+
export const queryCollectionsSitemapEntries = queryFilesystemCollectionsSitemapEntries;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './storage.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './storage-access.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { cacheParsedStorage, cacheStorage, contentConfig, contentIgnorePredicate, getContentsIds, resolveStorageId, sourceStorage } from '../../integrations/nitro/storage';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validation.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createContentError, getCanonicalContentId, validateCollectionDocument, validateContentGraph } from '../../storage/validation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './search.js'
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ContentMiniSearchOptions, ContentSearchIndexRecord, ContentSearchResult } from '../../types/search';
|
|
2
|
+
export declare const searchRecords: (records: ContentSearchIndexRecord[], term: string, locale?: string, searchOptions?: Partial<ContentMiniSearchOptions>) => ContentSearchResult[];
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import MiniSearch from "minisearch";
|
|
2
|
+
const DEFAULT_SEARCH_OPTIONS = {
|
|
3
|
+
fields: ["title", "content", "headings"],
|
|
4
|
+
storeFields: ["path", "title", "excerpt", "anchor", "locale"],
|
|
5
|
+
boost: {
|
|
6
|
+
title: 4,
|
|
7
|
+
headings: 2,
|
|
8
|
+
content: 1
|
|
9
|
+
},
|
|
10
|
+
fuzzy: 0.2,
|
|
11
|
+
prefix: true
|
|
12
|
+
};
|
|
13
|
+
const REQUIRED_STORE_FIELDS = ["path", "title", "excerpt"];
|
|
14
|
+
const MAX_SEARCH_INDEX_CACHE_ENTRIES = 12;
|
|
15
|
+
const searchIndexCache = /* @__PURE__ */ new Map();
|
|
16
|
+
const resolveSearchOptions = (options = {}) => {
|
|
17
|
+
const fields = options.fields?.length ? options.fields : DEFAULT_SEARCH_OPTIONS.fields;
|
|
18
|
+
const storeFields = options.storeFields?.length ? options.storeFields : DEFAULT_SEARCH_OPTIONS.storeFields;
|
|
19
|
+
return {
|
|
20
|
+
fields,
|
|
21
|
+
storeFields: Array.from(/* @__PURE__ */ new Set([...REQUIRED_STORE_FIELDS, ...storeFields])),
|
|
22
|
+
boost: options.boost && Object.keys(options.boost).length ? options.boost : DEFAULT_SEARCH_OPTIONS.boost,
|
|
23
|
+
fuzzy: typeof options.fuzzy === "boolean" || typeof options.fuzzy === "number" ? options.fuzzy : DEFAULT_SEARCH_OPTIONS.fuzzy,
|
|
24
|
+
prefix: typeof options.prefix === "boolean" ? options.prefix : DEFAULT_SEARCH_OPTIONS.prefix
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const rememberSearchIndex = (cacheKey, index) => {
|
|
28
|
+
if (searchIndexCache.has(cacheKey)) {
|
|
29
|
+
searchIndexCache.delete(cacheKey);
|
|
30
|
+
}
|
|
31
|
+
searchIndexCache.set(cacheKey, index);
|
|
32
|
+
while (searchIndexCache.size > MAX_SEARCH_INDEX_CACHE_ENTRIES) {
|
|
33
|
+
const oldest = searchIndexCache.keys().next().value;
|
|
34
|
+
if (typeof oldest !== "string") {
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
searchIndexCache.delete(oldest);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const createSearchIndex = (options) => {
|
|
41
|
+
return new MiniSearch({
|
|
42
|
+
fields: options.fields,
|
|
43
|
+
storeFields: options.storeFields,
|
|
44
|
+
searchOptions: {
|
|
45
|
+
prefix: options.prefix,
|
|
46
|
+
fuzzy: options.fuzzy,
|
|
47
|
+
boost: options.boost
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const createCacheKey = (records, locale, options) => {
|
|
52
|
+
return JSON.stringify({
|
|
53
|
+
locale: locale || "",
|
|
54
|
+
records: records.map((record) => Object.fromEntries(["id", ...options.fields, ...options.storeFields].map((field) => [field, record[field]]))),
|
|
55
|
+
fields: options.fields,
|
|
56
|
+
storeFields: options.storeFields,
|
|
57
|
+
boost: options.boost,
|
|
58
|
+
fuzzy: options.fuzzy,
|
|
59
|
+
prefix: options.prefix
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export const searchRecords = (records, term, locale, searchOptions) => {
|
|
63
|
+
if (!term.trim()) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
const options = resolveSearchOptions(searchOptions);
|
|
67
|
+
const scopedRecords = locale ? records.filter((record) => record.locale === locale) : records;
|
|
68
|
+
const cacheKey = createCacheKey(scopedRecords, locale, options);
|
|
69
|
+
let index = searchIndexCache.get(cacheKey);
|
|
70
|
+
if (!index) {
|
|
71
|
+
index = createSearchIndex(options);
|
|
72
|
+
index.addAll(scopedRecords);
|
|
73
|
+
rememberSearchIndex(cacheKey, index);
|
|
74
|
+
} else {
|
|
75
|
+
rememberSearchIndex(cacheKey, index);
|
|
76
|
+
}
|
|
77
|
+
return index.search(term).map((result) => {
|
|
78
|
+
const storedFields = Object.fromEntries(options.storeFields.map((field) => [field, result[field]]));
|
|
79
|
+
return {
|
|
80
|
+
...storedFields,
|
|
81
|
+
path: typeof result.path === "string" ? result.path : "",
|
|
82
|
+
title: typeof result.title === "string" ? result.title : "",
|
|
83
|
+
excerpt: typeof result.excerpt === "string" ? result.excerpt : "",
|
|
84
|
+
score: result.score,
|
|
85
|
+
anchor: typeof result.anchor === "string" ? result.anchor : void 0,
|
|
86
|
+
locale: typeof result.locale === "string" ? result.locale : void 0
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component-resolver.js'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ParsedContent } from '../../types/content';
|
|
2
|
+
export declare function resolveContentComponents(body: ParsedContent['body'], meta: Record<string, string>): Promise<any>;
|
|
3
|
+
export declare function loadComponents(node: ParsedContent['body'] | {
|
|
4
|
+
type?: string;
|
|
5
|
+
tag?: string;
|
|
6
|
+
props?: Record<string, unknown>;
|
|
7
|
+
children?: Array<ParsedContent['body']>;
|
|
8
|
+
} | null, tags: Record<string, string>): [string, unknown][];
|
|
9
|
+
declare const _default: import("../../types").ContentTransformer;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { localComponents, localComponentLoaders } from "../utils/content-components.js";
|
|
2
|
+
import { resolveDocumentContentComponents, loadContentComponentEntries } from "../../integrations/vue/content-components";
|
|
3
|
+
import { defineTransformer } from "./utils.js";
|
|
4
|
+
export async function resolveContentComponents(body, meta) {
|
|
5
|
+
return await resolveDocumentContentComponents(body, {
|
|
6
|
+
tags: meta,
|
|
7
|
+
catalog: {
|
|
8
|
+
localComponents,
|
|
9
|
+
localComponentLoaders
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export function loadComponents(node, tags) {
|
|
14
|
+
return loadContentComponentEntries(node, tags);
|
|
15
|
+
}
|
|
16
|
+
export default defineTransformer({
|
|
17
|
+
name: "component-resolver",
|
|
18
|
+
extensions: [".*"],
|
|
19
|
+
async transform(content, options = {}) {
|
|
20
|
+
if (import.meta.server) {
|
|
21
|
+
return content;
|
|
22
|
+
}
|
|
23
|
+
const _components = await resolveContentComponents(content.body, {
|
|
24
|
+
...options?.tags || {},
|
|
25
|
+
...content._components || {}
|
|
26
|
+
});
|
|
27
|
+
content._components = _components;
|
|
28
|
+
return content;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './from-csv.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../parsers/from-csv';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../parsers/from-csv";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../../../parsers/csv';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "../../../parsers/csv";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './define.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineTransformer } from '../../parsers/utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineTransformer } from "../../parsers/utils";
|