@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
package/dist/parsers/csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './csv.js'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineTransformer } from "./utils.js";
|
|
2
|
+
import { fromCSV } from "./from-csv.js";
|
|
3
|
+
const cellValue = (column) => column.children[0]?.value;
|
|
4
|
+
function toJsonObject(tree) {
|
|
5
|
+
const [header, ...rows] = tree.children;
|
|
6
|
+
const columns = (header?.children || []).map((column) => cellValue(column));
|
|
7
|
+
return rows.map((row) => {
|
|
8
|
+
return row.children.reduce((record, column, index) => {
|
|
9
|
+
const key = columns[index];
|
|
10
|
+
if (typeof key === "string") {
|
|
11
|
+
record[key] = cellValue(column);
|
|
12
|
+
}
|
|
13
|
+
return record;
|
|
14
|
+
}, {});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function toJsonArray(tree) {
|
|
18
|
+
return tree.children.map((row) => {
|
|
19
|
+
return row.children.map((column) => cellValue(column));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export default defineTransformer({
|
|
23
|
+
name: "csv",
|
|
24
|
+
extensions: [".csv"],
|
|
25
|
+
parse: async (_id, content, options = {}) => {
|
|
26
|
+
const tree = fromCSV(content, {
|
|
27
|
+
delimiter: ",",
|
|
28
|
+
json: true,
|
|
29
|
+
...options
|
|
30
|
+
});
|
|
31
|
+
const result = options.json === false ? toJsonArray(tree) : toJsonObject(tree);
|
|
32
|
+
return {
|
|
33
|
+
_id,
|
|
34
|
+
_type: "csv",
|
|
35
|
+
body: result
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './from-csv.js'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CsvTextNode {
|
|
2
|
+
type: 'text';
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export interface CsvColumnNode {
|
|
6
|
+
type: 'column';
|
|
7
|
+
children: CsvTextNode[];
|
|
8
|
+
}
|
|
9
|
+
export interface CsvRowNode {
|
|
10
|
+
type: 'row';
|
|
11
|
+
children: CsvColumnNode[];
|
|
12
|
+
}
|
|
13
|
+
export interface CsvRootNode {
|
|
14
|
+
type: 'root';
|
|
15
|
+
children: CsvRowNode[];
|
|
16
|
+
}
|
|
17
|
+
export interface CsvParseOptions {
|
|
18
|
+
delimiter?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const fromCSV: (value: string, encodingOrOptions?: string | CsvParseOptions, maybeOptions?: CsvParseOptions) => CsvRootNode;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const createColumn = (value) => ({
|
|
2
|
+
type: "column",
|
|
3
|
+
children: value ? [{ type: "text", value }] : []
|
|
4
|
+
});
|
|
5
|
+
const createRow = (values) => ({
|
|
6
|
+
type: "row",
|
|
7
|
+
children: values.map(createColumn)
|
|
8
|
+
});
|
|
9
|
+
const normalizeDelimiter = (options) => {
|
|
10
|
+
const delimiter = options?.delimiter || ",";
|
|
11
|
+
if (delimiter.length !== 1) {
|
|
12
|
+
throw new Error("CSV delimiter must be a single character");
|
|
13
|
+
}
|
|
14
|
+
return delimiter;
|
|
15
|
+
};
|
|
16
|
+
export const fromCSV = (value, encodingOrOptions, maybeOptions) => {
|
|
17
|
+
const options = typeof encodingOrOptions === "string" ? maybeOptions : encodingOrOptions;
|
|
18
|
+
const delimiter = normalizeDelimiter(options);
|
|
19
|
+
const rows = [];
|
|
20
|
+
let row = [];
|
|
21
|
+
let field = "";
|
|
22
|
+
let quoted = false;
|
|
23
|
+
let index = 0;
|
|
24
|
+
const pushField = () => {
|
|
25
|
+
row.push(field);
|
|
26
|
+
field = "";
|
|
27
|
+
};
|
|
28
|
+
const pushRow = () => {
|
|
29
|
+
pushField();
|
|
30
|
+
rows.push(createRow(row));
|
|
31
|
+
row = [];
|
|
32
|
+
};
|
|
33
|
+
while (index < value.length) {
|
|
34
|
+
const char = value[index];
|
|
35
|
+
if (quoted) {
|
|
36
|
+
if (char === '"') {
|
|
37
|
+
if (value[index + 1] === '"') {
|
|
38
|
+
field += '"';
|
|
39
|
+
index += 2;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
quoted = false;
|
|
43
|
+
index += 1;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
field += char;
|
|
47
|
+
index += 1;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (char === '"') {
|
|
51
|
+
if (field.length > 0) {
|
|
52
|
+
throw new Error("Unexpected quote in unquoted CSV field");
|
|
53
|
+
}
|
|
54
|
+
quoted = true;
|
|
55
|
+
index += 1;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (char === delimiter) {
|
|
59
|
+
pushField();
|
|
60
|
+
index += 1;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (char === "\n" || char === "\r") {
|
|
64
|
+
pushRow();
|
|
65
|
+
if (char === "\r" && value[index + 1] === "\n") {
|
|
66
|
+
index += 2;
|
|
67
|
+
} else {
|
|
68
|
+
index += 1;
|
|
69
|
+
}
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
field += char;
|
|
73
|
+
index += 1;
|
|
74
|
+
}
|
|
75
|
+
if (quoted) {
|
|
76
|
+
throw new Error("Cannot close document, a token (`quotedData`) is still open");
|
|
77
|
+
}
|
|
78
|
+
if (field.length || row.length || !value.endsWith("\n") && !value.endsWith("\r")) {
|
|
79
|
+
pushRow();
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
type: "root",
|
|
83
|
+
children: rows
|
|
84
|
+
};
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.js'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StorageValue } from 'unstorage';
|
|
2
|
+
import type { TransformContentOptions } from '../types/content';
|
|
3
|
+
/**
|
|
4
|
+
* Parse content file using registered plugins
|
|
5
|
+
*/
|
|
6
|
+
export declare function transformContent(id: string, content: StorageValue, options?: TransformContentOptions): Promise<{
|
|
7
|
+
_id: string;
|
|
8
|
+
body: StorageValue;
|
|
9
|
+
}>;
|
|
10
|
+
export { defineTransformer } from './utils';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { extname } from "pathe";
|
|
2
|
+
import { camelCase } from "scule";
|
|
3
|
+
import csv from "./csv.js";
|
|
4
|
+
import markdown from "./markdown.js";
|
|
5
|
+
import yaml from "./yaml.js";
|
|
6
|
+
import pathMeta from "./path-meta.js";
|
|
7
|
+
import json from "./json.js";
|
|
8
|
+
const TRANSFORMERS = [
|
|
9
|
+
csv,
|
|
10
|
+
markdown,
|
|
11
|
+
json,
|
|
12
|
+
yaml,
|
|
13
|
+
pathMeta
|
|
14
|
+
];
|
|
15
|
+
function getParser(ext, additionalTransformers = []) {
|
|
16
|
+
let parser = additionalTransformers.find((p) => ext.match(new RegExp(p.extensions.join("|"), "i")) && p.parse);
|
|
17
|
+
if (!parser) {
|
|
18
|
+
parser = TRANSFORMERS.find((p) => ext.match(new RegExp(p.extensions.join("|"), "i")) && p.parse);
|
|
19
|
+
}
|
|
20
|
+
return parser;
|
|
21
|
+
}
|
|
22
|
+
function getTransformers(ext, additionalTransformers = []) {
|
|
23
|
+
return [
|
|
24
|
+
...additionalTransformers.filter((p) => ext.match(new RegExp(p.extensions.join("|"), "i")) && p.transform),
|
|
25
|
+
...TRANSFORMERS.filter((p) => ext.match(new RegExp(p.extensions.join("|"), "i")) && p.transform)
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
export async function transformContent(id, content, options = {}) {
|
|
29
|
+
const { transformers = [] } = options;
|
|
30
|
+
const file = { _id: id, body: content };
|
|
31
|
+
const ext = extname(id);
|
|
32
|
+
const parser = getParser(ext, transformers);
|
|
33
|
+
if (!parser) {
|
|
34
|
+
console.warn(`${ext} files are not supported, "${id}" falling back to raw content`);
|
|
35
|
+
return file;
|
|
36
|
+
}
|
|
37
|
+
const parserOptions = options[camelCase(parser.name)] || {};
|
|
38
|
+
const parsed = await parser.parse(file._id, file.body, parserOptions);
|
|
39
|
+
const matchedTransformers = getTransformers(ext, transformers);
|
|
40
|
+
const result = await matchedTransformers.reduce(async (prev, cur) => {
|
|
41
|
+
const next = await prev || parsed;
|
|
42
|
+
const transformOptions = options[camelCase(cur.name)];
|
|
43
|
+
if (transformOptions === false) {
|
|
44
|
+
return next;
|
|
45
|
+
}
|
|
46
|
+
return cur.transform(next, transformOptions || {});
|
|
47
|
+
}, Promise.resolve(parsed));
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
export { defineTransformer } from "./utils.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './json.js'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { destr } from "destr";
|
|
2
|
+
import { defineTransformer } from "./utils.js";
|
|
3
|
+
export default defineTransformer({
|
|
4
|
+
name: "Json",
|
|
5
|
+
extensions: [".json", ".json5"],
|
|
6
|
+
parse: async (_id, content) => {
|
|
7
|
+
let parsed;
|
|
8
|
+
if (typeof content === "string") {
|
|
9
|
+
if (_id.endsWith("json5")) {
|
|
10
|
+
parsed = (await import("json5").then((m) => m.default || m)).parse(content);
|
|
11
|
+
} else if (_id.endsWith("json")) {
|
|
12
|
+
parsed = destr(content);
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
15
|
+
parsed = content;
|
|
16
|
+
}
|
|
17
|
+
if (Array.isArray(parsed)) {
|
|
18
|
+
console.warn(`JSON array is not supported in ${_id}, moving the array into the \`body\` key`);
|
|
19
|
+
parsed = {
|
|
20
|
+
body: parsed
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
...parsed,
|
|
25
|
+
_id,
|
|
26
|
+
_type: "json"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './markdown.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './markdown-plugins.js'
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import highlightPlugin from "comark/plugins/highlight";
|
|
2
|
+
import summaryPlugin from "comark/plugins/summary";
|
|
3
|
+
import tocPlugin from "comark/plugins/toc";
|
|
4
|
+
const builtinMarkdownPlugins = {
|
|
5
|
+
breaks: {
|
|
6
|
+
load: () => loadModule("comark/plugins/breaks")
|
|
7
|
+
},
|
|
8
|
+
emoji: {
|
|
9
|
+
load: () => loadModule("comark/plugins/emoji")
|
|
10
|
+
},
|
|
11
|
+
highlight: {
|
|
12
|
+
load: async () => highlightPlugin
|
|
13
|
+
},
|
|
14
|
+
"json-render": {
|
|
15
|
+
load: () => loadModule("comark/plugins/json-render")
|
|
16
|
+
},
|
|
17
|
+
math: {
|
|
18
|
+
load: () => loadModule("comark/plugins/math")
|
|
19
|
+
},
|
|
20
|
+
mermaid: {
|
|
21
|
+
load: () => loadModule("comark/plugins/mermaid")
|
|
22
|
+
},
|
|
23
|
+
punctuation: {
|
|
24
|
+
load: () => loadModule("comark/plugins/punctuation")
|
|
25
|
+
},
|
|
26
|
+
security: {
|
|
27
|
+
load: () => loadModule("comark/plugins/security")
|
|
28
|
+
},
|
|
29
|
+
summary: {
|
|
30
|
+
load: async () => summaryPlugin
|
|
31
|
+
},
|
|
32
|
+
toc: {
|
|
33
|
+
load: async () => tocPlugin
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export async function resolveMarkdownPlugins(plugins) {
|
|
37
|
+
return await Promise.all(plugins.map(async (plugin) => {
|
|
38
|
+
const factory = await loadMarkdownPluginFactory(plugin.name);
|
|
39
|
+
return factory(plugin.options);
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
async function loadMarkdownPluginFactory(name) {
|
|
43
|
+
const builtin = builtinMarkdownPlugins[name];
|
|
44
|
+
if (builtin) {
|
|
45
|
+
return await builtin.load();
|
|
46
|
+
}
|
|
47
|
+
return await loadModule(name);
|
|
48
|
+
}
|
|
49
|
+
async function loadModule(specifier) {
|
|
50
|
+
const imported = await import(
|
|
51
|
+
/* @vite-ignore */
|
|
52
|
+
specifier
|
|
53
|
+
);
|
|
54
|
+
return resolveModule(imported);
|
|
55
|
+
}
|
|
56
|
+
function resolveModule(imported) {
|
|
57
|
+
return imported.default || imported;
|
|
58
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { parse } from "comark";
|
|
2
|
+
import { isRelative } from "ufo";
|
|
3
|
+
import { defineTransformer } from "./utils.js";
|
|
4
|
+
import { generatePath } from "./path-meta.js";
|
|
5
|
+
import { resolveMarkdownPlugins } from "./markdown-plugins.js";
|
|
6
|
+
import { mapMarkdownNodes, toMarkdownRoot } from "../core/markdown/tree";
|
|
7
|
+
export default defineTransformer({
|
|
8
|
+
name: "markdown",
|
|
9
|
+
extensions: [".md"],
|
|
10
|
+
parse: async (_id, content, options = {}) => {
|
|
11
|
+
const config = { ...options };
|
|
12
|
+
const plugins = await resolveMarkdownPlugins(config.plugins || []);
|
|
13
|
+
const tree = await parse(content, {
|
|
14
|
+
plugins
|
|
15
|
+
});
|
|
16
|
+
const body = normalizeMarkdownBody({
|
|
17
|
+
...toMarkdownRoot(tree.nodes),
|
|
18
|
+
toc: tree.meta?.toc
|
|
19
|
+
});
|
|
20
|
+
const excerpt = Array.isArray(tree.meta?.summary) ? normalizeMarkdownBody({
|
|
21
|
+
...toMarkdownRoot(tree.meta.summary)
|
|
22
|
+
}) : void 0;
|
|
23
|
+
return {
|
|
24
|
+
...tree.frontmatter,
|
|
25
|
+
_empty: body.children.length === 0,
|
|
26
|
+
description: typeof tree.frontmatter.description === "string" ? tree.frontmatter.description : "",
|
|
27
|
+
excerpt,
|
|
28
|
+
body,
|
|
29
|
+
_type: "markdown",
|
|
30
|
+
_id
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
function normalizeMarkdownBody(body) {
|
|
35
|
+
return {
|
|
36
|
+
...body,
|
|
37
|
+
children: mapMarkdownNodes(body.children, normalizeMarkdownNode)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function normalizeMarkdownNode(node) {
|
|
41
|
+
if (node.tag !== "a") {
|
|
42
|
+
return node;
|
|
43
|
+
}
|
|
44
|
+
const href = typeof node.props?.href === "string" ? node.props.href : void 0;
|
|
45
|
+
if (!href) {
|
|
46
|
+
return node;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
...node,
|
|
50
|
+
props: {
|
|
51
|
+
...node.props,
|
|
52
|
+
href: normalizeLink(href)
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function normalizeLink(link) {
|
|
57
|
+
const match = link.match(/#.+$/);
|
|
58
|
+
const hash = match ? match[0] : "";
|
|
59
|
+
if (link.replace(/#.+$/, "").endsWith(".md") && (isRelative(link) || !/^https?/.test(link) && !link.startsWith("/"))) {
|
|
60
|
+
const normalized = link.replace(".md" + hash, "").replace(/^\.\//, "");
|
|
61
|
+
return generatePath(normalized, { forceLeadingSlash: false }) + hash;
|
|
62
|
+
}
|
|
63
|
+
return link;
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './path-meta.js'
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { describeId, generateCanonicalKey, generatePath, generateTitle, refineUrlPart } from '../core/content/path';
|
|
2
|
+
declare const _default: import("../types/content").ContentTransformer;
|
|
3
|
+
export default _default;
|
|
4
|
+
export { describeId, generateCanonicalKey, generatePath, generateTitle, refineUrlPart };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { describeId, generateCanonicalKey, generatePath, generateTitle, isDraftPath, isPartialPath, refineUrlPart } from "../core/content/path";
|
|
2
|
+
import { defineTransformer } from "./utils.js";
|
|
3
|
+
export default defineTransformer({
|
|
4
|
+
name: "path-meta",
|
|
5
|
+
extensions: [".*"],
|
|
6
|
+
transform(content, options = {}) {
|
|
7
|
+
const { locales = [], defaultLocale = "en", respectPathCase = false, translatedSlugs = false } = options;
|
|
8
|
+
const { _source, _file, _path, _extension, _basename } = describeId(content._id);
|
|
9
|
+
const parts = _path.split("/");
|
|
10
|
+
const _locale = locales.includes(parts[0]) ? parts.shift() : defaultLocale;
|
|
11
|
+
const isNavigation = _basename === ".navigation";
|
|
12
|
+
const rawPath = isNavigation ? parts.slice(0, -1).join("/") : parts.join("/");
|
|
13
|
+
const filePath = generatePath(rawPath, { respectPathCase });
|
|
14
|
+
const _canonicalKey = generateCanonicalKey(isNavigation ? parts.slice(0, -1) : parts, { translatedSlugs, respectPathCase });
|
|
15
|
+
const _collection = options.collectionResolver?.(_file);
|
|
16
|
+
return {
|
|
17
|
+
...content,
|
|
18
|
+
// Fallback title synthesis lives here (not in the markdown parser) so it
|
|
19
|
+
// applies uniformly to every parser output. Moving it into the markdown
|
|
20
|
+
// parser would duplicate the logic in the yaml / json / csv parsers.
|
|
21
|
+
title: content.title || (isNavigation ? void 0 : generateTitle(refineUrlPart(_basename))),
|
|
22
|
+
_path: filePath,
|
|
23
|
+
_dir: filePath.split("/").slice(-2)[0],
|
|
24
|
+
_draft: content.draft || isDraftPath(_path),
|
|
25
|
+
_partial: isNavigation || isPartialPath(_path),
|
|
26
|
+
_locale,
|
|
27
|
+
_canonicalKey,
|
|
28
|
+
_collection,
|
|
29
|
+
_navigation: isNavigation,
|
|
30
|
+
_source,
|
|
31
|
+
_file,
|
|
32
|
+
_stem: _path,
|
|
33
|
+
_extension
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export { describeId, generateCanonicalKey, generatePath, generateTitle, refineUrlPart };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './yaml.js'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { load } from "js-yaml";
|
|
2
|
+
import { defineTransformer } from "./utils.js";
|
|
3
|
+
export default defineTransformer({
|
|
4
|
+
name: "Yaml",
|
|
5
|
+
extensions: [".yml", ".yaml"],
|
|
6
|
+
parse: (_id, content) => {
|
|
7
|
+
const data = load(String(content));
|
|
8
|
+
let parsed = data;
|
|
9
|
+
if (Array.isArray(data)) {
|
|
10
|
+
console.warn(`YAML array is not supported in ${_id}, moving the array into the \`body\` key`);
|
|
11
|
+
parsed = { body: data };
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
...parsed,
|
|
15
|
+
_id,
|
|
16
|
+
_type: "yaml"
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './client.js'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side public API surface (browser + SSR Vue).
|
|
3
|
+
*
|
|
4
|
+
* The unified query API (ADR-0016) is the supported core read path. Route
|
|
5
|
+
* pages use the thin `useContentPage` convenience helper built on top of it.
|
|
6
|
+
*/
|
|
7
|
+
export { one, many, paginate, backlinks, resolveOne, variants, tree, neighbors } from '../runtime/app/composables/query-api.js';
|
|
8
|
+
export { getCollectionPath } from '../runtime/query/routes.js';
|
|
9
|
+
export type { CollectionPathOptions } from '../runtime/query/routes.js';
|
|
10
|
+
export { useContentPage, useContentOne, useContentMany, useContentPagination, useContentBacklinks, useContentResolveOne, useContentVariants, useContentTree, useContentNeighbors, useContentLocaleSwitch } from '../runtime/app/composables/use-content.js';
|
|
11
|
+
export type { UseContentPageOptions } from '../runtime/app/composables/use-content.js';
|
|
12
|
+
export type { QueryWhere, QueryOperators, ContentSelector, ContentResolvedMeta, BacklinkFields, BacklinkSource, BacklinksOptions, BacklinksResult, LocaleFallback, DocumentFromHandle, OneOptions, ManyOptions, PaginationOptions, PaginationResult, PopulateSpec, PopulatedDocument, ResolveOneOptions, ResolveOneResult, LocalizedDoc, LocalePathEntry, NeighborsOptions, NeighborsResult, ResolutionEnvelope, SortSpec, TreeOptions, VariantsOptions, ContentVariant, ContentNavigationItem, ContentTreeItem, ContentRouteMeta, ContentSearchSection } from '../types/query.js';
|
|
13
|
+
export { useContentSearch, useContentSearchData, useContentSearchResults } from '../runtime/app/composables/search.js';
|
|
14
|
+
export type { UseContentSearchDataOptions, UseContentSearchDataResult, UseContentSearchOptions, UseContentSearchResult, UseContentSearchResultsOptions, UseContentSearchResultsResult } from '../runtime/app/composables/search.js';
|
|
15
|
+
export { querySiteData } from '../runtime/app/composables/site-data.js';
|
|
16
|
+
export type { ContentSiteDataResponse, QuerySiteDataOptions } from '../runtime/app/composables/site-data.js';
|
|
17
|
+
export { extractContentToc, useContentToc } from '../runtime/app/composables/toc.js';
|
|
18
|
+
export type { ContentTocOptions } from '../runtime/app/composables/toc.js';
|
|
19
|
+
export type { ContentSeoImage, ContentSeoMeta, Toc, TocLink } from '../types/content.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export {
|
|
2
|
+
one,
|
|
3
|
+
many,
|
|
4
|
+
paginate,
|
|
5
|
+
backlinks,
|
|
6
|
+
resolveOne,
|
|
7
|
+
variants,
|
|
8
|
+
tree,
|
|
9
|
+
neighbors
|
|
10
|
+
} from "../runtime/app/composables/query-api.js";
|
|
11
|
+
export { getCollectionPath } from "../runtime/query/routes.js";
|
|
12
|
+
export {
|
|
13
|
+
useContentPage,
|
|
14
|
+
useContentOne,
|
|
15
|
+
useContentMany,
|
|
16
|
+
useContentPagination,
|
|
17
|
+
useContentBacklinks,
|
|
18
|
+
useContentResolveOne,
|
|
19
|
+
useContentVariants,
|
|
20
|
+
useContentTree,
|
|
21
|
+
useContentNeighbors,
|
|
22
|
+
useContentLocaleSwitch
|
|
23
|
+
} from "../runtime/app/composables/use-content.js";
|
|
24
|
+
export { useContentSearch, useContentSearchData, useContentSearchResults } from "../runtime/app/composables/search.js";
|
|
25
|
+
export { querySiteData } from "../runtime/app/composables/site-data.js";
|
|
26
|
+
export { extractContentToc, useContentToc } from "../runtime/app/composables/toc.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './provider.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './provider-errors.js'
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type ContentProviderErrorCode = 'unknown_provider' | 'unknown_collection' | 'unsupported_provider_operation' | 'unsupported_query_operator' | 'unsupported_query_shape' | 'data_collection_route_access' | 'data_collection_search_access' | 'data_collection_sitemap_access' | 'missing_locale_route' | 'provider_config_missing' | 'provider_module_missing' | 'provider_module_invalid' | 'unsupported_provider_search_index' | 'unsupported_provider_search' | 'unsupported_provider_site_data' | 'unsupported_provider_prerender';
|
|
2
|
+
export declare const createContentProviderError: (code: ContentProviderErrorCode, message: string, details?: Record<string, unknown>) => import("h3").H3Error<{
|
|
3
|
+
code: ContentProviderErrorCode;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createError } from "h3";
|
|
2
|
+
const statusForProviderError = {
|
|
3
|
+
unknown_provider: 400,
|
|
4
|
+
unknown_collection: 400,
|
|
5
|
+
unsupported_provider_operation: 400,
|
|
6
|
+
unsupported_query_operator: 400,
|
|
7
|
+
unsupported_query_shape: 400,
|
|
8
|
+
data_collection_route_access: 400,
|
|
9
|
+
data_collection_search_access: 400,
|
|
10
|
+
data_collection_sitemap_access: 400,
|
|
11
|
+
missing_locale_route: 404,
|
|
12
|
+
provider_config_missing: 500,
|
|
13
|
+
provider_module_missing: 500,
|
|
14
|
+
provider_module_invalid: 500,
|
|
15
|
+
unsupported_provider_search_index: 400,
|
|
16
|
+
unsupported_provider_search: 400,
|
|
17
|
+
unsupported_provider_site_data: 400,
|
|
18
|
+
unsupported_provider_prerender: 400
|
|
19
|
+
};
|
|
20
|
+
export const createContentProviderError = (code, message, details = {}) => createError({
|
|
21
|
+
statusCode: statusForProviderError[code],
|
|
22
|
+
statusMessage: code,
|
|
23
|
+
message,
|
|
24
|
+
data: {
|
|
25
|
+
code,
|
|
26
|
+
...details
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { H3Event } from 'h3';
|
|
2
|
+
import type { ContentQueryResponse } from '../types/api';
|
|
3
|
+
import type { NavItem, ParsedContent } from '../types/content';
|
|
4
|
+
import type { ContentProviderName } from '../types/config';
|
|
5
|
+
import type { ContentCollectionItemSurroundingsOptions, ContentCollectionNavigationOptions, ContentCollectionPageOptions, ContentCollectionRouteMetaOptions, ContentCollectionSearchSectionsOptions, ContentPageResult, ContentQueryBuilderParams, ContentRouteMeta, ContentSearchSection, ContentSitemapEntry } from '../types/query';
|
|
6
|
+
import type { QueryCollectionsSitemapEntriesOptions } from '../features/sitemap/query';
|
|
7
|
+
import type { ContentProviderSearchRequest, ContentSearchResult } from '../types/search';
|
|
8
|
+
export interface ContentCacheHint {
|
|
9
|
+
tags?: string[];
|
|
10
|
+
paths?: string[];
|
|
11
|
+
maxAge?: number;
|
|
12
|
+
swr?: number;
|
|
13
|
+
etag?: string;
|
|
14
|
+
lastModified?: Date;
|
|
15
|
+
}
|
|
16
|
+
export type ContentCacheHintInput = ContentCacheHint | false;
|
|
17
|
+
export declare const contentProviderResultMarker = "__ginkoContentProviderResult";
|
|
18
|
+
export interface ContentProviderResult<T = unknown> {
|
|
19
|
+
readonly [contentProviderResultMarker]: true;
|
|
20
|
+
data: T;
|
|
21
|
+
cache: ContentCacheHintInput;
|
|
22
|
+
}
|
|
23
|
+
export type MaybeContentProviderResult<T = unknown> = T | ContentProviderResult<T>;
|
|
24
|
+
export declare const withContentCache: <T>(data: T, cache: ContentCacheHintInput) => ContentProviderResult<T>;
|
|
25
|
+
export interface ContentCacheInvalidateInput {
|
|
26
|
+
tags?: string[];
|
|
27
|
+
paths?: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface ContentCacheAdapter {
|
|
30
|
+
name: string;
|
|
31
|
+
apply: (event: H3Event, hint: ContentCacheHint) => void | Promise<void>;
|
|
32
|
+
invalidate: (input: ContentCacheInvalidateInput) => Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export interface ContentProviderSiteDataRequest {
|
|
35
|
+
key: string;
|
|
36
|
+
locale?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ContentProviderSiteDataResponse<T = unknown> {
|
|
39
|
+
key?: string;
|
|
40
|
+
locale?: string;
|
|
41
|
+
data?: T | null;
|
|
42
|
+
updatedAt?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface ContentProviderCapabilities {
|
|
45
|
+
routeBackedCollections: boolean;
|
|
46
|
+
dataCollections: boolean;
|
|
47
|
+
localizedRoutes: boolean;
|
|
48
|
+
translatedSlugs: boolean;
|
|
49
|
+
navigation: boolean;
|
|
50
|
+
surroundings: boolean;
|
|
51
|
+
searchSections: boolean;
|
|
52
|
+
sitemap: boolean;
|
|
53
|
+
query: {
|
|
54
|
+
operators: string[];
|
|
55
|
+
limit: boolean;
|
|
56
|
+
skip: boolean;
|
|
57
|
+
count: boolean;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export interface ContentProvider {
|
|
61
|
+
name: ContentProviderName;
|
|
62
|
+
capabilities: ContentProviderCapabilities;
|
|
63
|
+
query: <T = ParsedContent>(event: H3Event, query: ContentQueryBuilderParams) => Promise<MaybeContentProviderResult<ContentQueryResponse<T> | T[] | T | number | undefined>>;
|
|
64
|
+
navigationQuery?: (event: H3Event, query: ContentQueryBuilderParams) => Promise<MaybeContentProviderResult<NavItem[]>>;
|
|
65
|
+
navigation?: (event: H3Event, collection: string, options?: string[] | ContentCollectionNavigationOptions) => Promise<MaybeContentProviderResult<NavItem[]>>;
|
|
66
|
+
surroundings?: (event: H3Event, collection: string, path: string, options?: ContentCollectionItemSurroundingsOptions) => Promise<MaybeContentProviderResult<Array<NavItem | null>>>;
|
|
67
|
+
searchSections?: (event: H3Event, collection: string, options?: ContentCollectionSearchSectionsOptions) => Promise<MaybeContentProviderResult<ContentSearchSection[]>>;
|
|
68
|
+
search?: (event: H3Event, request: ContentProviderSearchRequest) => Promise<MaybeContentProviderResult<ContentSearchResult[]>>;
|
|
69
|
+
siteData?: <T = unknown>(event: H3Event, request: ContentProviderSiteDataRequest) => Promise<MaybeContentProviderResult<ContentProviderSiteDataResponse<T>>>;
|
|
70
|
+
page?: <T = ParsedContent>(event: H3Event, collection: string, routeOrPath?: string, options?: ContentCollectionPageOptions) => Promise<MaybeContentProviderResult<ContentPageResult<T> | null>>;
|
|
71
|
+
routeMeta?: (event: H3Event, collection: string, routeOrPath?: string, options?: ContentCollectionRouteMetaOptions) => Promise<MaybeContentProviderResult<ContentRouteMeta | null>>;
|
|
72
|
+
sitemapEntries?: (event: H3Event, options?: QueryCollectionsSitemapEntriesOptions) => Promise<MaybeContentProviderResult<ContentSitemapEntry[]>>;
|
|
73
|
+
invalidate?: (event: H3Event, input: ContentCacheInvalidateInput) => Promise<void>;
|
|
74
|
+
}
|