@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,63 @@
|
|
|
1
|
+
import type { ParsedContent } from '../../types/content';
|
|
2
|
+
import type { ContentPageResult, ContentRouteMeta } from '../../types/query';
|
|
3
|
+
import { type GenerateSearchSectionsOptions } from '../search/sections';
|
|
4
|
+
import type { RuntimeContentI18nInput } from '../localization/config';
|
|
5
|
+
export interface CollectionResolveRuntime extends RuntimeContentI18nInput {
|
|
6
|
+
localeFallback?: Record<string, string[]>;
|
|
7
|
+
translatedSlugs?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const resolveCollectionNavigationData: (_collection: string, _runtime: CollectionResolveRuntime, options: {
|
|
10
|
+
fields?: string[];
|
|
11
|
+
locale?: string;
|
|
12
|
+
canonical?: boolean;
|
|
13
|
+
activeLocale?: string;
|
|
14
|
+
loadNavigation: () => Promise<any[]>;
|
|
15
|
+
}) => Promise<any[]>;
|
|
16
|
+
export declare const resolveCollectionItemSurroundingsData: (collection: string, path: string, runtime: CollectionResolveRuntime, options: {
|
|
17
|
+
before?: number;
|
|
18
|
+
after?: number;
|
|
19
|
+
fields?: string[];
|
|
20
|
+
locale?: string;
|
|
21
|
+
canonical?: boolean;
|
|
22
|
+
activeLocale?: string;
|
|
23
|
+
loadNavigation: (options: {
|
|
24
|
+
fields?: string[];
|
|
25
|
+
locale?: string;
|
|
26
|
+
canonical?: boolean;
|
|
27
|
+
}) => Promise<any[]>;
|
|
28
|
+
}) => Promise<(import("../../types/content").NavItem | null)[]>;
|
|
29
|
+
export declare const resolveCollectionSearchSectionsData: (collection: string, runtime: CollectionResolveRuntime, options: (GenerateSearchSectionsOptions & {
|
|
30
|
+
locale?: string;
|
|
31
|
+
canonical?: boolean;
|
|
32
|
+
activeLocale?: string;
|
|
33
|
+
}) & {
|
|
34
|
+
loadPages: (extraFields: string[]) => Promise<Array<Pick<ParsedContent, "_path" | "title" | "description" | "body"> & Record<string, unknown>>>;
|
|
35
|
+
}) => Promise<{
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
titles: string[];
|
|
39
|
+
level: number;
|
|
40
|
+
content: string;
|
|
41
|
+
}[]>;
|
|
42
|
+
export declare const resolveCollectionPageData: <T = ParsedContent>(collection: string, routeOrPath: string | undefined, runtime: CollectionResolveRuntime, options: {
|
|
43
|
+
locale?: string;
|
|
44
|
+
fallback?: string[] | boolean;
|
|
45
|
+
canonical?: boolean;
|
|
46
|
+
fallbackRoute?: string;
|
|
47
|
+
loadVariantPage: (input: {
|
|
48
|
+
path: string;
|
|
49
|
+
locale?: string;
|
|
50
|
+
fallback?: string[] | boolean;
|
|
51
|
+
}) => Promise<(T & ParsedContent) | null>;
|
|
52
|
+
loadPathPage: (path: string) => Promise<(T & ParsedContent) | null>;
|
|
53
|
+
}) => Promise<ContentPageResult<T> | null>;
|
|
54
|
+
export declare const resolveCollectionRouteMetaData: (collection: string, runtime: CollectionResolveRuntime, options: {
|
|
55
|
+
routeOrPath?: string;
|
|
56
|
+
locale?: string;
|
|
57
|
+
fallback?: string[] | boolean;
|
|
58
|
+
loadPage: (routeOrPath?: string, options?: {
|
|
59
|
+
locale?: string;
|
|
60
|
+
fallback?: string[] | boolean;
|
|
61
|
+
canonical?: boolean;
|
|
62
|
+
}) => Promise<ContentPageResult<any> | null>;
|
|
63
|
+
}) => Promise<ContentRouteMeta | null>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createCollectionSurroundings } from "../navigation/tree.js";
|
|
2
|
+
import { createSearchSections } from "../search/sections.js";
|
|
3
|
+
import { normalizeContentPath, resolveCollectionI18n, resolveRouteContent } from "../localization/path.js";
|
|
4
|
+
import { createRouteMeta, localizePageResult, localizeSearchSections } from "../localization/results.js";
|
|
5
|
+
export const resolveCollectionNavigationData = async (_collection, _runtime, options) => {
|
|
6
|
+
return await options.loadNavigation();
|
|
7
|
+
};
|
|
8
|
+
export const resolveCollectionItemSurroundingsData = async (collection, path, runtime, options) => {
|
|
9
|
+
const { locales, defaultLocale } = resolveCollectionI18n(collection, runtime);
|
|
10
|
+
const resolved = resolveRouteContent(path, locales, defaultLocale, options.locale);
|
|
11
|
+
const navigation = await options.loadNavigation({
|
|
12
|
+
fields: options.fields || [],
|
|
13
|
+
locale: resolved.locale || options.activeLocale,
|
|
14
|
+
canonical: options.canonical
|
|
15
|
+
});
|
|
16
|
+
const localizedPath = options.canonical ? normalizeContentPath(resolved.path) : normalizeContentPath(resolved.routePath);
|
|
17
|
+
return createCollectionSurroundings(navigation, localizedPath, options);
|
|
18
|
+
};
|
|
19
|
+
export const resolveCollectionSearchSectionsData = async (collection, runtime, options) => {
|
|
20
|
+
const { locales, defaultLocale } = resolveCollectionI18n(collection, runtime);
|
|
21
|
+
const locale = options.locale || options.activeLocale || defaultLocale;
|
|
22
|
+
const pages = await options.loadPages(options.extraFields || []);
|
|
23
|
+
const sections = createSearchSections(pages, options);
|
|
24
|
+
return options.canonical ? sections : localizeSearchSections(sections, locale, defaultLocale, locales);
|
|
25
|
+
};
|
|
26
|
+
export const resolveCollectionPageData = async (collection, routeOrPath, runtime, options) => {
|
|
27
|
+
const { locales, defaultLocale } = resolveCollectionI18n(collection, runtime);
|
|
28
|
+
const targetPath = routeOrPath || options.fallbackRoute || "/";
|
|
29
|
+
const resolved = resolveRouteContent(targetPath, locales, defaultLocale, options.locale);
|
|
30
|
+
const shouldResolveVariant = Boolean(locales.length || runtime.translatedSlugs || Object.keys(runtime.localeFallback || {}).length);
|
|
31
|
+
const page = shouldResolveVariant ? await options.loadVariantPage({
|
|
32
|
+
path: resolved.path,
|
|
33
|
+
locale: resolved.locale,
|
|
34
|
+
fallback: options.fallback ?? (resolved.locale && runtime.localeFallback?.[resolved.locale] || [])
|
|
35
|
+
}) : await options.loadPathPage(resolved.path);
|
|
36
|
+
if (!page) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
if (options.canonical) {
|
|
40
|
+
const canonicalPath = normalizeContentPath(page._path || "/");
|
|
41
|
+
const resolvedLocale = page._resolvedLocale || page._locale || resolved.locale || defaultLocale || "";
|
|
42
|
+
const requestedLocale = page._requestedLocale || resolved.locale;
|
|
43
|
+
const fallback = Boolean(page._fallback || requestedLocale && resolvedLocale && requestedLocale !== resolvedLocale);
|
|
44
|
+
return {
|
|
45
|
+
...page,
|
|
46
|
+
path: canonicalPath,
|
|
47
|
+
canonicalPath,
|
|
48
|
+
locale: resolved.locale || resolvedLocale,
|
|
49
|
+
defaultLocale: defaultLocale || "",
|
|
50
|
+
variants: [],
|
|
51
|
+
localePaths: {},
|
|
52
|
+
resolved: {
|
|
53
|
+
locale: resolvedLocale,
|
|
54
|
+
...requestedLocale ? { requestedLocale } : {},
|
|
55
|
+
fallback,
|
|
56
|
+
...fallback ? { fallbackLocale: resolvedLocale } : {},
|
|
57
|
+
path: canonicalPath,
|
|
58
|
+
...page._requestedPath ? { requestedPath: page._requestedPath } : {},
|
|
59
|
+
...page._requestedRoute ? { requestedRoute: page._requestedRoute } : {},
|
|
60
|
+
...page._requestedRef ? { requestedRef: page._requestedRef } : {},
|
|
61
|
+
availableLocales: page._availableLocales || Object.keys(page._variantPaths || {})
|
|
62
|
+
},
|
|
63
|
+
stem: canonicalPath.replace(/^\/+/, "") || "index",
|
|
64
|
+
extension: page._extension
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return localizePageResult(page, resolved.locale, defaultLocale, locales);
|
|
68
|
+
};
|
|
69
|
+
export const resolveCollectionRouteMetaData = async (collection, runtime, options) => {
|
|
70
|
+
const page = await options.loadPage(options.routeOrPath, { locale: options.locale, fallback: options.fallback });
|
|
71
|
+
if (!page) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const { defaultLocale } = resolveCollectionI18n(collection, runtime);
|
|
75
|
+
return createRouteMeta(page, page.locale, defaultLocale);
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './config.js'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ContentCollectionI18nConfig } from '../../types/config';
|
|
2
|
+
export interface ContentI18nConfigInput {
|
|
3
|
+
defaultLocale?: string;
|
|
4
|
+
locales?: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface CollectionI18nInput {
|
|
7
|
+
source?: string | string[];
|
|
8
|
+
i18n?: true | ContentI18nConfigInput;
|
|
9
|
+
}
|
|
10
|
+
export type RuntimeCollectionI18nInput = CollectionI18nInput;
|
|
11
|
+
export interface RuntimeContentI18nInput extends ContentI18nConfigInput {
|
|
12
|
+
collections?: Record<string, RuntimeCollectionI18nInput | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare const normalizeI18nConfig: (config?: ContentI18nConfigInput) => ContentCollectionI18nConfig | undefined;
|
|
15
|
+
export declare const resolveCollectionI18nConfig: (collection?: CollectionI18nInput, globalI18n?: ContentI18nConfigInput, options?: {
|
|
16
|
+
warnMissingGlobal?: boolean;
|
|
17
|
+
}) => ContentCollectionI18nConfig | undefined;
|
|
18
|
+
export declare const resolveRuntimeCollectionI18nConfig: (collection: string, content: RuntimeContentI18nInput) => ContentCollectionI18nConfig | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const normalizeI18nConfig = (config) => {
|
|
2
|
+
if (!config?.defaultLocale || !config.locales?.length) {
|
|
3
|
+
return void 0;
|
|
4
|
+
}
|
|
5
|
+
return {
|
|
6
|
+
defaultLocale: config.defaultLocale,
|
|
7
|
+
locales: config.locales
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export const resolveCollectionI18nConfig = (collection, globalI18n, options = {}) => {
|
|
11
|
+
if (collection?.i18n && collection.i18n !== true) {
|
|
12
|
+
return normalizeI18nConfig(collection.i18n);
|
|
13
|
+
}
|
|
14
|
+
const inherited = normalizeI18nConfig(globalI18n);
|
|
15
|
+
if (inherited) {
|
|
16
|
+
return inherited;
|
|
17
|
+
}
|
|
18
|
+
if (collection?.i18n === true && options.warnMissingGlobal) {
|
|
19
|
+
console.warn(`[content] Collection source "${collection.source}" set i18n: true but no content.i18n config was found in nuxt.config.ts. i18n is disabled for this collection.`);
|
|
20
|
+
}
|
|
21
|
+
return void 0;
|
|
22
|
+
};
|
|
23
|
+
export const resolveRuntimeCollectionI18nConfig = (collection, content) => {
|
|
24
|
+
return resolveCollectionI18nConfig(content.collections?.[collection], content);
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './links.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const localizeLinkProps: (props: Record<string, unknown>, locale?: string, defaultLocale?: string, locales?: string[]) => void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { localizePath } from "./path.js";
|
|
2
|
+
const LOCALIZED_PROP_KEYS = /* @__PURE__ */ new Set(["href", "to", "path", "_path"]);
|
|
3
|
+
const LOCALIZED_BOUND_PREFIXES = [":", "v-bind:"];
|
|
4
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
+
const getBoundPropName = (key) => {
|
|
6
|
+
for (const prefix of LOCALIZED_BOUND_PREFIXES) {
|
|
7
|
+
if (key.startsWith(prefix)) {
|
|
8
|
+
return key.slice(prefix.length);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
};
|
|
13
|
+
const localizeSerializedBoundProp = (key, value, locale, defaultLocale, locales = []) => {
|
|
14
|
+
const boundProp = getBoundPropName(key);
|
|
15
|
+
if (!boundProp) {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(value);
|
|
20
|
+
if (typeof parsed === "string" && LOCALIZED_PROP_KEYS.has(boundProp)) {
|
|
21
|
+
return JSON.stringify(localizePath(parsed, locale, defaultLocale, locales));
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(parsed)) {
|
|
24
|
+
for (const item of parsed) {
|
|
25
|
+
if (isRecord(item)) {
|
|
26
|
+
localizeLinkProps(item, locale, defaultLocale, locales);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return JSON.stringify(parsed);
|
|
30
|
+
}
|
|
31
|
+
if (isRecord(parsed)) {
|
|
32
|
+
localizeLinkProps(parsed, locale, defaultLocale, locales);
|
|
33
|
+
return JSON.stringify(parsed);
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
};
|
|
40
|
+
const localizeDirectLinkKeys = (props, locale, defaultLocale, locales = []) => {
|
|
41
|
+
for (const [key, value] of Object.entries(props)) {
|
|
42
|
+
if (typeof value === "string" && LOCALIZED_PROP_KEYS.has(key)) {
|
|
43
|
+
props[key] = localizePath(value, locale, defaultLocale, locales);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (typeof value === "string") {
|
|
47
|
+
const localizedValue = localizeSerializedBoundProp(key, value, locale, defaultLocale, locales);
|
|
48
|
+
if (localizedValue !== value) {
|
|
49
|
+
props[key] = localizedValue;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export const localizeLinkProps = (props, locale, defaultLocale, locales = []) => {
|
|
55
|
+
localizeDirectLinkKeys(props, locale, defaultLocale, locales);
|
|
56
|
+
for (const value of Object.values(props)) {
|
|
57
|
+
if (Array.isArray(value)) {
|
|
58
|
+
for (const item of value) {
|
|
59
|
+
if (isRecord(item)) {
|
|
60
|
+
localizeLinkProps(item, locale, defaultLocale, locales);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (isRecord(value)) {
|
|
66
|
+
localizeLinkProps(value, locale, defaultLocale, locales);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './path.js'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type RuntimeContentI18nInput } from './config';
|
|
2
|
+
import { mountContentPath, normalizeContentPath, normalizeRouteMounts, prefixPathWithLocale, projectContentPathToLocale, routeRemainder, routeToContentPathCandidates, stripLocalePrefix, type RouteMounts } from '../../core/content/path';
|
|
3
|
+
export { mountContentPath, normalizeContentPath, normalizeRouteMounts, prefixPathWithLocale, projectContentPathToLocale, routeRemainder, routeToContentPathCandidates, stripLocalePrefix, type RouteMounts };
|
|
4
|
+
export declare const fallbackStem: (path: string) => string;
|
|
5
|
+
export declare const getContentStem: (path: string, file?: string) => string;
|
|
6
|
+
export declare const resolveCollectionI18n: (collection: string, content: RuntimeContentI18nInput) => {
|
|
7
|
+
locales: string[];
|
|
8
|
+
defaultLocale: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Split a URL path into its locale prefix and underlying content path.
|
|
12
|
+
*
|
|
13
|
+
* Example: `/de/guide/intro` with locales `['de', 'en']` and defaultLocale `en`
|
|
14
|
+
* returns `{ locale: 'de', path: '/guide/intro', routePath: '/de/guide/intro' }`.
|
|
15
|
+
*
|
|
16
|
+
* `explicitLocale` wins over the path-derived locale when provided - callers
|
|
17
|
+
* that know the active locale should pass it so `/guide/intro` is treated as
|
|
18
|
+
* the default-locale variant rather than an unprefixed non-default page.
|
|
19
|
+
*/
|
|
20
|
+
export declare const resolveRouteContent: (path: string, locales?: string[], defaultLocale?: string, explicitLocale?: string) => {
|
|
21
|
+
locale: string | undefined;
|
|
22
|
+
path: string;
|
|
23
|
+
routePath: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Add a locale prefix to a link-like string, preserving any `?query#hash` suffix.
|
|
27
|
+
*
|
|
28
|
+
* Returns `value` unchanged when the string is not a locale-able path:
|
|
29
|
+
* external/protocol-relative URLs, already locale-prefixed URLs, reserved API
|
|
30
|
+
* prefixes, and file-extension assets.
|
|
31
|
+
*/
|
|
32
|
+
export declare const localizePath: (value: string | undefined, locale?: string, defaultLocale?: string, locales?: string[]) => string | undefined;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { resolveRuntimeCollectionI18nConfig } from "./config.js";
|
|
2
|
+
import {
|
|
3
|
+
mountContentPath,
|
|
4
|
+
normalizeContentPath,
|
|
5
|
+
normalizeRouteMounts,
|
|
6
|
+
pathHasLocalePrefix,
|
|
7
|
+
prefixPathWithLocale,
|
|
8
|
+
projectContentPathToLocale,
|
|
9
|
+
routeRemainder,
|
|
10
|
+
routeToContentPathCandidates,
|
|
11
|
+
stripLocalePrefix
|
|
12
|
+
} from "../../core/content/path";
|
|
13
|
+
export {
|
|
14
|
+
mountContentPath,
|
|
15
|
+
normalizeContentPath,
|
|
16
|
+
normalizeRouteMounts,
|
|
17
|
+
prefixPathWithLocale,
|
|
18
|
+
projectContentPathToLocale,
|
|
19
|
+
routeRemainder,
|
|
20
|
+
routeToContentPathCandidates,
|
|
21
|
+
stripLocalePrefix
|
|
22
|
+
};
|
|
23
|
+
const NON_LOCALIZED_PREFIXES = ["/api", "/llms", "/raw"];
|
|
24
|
+
const HAS_FILE_EXTENSION = /\/[^/]+\.[^/]+$/;
|
|
25
|
+
const stripExtension = (file) => file?.replace(/\.[^/.]+$/, "") || "";
|
|
26
|
+
export const fallbackStem = (path) => {
|
|
27
|
+
if (path === "/") {
|
|
28
|
+
return "index";
|
|
29
|
+
}
|
|
30
|
+
return `${path.replace(/^\/+/, "")}/index`;
|
|
31
|
+
};
|
|
32
|
+
export const getContentStem = (path, file) => stripExtension(file) || fallbackStem(path);
|
|
33
|
+
export const resolveCollectionI18n = (collection, content) => {
|
|
34
|
+
const resolved = resolveRuntimeCollectionI18nConfig(collection, content);
|
|
35
|
+
return {
|
|
36
|
+
locales: resolved?.locales || [],
|
|
37
|
+
defaultLocale: resolved?.defaultLocale
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export const resolveRouteContent = (path, locales = [], defaultLocale, explicitLocale) => {
|
|
41
|
+
const normalized = normalizeContentPath(path);
|
|
42
|
+
const segments = normalized.split("/").filter(Boolean);
|
|
43
|
+
const routeLocale = segments[0] && locales.includes(segments[0]) && segments[0] !== defaultLocale ? segments[0] : void 0;
|
|
44
|
+
const locale = explicitLocale && locales.includes(explicitLocale) ? explicitLocale : routeLocale || defaultLocale;
|
|
45
|
+
const contentPath = routeLocale ? normalizeContentPath("/" + segments.slice(1).join("/")) : normalized;
|
|
46
|
+
return {
|
|
47
|
+
locale,
|
|
48
|
+
path: contentPath || "/",
|
|
49
|
+
routePath: normalized
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const splitPathSuffix = (value) => {
|
|
53
|
+
const match = value.match(/^([^?#]*)(.*)$/);
|
|
54
|
+
return {
|
|
55
|
+
pathname: match?.[1] || value,
|
|
56
|
+
suffix: match?.[2] || ""
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const shouldLocalizePath = (value, locales) => {
|
|
60
|
+
if (!value || !value.startsWith("/")) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (value.startsWith("//")) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
if (pathHasLocalePrefix(value, locales)) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return !NON_LOCALIZED_PREFIXES.some((prefix) => value === prefix || value.startsWith(`${prefix}/`)) && !HAS_FILE_EXTENSION.test(value);
|
|
70
|
+
};
|
|
71
|
+
export const localizePath = (value, locale, defaultLocale, locales = []) => {
|
|
72
|
+
if (!value) {
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
const { pathname, suffix } = splitPathSuffix(value);
|
|
76
|
+
if (!shouldLocalizePath(pathname, locales)) {
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
return `${prefixPathWithLocale(pathname, locale, defaultLocale)}${suffix}`;
|
|
80
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './results.js'
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ContentNavigationItem, ParsedContent } from '../../types/content';
|
|
2
|
+
import type { ContentLocaleEntry, ContentPageResult, ContentRouteMeta, LocalePathEntry } from '../../types/query';
|
|
3
|
+
import type { SearchSection } from '../search/sections';
|
|
4
|
+
import { type RouteMounts } from './path';
|
|
5
|
+
export declare const createLocaleVariants: (variants: Record<string, string> | ContentLocaleEntry[] | undefined, defaultLocale?: string, routeMounts?: RouteMounts) => {
|
|
6
|
+
locale: string;
|
|
7
|
+
canonicalPath: string;
|
|
8
|
+
path: string;
|
|
9
|
+
}[];
|
|
10
|
+
/**
|
|
11
|
+
* Build the per-locale path map attached to localized documents.
|
|
12
|
+
*
|
|
13
|
+
* `variants` here only enumerates locales that actually have a concrete
|
|
14
|
+
* variant — `translated` is therefore always `true` in this map. When a
|
|
15
|
+
* caller (e.g. `localizePageResultWithFallbacks`) wants to expose every
|
|
16
|
+
* configured locale (including ones backed by fallback), it should fill in
|
|
17
|
+
* the missing entries with `{ path: <fallback path>, translated: false, fallback }`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const createLocalePaths: (variants: ReturnType<typeof createLocaleVariants>) => Record<string, LocalePathEntry>;
|
|
20
|
+
/**
|
|
21
|
+
* Decorate a `localePaths` map so every configured locale has an entry. Any
|
|
22
|
+
* locale missing a concrete variant is back-filled with the fallback locale's
|
|
23
|
+
* path and `translated: false`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const decorateLocalePathsWithFallbacks: (localePaths: Record<string, LocalePathEntry>, configuredLocales: string[], fallbackLocale?: string, defaultLocale?: string, routeMounts?: RouteMounts) => Record<string, LocalePathEntry>;
|
|
26
|
+
/**
|
|
27
|
+
* Shape a parsed page into the `ContentPageResult` used by current route
|
|
28
|
+
* helpers: locale-prefixed route path, variants,
|
|
29
|
+
* localePaths, and localized top-level link metadata. The page body is never
|
|
30
|
+
* mutated.
|
|
31
|
+
*/
|
|
32
|
+
export declare const localizePageResult: <T extends ParsedContent & Record<string, unknown>>(page: T, locale?: string, defaultLocale?: string, locales?: string[], routeMounts?: RouteMounts) => ContentPageResult<T>;
|
|
33
|
+
export declare const localizeNavigation: (navigation?: ContentNavigationItem[], locale?: string, defaultLocale?: string, locales?: string[], routeMounts?: RouteMounts) => import("../../types/content").NavItem[];
|
|
34
|
+
export declare const localizeSurround: <T extends Record<string, unknown>>(items?: Array<T | null>, locale?: string, defaultLocale?: string, _locales?: string[], routeMounts?: RouteMounts) => Array<T | null>;
|
|
35
|
+
export declare const localizeSearchSections: (sections?: SearchSection[], locale?: string, defaultLocale?: string, locales?: string[]) => {
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
titles: string[];
|
|
39
|
+
level: number;
|
|
40
|
+
content: string;
|
|
41
|
+
}[];
|
|
42
|
+
export declare const createRouteMeta: <T extends ParsedContent & Record<string, unknown>>(page: T, locale?: string, defaultLocale?: string, routeMounts?: RouteMounts) => ContentRouteMeta;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { localizeLinkProps } from "./links.js";
|
|
2
|
+
import { getContentStem, localizePath, normalizeContentPath, projectContentPathToLocale } from "./path.js";
|
|
3
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
export const createLocaleVariants = (variants, defaultLocale, routeMounts) => {
|
|
5
|
+
if (!variants) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
const entries = Array.isArray(variants) ? variants : Object.entries(variants).map(([locale, path]) => ({
|
|
9
|
+
canonicalKey: path,
|
|
10
|
+
locale,
|
|
11
|
+
path
|
|
12
|
+
}));
|
|
13
|
+
return entries.filter((entry) => entry.path).map((entry) => ({
|
|
14
|
+
locale: entry.locale,
|
|
15
|
+
canonicalPath: normalizeContentPath(entry.path || "/"),
|
|
16
|
+
path: projectContentPathToLocale(entry.path || "/", entry.locale, defaultLocale, routeMounts)
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
export const createLocalePaths = (variants) => {
|
|
20
|
+
return Object.fromEntries(
|
|
21
|
+
variants.map((variant) => [variant.locale, { path: variant.path, translated: true }])
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
export const decorateLocalePathsWithFallbacks = (localePaths, configuredLocales, fallbackLocale, defaultLocale, routeMounts) => {
|
|
25
|
+
if (!configuredLocales.length) {
|
|
26
|
+
return localePaths;
|
|
27
|
+
}
|
|
28
|
+
const result = { ...localePaths };
|
|
29
|
+
const fallbackPath = fallbackLocale ? localePaths[fallbackLocale]?.path : void 0;
|
|
30
|
+
for (const locale of configuredLocales) {
|
|
31
|
+
if (result[locale]) continue;
|
|
32
|
+
if (fallbackLocale && fallbackPath) {
|
|
33
|
+
result[locale] = {
|
|
34
|
+
path: projectContentPathToLocale(fallbackPath, locale, defaultLocale, routeMounts),
|
|
35
|
+
translated: false,
|
|
36
|
+
fallback: fallbackLocale
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
export const localizePageResult = (page, locale, defaultLocale, locales = [], routeMounts) => {
|
|
43
|
+
const canonicalPath = normalizeContentPath(page._path || "/");
|
|
44
|
+
const variants = createLocaleVariants(page._variantPaths, defaultLocale, routeMounts);
|
|
45
|
+
const path = projectContentPathToLocale(canonicalPath, locale || page._resolvedLocale || page._locale, defaultLocale, routeMounts);
|
|
46
|
+
const resolvedLocale = page._resolvedLocale || page._locale || locale || defaultLocale || "";
|
|
47
|
+
const requestedLocale = page._requestedLocale || locale;
|
|
48
|
+
const fallback = Boolean(page._fallback || requestedLocale && resolvedLocale && requestedLocale !== resolvedLocale);
|
|
49
|
+
const result = {
|
|
50
|
+
...page,
|
|
51
|
+
path,
|
|
52
|
+
canonicalPath,
|
|
53
|
+
locale: locale || page._resolvedLocale || page._locale || defaultLocale || "",
|
|
54
|
+
defaultLocale: defaultLocale || "",
|
|
55
|
+
variants,
|
|
56
|
+
localePaths: createLocalePaths(variants),
|
|
57
|
+
resolved: {
|
|
58
|
+
locale: resolvedLocale,
|
|
59
|
+
...requestedLocale ? { requestedLocale } : {},
|
|
60
|
+
fallback,
|
|
61
|
+
...fallback ? { fallbackLocale: resolvedLocale } : {},
|
|
62
|
+
path,
|
|
63
|
+
...page._requestedPath ? { requestedPath: page._requestedPath } : {},
|
|
64
|
+
...page._requestedRoute ? { requestedRoute: page._requestedRoute } : {},
|
|
65
|
+
...page._requestedRef ? { requestedRef: page._requestedRef } : {},
|
|
66
|
+
availableLocales: page._availableLocales || Object.keys(page._variantPaths || {})
|
|
67
|
+
},
|
|
68
|
+
stem: getContentStem(canonicalPath, page._file),
|
|
69
|
+
extension: page._extension
|
|
70
|
+
};
|
|
71
|
+
const links = result.links;
|
|
72
|
+
if (Array.isArray(links)) {
|
|
73
|
+
;
|
|
74
|
+
result.links = links.map((link) => {
|
|
75
|
+
if (!isRecord(link)) {
|
|
76
|
+
return link;
|
|
77
|
+
}
|
|
78
|
+
const localizedLink = structuredClone(link);
|
|
79
|
+
localizeLinkProps(localizedLink, locale, defaultLocale, locales);
|
|
80
|
+
return localizedLink;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
};
|
|
85
|
+
const localizeNavigationItem = (item, locale, defaultLocale, locales = [], routeMounts) => {
|
|
86
|
+
const rawPath = typeof item._path === "string" ? item._path : typeof item.path === "string" ? item.path : void 0;
|
|
87
|
+
if (!rawPath) {
|
|
88
|
+
return {
|
|
89
|
+
...item,
|
|
90
|
+
children: item.children?.map((child) => localizeNavigationItem(child, locale, defaultLocale, locales, routeMounts))
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const canonicalPath = normalizeContentPath(rawPath);
|
|
94
|
+
const localizedPath = projectContentPathToLocale(canonicalPath, locale, defaultLocale, routeMounts);
|
|
95
|
+
const file = typeof item._file === "string" ? item._file : void 0;
|
|
96
|
+
return {
|
|
97
|
+
...item,
|
|
98
|
+
_path: canonicalPath,
|
|
99
|
+
path: localizedPath,
|
|
100
|
+
canonicalPath,
|
|
101
|
+
stem: item.stem || getContentStem(canonicalPath, file),
|
|
102
|
+
children: item.children?.map((child) => localizeNavigationItem(child, locale, defaultLocale, locales, routeMounts))
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export const localizeNavigation = (navigation = [], locale, defaultLocale, locales = [], routeMounts) => navigation.map((item) => localizeNavigationItem(item, locale, defaultLocale, locales, routeMounts));
|
|
106
|
+
export const localizeSurround = (items = [], locale, defaultLocale, _locales = [], routeMounts) => items.map((item) => {
|
|
107
|
+
if (!item) {
|
|
108
|
+
return item;
|
|
109
|
+
}
|
|
110
|
+
const canonicalPath = normalizeContentPath(String(item._path || item.path || "/"));
|
|
111
|
+
return {
|
|
112
|
+
...item,
|
|
113
|
+
_path: canonicalPath,
|
|
114
|
+
path: projectContentPathToLocale(canonicalPath, locale, defaultLocale, routeMounts),
|
|
115
|
+
canonicalPath,
|
|
116
|
+
stem: item.stem || getContentStem(canonicalPath, typeof item._file === "string" ? item._file : void 0)
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
export const localizeSearchSections = (sections = [], locale, defaultLocale, locales = []) => sections.map((section) => ({
|
|
120
|
+
...section,
|
|
121
|
+
id: localizePath(section.id, locale, defaultLocale, locales) || section.id
|
|
122
|
+
}));
|
|
123
|
+
export const createRouteMeta = (page, locale, defaultLocale, routeMounts) => {
|
|
124
|
+
const canonicalPath = normalizeContentPath(page._path || "/");
|
|
125
|
+
const resolvedLocale = page._resolvedLocale || page._locale || locale || defaultLocale || "";
|
|
126
|
+
const requestedLocale = page._requestedLocale || locale;
|
|
127
|
+
const fallback = Boolean(page._fallback || requestedLocale && resolvedLocale && requestedLocale !== resolvedLocale);
|
|
128
|
+
const variants = createLocaleVariants(page._variantPaths, defaultLocale, routeMounts);
|
|
129
|
+
const path = projectContentPathToLocale(canonicalPath, locale || resolvedLocale, defaultLocale, routeMounts);
|
|
130
|
+
return {
|
|
131
|
+
locale: locale || resolvedLocale,
|
|
132
|
+
defaultLocale: defaultLocale || "",
|
|
133
|
+
path,
|
|
134
|
+
canonicalPath,
|
|
135
|
+
variants,
|
|
136
|
+
localePaths: createLocalePaths(variants),
|
|
137
|
+
resolved: {
|
|
138
|
+
locale: resolvedLocale,
|
|
139
|
+
...requestedLocale ? { requestedLocale } : {},
|
|
140
|
+
fallback,
|
|
141
|
+
...fallback ? { fallbackLocale: resolvedLocale } : {},
|
|
142
|
+
path,
|
|
143
|
+
...page._requestedPath ? { requestedPath: page._requestedPath } : {},
|
|
144
|
+
...page._requestedRoute ? { requestedRoute: page._requestedRoute } : {},
|
|
145
|
+
...page._requestedRef ? { requestedRef: page._requestedRef } : {},
|
|
146
|
+
availableLocales: page._availableLocales || Object.keys(page._variantPaths || {})
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './translated-slugs.js'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParsedContent } from '../../types/content';
|
|
2
|
+
export type TranslatedSlugValidationIssue = {
|
|
3
|
+
level: 'warn' | 'error';
|
|
4
|
+
file: string;
|
|
5
|
+
reason: string;
|
|
6
|
+
details?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const collectTranslatedSlugValidationIssues: (contents: ParsedContent[], options: {
|
|
9
|
+
translatedSlugs?: boolean;
|
|
10
|
+
locales?: string[];
|
|
11
|
+
}) => TranslatedSlugValidationIssue[];
|