@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,52 @@
|
|
|
1
|
+
import { parse } from "comark";
|
|
2
|
+
import { mapMarkdownNodes, toMarkdownRoot } from "../core/markdown/tree.js";
|
|
3
|
+
export async function parseMdcBody(raw, options = {}) {
|
|
4
|
+
const tree = await parse(raw ?? "");
|
|
5
|
+
const toc = deriveToc(tree.nodes, options);
|
|
6
|
+
const body = toMarkdownRoot(tree.nodes, toc);
|
|
7
|
+
const searchText = renderPlainText(body);
|
|
8
|
+
return { body, toc, searchText };
|
|
9
|
+
}
|
|
10
|
+
function deriveToc(nodes, options) {
|
|
11
|
+
const searchDepth = options.tocDepth ?? 3;
|
|
12
|
+
const links = [];
|
|
13
|
+
for (const node of nodes) {
|
|
14
|
+
if (!Array.isArray(node)) continue;
|
|
15
|
+
const tag = String(node[0] ?? "");
|
|
16
|
+
const match = /^h([1-6])$/.exec(tag);
|
|
17
|
+
if (!match) continue;
|
|
18
|
+
const depth = Number(match[1]);
|
|
19
|
+
if (depth < 2 || depth > searchDepth) continue;
|
|
20
|
+
const props = node[1] && typeof node[1] === "object" ? node[1] : {};
|
|
21
|
+
const children = node.slice(2);
|
|
22
|
+
const text = collectTupleText(children);
|
|
23
|
+
links.push({
|
|
24
|
+
id: String(props.id || slugHeading(text)),
|
|
25
|
+
text,
|
|
26
|
+
depth
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return links.length > 0 ? { title: "", depth: 2, searchDepth, links } : void 0;
|
|
30
|
+
}
|
|
31
|
+
function collectTupleText(nodes) {
|
|
32
|
+
let value = "";
|
|
33
|
+
for (const node of nodes) {
|
|
34
|
+
if (typeof node === "string") {
|
|
35
|
+
value += node;
|
|
36
|
+
} else if (Array.isArray(node)) {
|
|
37
|
+
value += collectTupleText(node.slice(2));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return value.trim();
|
|
41
|
+
}
|
|
42
|
+
function slugHeading(value) {
|
|
43
|
+
return value.toLowerCase().replace(/[^\w\s-]/g, "").trim().replace(/\s+/g, "-");
|
|
44
|
+
}
|
|
45
|
+
function renderPlainText(root) {
|
|
46
|
+
const parts = [];
|
|
47
|
+
mapMarkdownNodes(root.children, (node) => {
|
|
48
|
+
if (node.type === "text" && typeof node.value === "string") parts.push(node.value);
|
|
49
|
+
return node;
|
|
50
|
+
});
|
|
51
|
+
return parts.join(" ").replace(/\s+/g, " ").trim();
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './path.js'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure path helpers re-exported from `ginko-content`'s canonical path engine.
|
|
3
|
+
*
|
|
4
|
+
* The CMS uses these instead of duplicating its own path-generation logic.
|
|
5
|
+
* Per Gate 0 of the refactor: ginko-content owns path semantics; ginko-cms
|
|
6
|
+
* imports them. No more parallel implementations of `generatePath` /
|
|
7
|
+
* `generateCanonicalKey` / `slugifyUrlSegment`.
|
|
8
|
+
*
|
|
9
|
+
* All re-exports MUST be runtime-pure (no Node, no Nuxt, no h3). They are.
|
|
10
|
+
*/
|
|
11
|
+
export { describeId, generatePath, generateCanonicalKey, generateTitle, isDraftPath, isPartialPath, normalizeContentPath, normalizeRouteMounts, longestMountForPath, routeRemainder, mountContentPath, prefixPathWithLocale, stripLocalePrefix, refineUrlPart, routeToContentPathCandidates, } from '../core/content/path.js';
|
|
12
|
+
export { slugifyUrlSegment } from '../core/content/slug.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export {
|
|
2
|
+
describeId,
|
|
3
|
+
generatePath,
|
|
4
|
+
generateCanonicalKey,
|
|
5
|
+
generateTitle,
|
|
6
|
+
isDraftPath,
|
|
7
|
+
isPartialPath,
|
|
8
|
+
normalizeContentPath,
|
|
9
|
+
normalizeRouteMounts,
|
|
10
|
+
longestMountForPath,
|
|
11
|
+
routeRemainder,
|
|
12
|
+
mountContentPath,
|
|
13
|
+
prefixPathWithLocale,
|
|
14
|
+
stripLocalePrefix,
|
|
15
|
+
refineUrlPart,
|
|
16
|
+
routeToContentPathCandidates
|
|
17
|
+
} from "../core/content/path.js";
|
|
18
|
+
export { slugifyUrlSegment } from "../core/content/slug.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './schema.js'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure Zod-schema introspection helpers, re-exported for CMS use.
|
|
3
|
+
*
|
|
4
|
+
* These are how the CMS understands what a collection's `schema` field means:
|
|
5
|
+
* walks down through Optional / Nullable / Default / Effects wrappers,
|
|
6
|
+
* extracts object shapes, recognizes content-reference fields.
|
|
7
|
+
*
|
|
8
|
+
* Pure functions over Zod's internal `_def` shape. No runtime deps beyond
|
|
9
|
+
* the symbols Zod itself exposes.
|
|
10
|
+
*/
|
|
11
|
+
export { getSchemaDef, getSchemaTypeName, unwrapSchema, getObjectShape, getReferenceDescriptor, collectTopLevelReferenceFields, } from '../core/references/schema.js';
|
|
12
|
+
/**
|
|
13
|
+
* Symbol Zod schemas may carry to expose ginko-content's UI metadata
|
|
14
|
+
* (label, description, options, slug source, image/asset constraints, etc.).
|
|
15
|
+
*/
|
|
16
|
+
export { CONTENT_FIELD_METADATA_KEY, type ContentFieldMetadata, type ContentFieldSchema, } from '../types/fields.js';
|
|
17
|
+
export { getContentFieldMetadata } from '../types/fields.js';
|
|
18
|
+
export { CONTENT_REFERENCE_PREFIX } from '../types/reference.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export {
|
|
2
|
+
getSchemaDef,
|
|
3
|
+
getSchemaTypeName,
|
|
4
|
+
unwrapSchema,
|
|
5
|
+
getObjectShape,
|
|
6
|
+
getReferenceDescriptor,
|
|
7
|
+
collectTopLevelReferenceFields
|
|
8
|
+
} from "../core/references/schema.js";
|
|
9
|
+
export {
|
|
10
|
+
CONTENT_FIELD_METADATA_KEY
|
|
11
|
+
} from "../types/fields.js";
|
|
12
|
+
export { getContentFieldMetadata } from "../types/fields.js";
|
|
13
|
+
export { CONTENT_REFERENCE_PREFIX } from "../types/reference.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types.js'
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lupinum/ginko-content/cms-contract — pure subpath
|
|
3
|
+
*
|
|
4
|
+
* This module contains the runtime-safe contract types and helpers that
|
|
5
|
+
* `@lupinum/ginko-cms` consumes from inside its Convex component. Everything
|
|
6
|
+
* exported from this subpath MUST be importable from a V8 isolate (Convex,
|
|
7
|
+
* Edge runtime, browser) without pulling Node, Nuxt, h3, nitropack, or
|
|
8
|
+
* filesystem APIs along.
|
|
9
|
+
*
|
|
10
|
+
* Per the ginko-cms refactor plan ("Gate 0 — Lock the boundary"):
|
|
11
|
+
* - `ginko-content` owns content semantics (schema, paths, i18n, MDC parsing).
|
|
12
|
+
* - `ginko-cms` owns editorial workflow (drafts, revisions, publish, assets).
|
|
13
|
+
*
|
|
14
|
+
* The CMS imports from this subpath (NOT from the full Nuxt module) so the two
|
|
15
|
+
* packages share one source of truth for what content means.
|
|
16
|
+
*/
|
|
17
|
+
import type { ContentCmsCollectionConfig, ContentCmsFieldConfig, ContentCmsFieldType, ContentCmsRelationConfig, ContentCollectionConfig, ContentCollectionI18nConfig } from '../types/config.js';
|
|
18
|
+
export type { ContentCmsCollectionConfig, ContentCmsFieldConfig, ContentCmsFieldType, ContentCmsRelationConfig, ContentCollectionConfig, ContentCollectionI18nConfig, };
|
|
19
|
+
/**
|
|
20
|
+
* The normalized contract a CMS consumes for one collection. This is the
|
|
21
|
+
* deterministic output of `buildCmsContract`: every decision the CMS used to
|
|
22
|
+
* infer (label, type, locales, routing, fields) is materialized here so the
|
|
23
|
+
* CMS never has to re-derive content semantics.
|
|
24
|
+
*/
|
|
25
|
+
export interface CmsCollectionContract {
|
|
26
|
+
/** Collection identifier (`blog`, `docs`, ...). */
|
|
27
|
+
slug: string;
|
|
28
|
+
/** Display label, single-string for monolingual sites or per-locale map. */
|
|
29
|
+
label: string | Record<string, string>;
|
|
30
|
+
/** `flat` (e.g. blog posts) or `tree` (e.g. nested docs). */
|
|
31
|
+
type: 'flat' | 'tree';
|
|
32
|
+
/** Optional icon hint for editor surfaces. */
|
|
33
|
+
icon?: string | null;
|
|
34
|
+
/** Locales this collection supplies. Always non-empty; defaults to site default. */
|
|
35
|
+
locales: string[];
|
|
36
|
+
/** Default locale for this collection. */
|
|
37
|
+
defaultLocale: string;
|
|
38
|
+
/** Routing config the public provider will honor. */
|
|
39
|
+
routing: CmsCollectionRouting;
|
|
40
|
+
/** Normalized field set, in stable order. */
|
|
41
|
+
fields: CmsFieldContract[];
|
|
42
|
+
/** Schema artifact reference, if Zod schema was supplied. Validates publish. */
|
|
43
|
+
schema?: CmsSchemaArtifactRef;
|
|
44
|
+
/** Free-form per-collection settings (sitemap, search, etc.). */
|
|
45
|
+
settings?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
export interface CmsCollectionRouting {
|
|
48
|
+
/** `route` exposes the collection at a public URL; `none` keeps it data-only. */
|
|
49
|
+
mode: 'route' | 'none';
|
|
50
|
+
/** Public URL prefix when `mode === 'route'`. Empty for `mode === 'none'`. */
|
|
51
|
+
pathPrefix: string;
|
|
52
|
+
/** Per-locale public URL prefixes for localized route-backed collections. */
|
|
53
|
+
localizedPathPrefixes?: Record<string, string> | null;
|
|
54
|
+
/** Per-locale public paths for localized singleton collections. */
|
|
55
|
+
localizedSingletonPaths?: Record<string, string> | null;
|
|
56
|
+
/** How slugs combine across locales. */
|
|
57
|
+
slugMode: 'shared' | 'localized' | 'stable' | 'localizedStable';
|
|
58
|
+
/** Optional root entry slug (e.g. an "intro" page that owns the prefix root). */
|
|
59
|
+
rootSlug?: string | null;
|
|
60
|
+
/** True when the collection holds exactly one entry. */
|
|
61
|
+
singleton: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface CmsFieldContract {
|
|
64
|
+
key: string;
|
|
65
|
+
type: ContentCmsFieldType;
|
|
66
|
+
label?: string | Record<string, string> | null;
|
|
67
|
+
description?: string | null;
|
|
68
|
+
required: boolean;
|
|
69
|
+
localized: boolean;
|
|
70
|
+
hidden: boolean;
|
|
71
|
+
searchable: boolean;
|
|
72
|
+
sortable: boolean;
|
|
73
|
+
order: number;
|
|
74
|
+
width: 'full' | 'half';
|
|
75
|
+
defaultValue?: unknown;
|
|
76
|
+
options?: string[] | null;
|
|
77
|
+
relation?: ContentCmsRelationConfig | null;
|
|
78
|
+
media?: {
|
|
79
|
+
accept?: string[];
|
|
80
|
+
aspectRatio?: string | null;
|
|
81
|
+
} | null;
|
|
82
|
+
fields?: CmsFieldContract[] | null;
|
|
83
|
+
validation?: Record<string, unknown> | null;
|
|
84
|
+
condition?: Record<string, unknown> | null;
|
|
85
|
+
min?: number | null;
|
|
86
|
+
max?: number | null;
|
|
87
|
+
step?: number | null;
|
|
88
|
+
slugFrom?: string | null;
|
|
89
|
+
language?: string | null;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Reference to a schema validation artifact. The actual artifact (a serialized,
|
|
93
|
+
* checksum-verified validator) is generated at build time by ginko-content and
|
|
94
|
+
* shipped alongside the contract. The CMS reads the checksum to verify the
|
|
95
|
+
* artifact it holds matches the contract it imported.
|
|
96
|
+
*
|
|
97
|
+
* Keeping the artifact behind a ref (rather than embedding it inline) lets the
|
|
98
|
+
* CMS drop the artifact when it doesn't need publish validation (e.g. for a
|
|
99
|
+
* code-only data collection).
|
|
100
|
+
*/
|
|
101
|
+
export interface CmsSchemaArtifactRef {
|
|
102
|
+
/** Stable id used to look up the artifact in the artifact registry. */
|
|
103
|
+
artifactId: string;
|
|
104
|
+
/** Stable checksum of the serialized artifact bytes. */
|
|
105
|
+
checksum: string;
|
|
106
|
+
/** Schema features the artifact actually supports. */
|
|
107
|
+
capabilities: CmsSchemaCapabilities;
|
|
108
|
+
/** Deterministic serialized validation artifact bytes. */
|
|
109
|
+
artifact: string;
|
|
110
|
+
}
|
|
111
|
+
export type CmsSchemaValidationNode = {
|
|
112
|
+
kind: 'object';
|
|
113
|
+
required: string[];
|
|
114
|
+
shape: Record<string, CmsSchemaValidationNode>;
|
|
115
|
+
} | {
|
|
116
|
+
kind: 'array';
|
|
117
|
+
element: CmsSchemaValidationNode;
|
|
118
|
+
} | {
|
|
119
|
+
kind: 'string';
|
|
120
|
+
checks?: Array<{
|
|
121
|
+
kind: 'min';
|
|
122
|
+
value: number;
|
|
123
|
+
} | {
|
|
124
|
+
kind: 'max';
|
|
125
|
+
value: number;
|
|
126
|
+
} | {
|
|
127
|
+
kind: 'email';
|
|
128
|
+
} | {
|
|
129
|
+
kind: 'url';
|
|
130
|
+
}>;
|
|
131
|
+
} | {
|
|
132
|
+
kind: 'number';
|
|
133
|
+
} | {
|
|
134
|
+
kind: 'boolean';
|
|
135
|
+
} | {
|
|
136
|
+
kind: 'date';
|
|
137
|
+
} | {
|
|
138
|
+
kind: 'enum';
|
|
139
|
+
values: string[];
|
|
140
|
+
} | {
|
|
141
|
+
kind: 'optional';
|
|
142
|
+
inner: CmsSchemaValidationNode;
|
|
143
|
+
} | {
|
|
144
|
+
kind: 'nullable';
|
|
145
|
+
inner: CmsSchemaValidationNode;
|
|
146
|
+
} | {
|
|
147
|
+
kind: 'default';
|
|
148
|
+
inner: CmsSchemaValidationNode;
|
|
149
|
+
value: unknown;
|
|
150
|
+
};
|
|
151
|
+
export interface CmsSchemaValidationArtifact {
|
|
152
|
+
version: 'v1';
|
|
153
|
+
root: CmsSchemaValidationNode;
|
|
154
|
+
}
|
|
155
|
+
export interface CmsSchemaCapabilities {
|
|
156
|
+
/** Top-level Zod constructs the artifact understands. */
|
|
157
|
+
supports: Array<'object' | 'array' | 'string' | 'number' | 'boolean' | 'date' | 'enum' | 'optional' | 'nullable' | 'default' | 'reference'>;
|
|
158
|
+
/** Constructs the source schema used that the artifact does NOT support. */
|
|
159
|
+
unsupported: Array<{
|
|
160
|
+
feature: string;
|
|
161
|
+
path: string;
|
|
162
|
+
reason: string;
|
|
163
|
+
}>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Top-level CMS contract: one entry per collection plus site-wide settings.
|
|
167
|
+
*/
|
|
168
|
+
export interface CmsContract {
|
|
169
|
+
/** Schema-version identifier so the CMS can detect a contract upgrade. */
|
|
170
|
+
contractVersion: string;
|
|
171
|
+
/** Site default locale. */
|
|
172
|
+
defaultLocale: string;
|
|
173
|
+
/** Site-wide locale list (superset of any per-collection locale subset). */
|
|
174
|
+
locales: string[];
|
|
175
|
+
/** Collections keyed by slug. */
|
|
176
|
+
collections: Record<string, CmsCollectionContract>;
|
|
177
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.js'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ContentGraph } from '../core/content/graph.js';
|
|
2
|
+
import type { ParsedContent } from '../types/content.js';
|
|
3
|
+
import type { ContentCollectionConfig } from '../types/config.js';
|
|
4
|
+
import type { ContentContext } from '../types/module.js';
|
|
5
|
+
export type CmsImportContentContext = Pick<ContentContext, 'locales' | 'defaultLocale' | 'translatedSlugs' | 'respectPathCase' | 'markdown' | 'yaml' | 'csv'> & {
|
|
6
|
+
collections: Record<string, ContentCollectionConfig>;
|
|
7
|
+
};
|
|
8
|
+
export type CmsImportParsedFile = {
|
|
9
|
+
frontmatter: Record<string, unknown>;
|
|
10
|
+
body?: string;
|
|
11
|
+
document: ParsedContent;
|
|
12
|
+
};
|
|
13
|
+
export declare function parseCmsImportFile(args: {
|
|
14
|
+
id: string;
|
|
15
|
+
source: string;
|
|
16
|
+
context: CmsImportContentContext;
|
|
17
|
+
}): Promise<CmsImportParsedFile>;
|
|
18
|
+
export declare function buildCmsImportGraph(documents: ParsedContent[], options?: {
|
|
19
|
+
locales?: string[];
|
|
20
|
+
defaultLocale?: string;
|
|
21
|
+
}): ContentGraph;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { parse as parseMarkdown } from "comark";
|
|
2
|
+
import { destr } from "destr";
|
|
3
|
+
import { load as parseYaml } from "js-yaml";
|
|
4
|
+
import { buildContentGraph } from "../core/content/graph.js";
|
|
5
|
+
import { resolveCollection } from "../core/content/collection.js";
|
|
6
|
+
import { transformContent } from "../parsers/index.js";
|
|
7
|
+
export async function parseCmsImportFile(args) {
|
|
8
|
+
const document = await transformContent(args.id, args.source, {
|
|
9
|
+
markdown: args.context.markdown,
|
|
10
|
+
yaml: args.context.yaml,
|
|
11
|
+
csv: args.context.csv,
|
|
12
|
+
pathMeta: {
|
|
13
|
+
locales: args.context.locales,
|
|
14
|
+
defaultLocale: args.context.defaultLocale,
|
|
15
|
+
translatedSlugs: args.context.translatedSlugs,
|
|
16
|
+
respectPathCase: args.context.respectPathCase,
|
|
17
|
+
collections: args.context.collections,
|
|
18
|
+
collectionResolver: (filePath) => resolveCollection(filePath, args.context.collections, args.context.locales || [])
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const editable = await extractEditableSource(args.id, args.source);
|
|
22
|
+
return {
|
|
23
|
+
...editable,
|
|
24
|
+
document
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function buildCmsImportGraph(documents, options = {}) {
|
|
28
|
+
return buildContentGraph(documents, options);
|
|
29
|
+
}
|
|
30
|
+
async function extractEditableSource(id, source) {
|
|
31
|
+
if (/\.(md|mdc|markdown)$/i.test(id)) {
|
|
32
|
+
return parseMarkdownEditableSource(source);
|
|
33
|
+
}
|
|
34
|
+
if (/\.json5?$/i.test(id)) {
|
|
35
|
+
return { frontmatter: normalizeRecord(destr(source)) };
|
|
36
|
+
}
|
|
37
|
+
if (/\.ya?ml$/i.test(id)) {
|
|
38
|
+
return { frontmatter: normalizeRecord(parseYaml(source)) };
|
|
39
|
+
}
|
|
40
|
+
return { frontmatter: {} };
|
|
41
|
+
}
|
|
42
|
+
async function parseMarkdownEditableSource(source) {
|
|
43
|
+
const tree = await parseMarkdown(source);
|
|
44
|
+
return {
|
|
45
|
+
frontmatter: normalizeRecord(tree.frontmatter),
|
|
46
|
+
body: stripFrontmatter(source).trim()
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function stripFrontmatter(source) {
|
|
50
|
+
if (!source.startsWith("---")) return source;
|
|
51
|
+
const end = source.indexOf("\n---", 3);
|
|
52
|
+
if (end === -1) return source;
|
|
53
|
+
return source.slice(source.indexOf("\n", end + 4) + 1);
|
|
54
|
+
}
|
|
55
|
+
function normalizeRecord(value) {
|
|
56
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
57
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CollectionSchema, ContentCmsCollectionConfig, ContentCmsFieldConfig, ContentCmsFieldType, ContentCmsRelationConfig, ContentCollectionConfig, ContentCollectionI18nConfig, ContentCollectionKind, ContentCollectionSource, ContentCollectionSourceObject, ContentConfig, ContentReferenceSchema, DefineCollectionObject, DefineCollectionOptions, defineCollection, defineContentConfig, reference } from '../dist/types/config';
|
|
2
|
+
export { ContentFieldMetadata, ContentFieldSchema, asset, fields, file, getContentFieldMetadata, image, isContentFieldSchema, relation, relations, richtext, text } from '../dist/types/fields';
|
|
3
|
+
export { SlugifyUrlSegmentOptions, slugifyUrlSegment } from '../dist/core/content/slug';
|
package/dist/config.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { defineCollection, defineContentConfig, reference } from '../dist/types/config';
|
|
2
|
+
export { asset, fields, file, getContentFieldMetadata, image, isContentFieldSchema, relation, relations, richtext, text } from '../dist/types/fields';
|
|
3
|
+
export { slugifyUrlSegment } from '../dist/core/content/slug';
|
package/dist/core/cache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cache.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cache-hints.js'
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ContentCacheHint, ContentCacheHintInput } from '../public/provider';
|
|
2
|
+
export declare const normalizeContentCacheHint: (hint: ContentCacheHint) => ContentCacheHint;
|
|
3
|
+
export declare const mergeContentCacheHints: (current: ContentCacheHint | false | undefined, next: ContentCacheHintInput | undefined) => ContentCacheHint | false | undefined;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const normalizeStringList = (values, normalize) => Array.from(new Set((values || []).filter((value) => typeof value === "string").map((value) => normalize(value.trim())).filter(Boolean)));
|
|
2
|
+
const normalizePath = (path) => {
|
|
3
|
+
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
4
|
+
return normalized.replace(/\/{2,}/g, "/");
|
|
5
|
+
};
|
|
6
|
+
const normalizeSeconds = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
7
|
+
const normalizeLastModified = (value) => {
|
|
8
|
+
if (value instanceof Date && Number.isFinite(value.getTime())) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
12
|
+
const date = new Date(value);
|
|
13
|
+
return Number.isFinite(date.getTime()) ? date : void 0;
|
|
14
|
+
}
|
|
15
|
+
return void 0;
|
|
16
|
+
};
|
|
17
|
+
export const normalizeContentCacheHint = (hint) => {
|
|
18
|
+
const tags = normalizeStringList(hint.tags, (value) => value);
|
|
19
|
+
const paths = normalizeStringList(hint.paths, normalizePath);
|
|
20
|
+
const maxAge = normalizeSeconds(hint.maxAge);
|
|
21
|
+
const swr = normalizeSeconds(hint.swr);
|
|
22
|
+
const lastModified = normalizeLastModified(hint.lastModified);
|
|
23
|
+
const etag = typeof hint.etag === "string" && hint.etag.trim() ? hint.etag.trim() : void 0;
|
|
24
|
+
return {
|
|
25
|
+
...tags.length ? { tags } : {},
|
|
26
|
+
...paths.length ? { paths } : {},
|
|
27
|
+
...typeof maxAge === "number" ? { maxAge } : {},
|
|
28
|
+
...typeof swr === "number" ? { swr } : {},
|
|
29
|
+
...etag ? { etag } : {},
|
|
30
|
+
...lastModified ? { lastModified } : {}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export const mergeContentCacheHints = (current, next) => {
|
|
34
|
+
if (current === false || next === false) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (!next) {
|
|
38
|
+
return current;
|
|
39
|
+
}
|
|
40
|
+
const left = normalizeContentCacheHint(current || {});
|
|
41
|
+
const right = normalizeContentCacheHint(next);
|
|
42
|
+
const tags = normalizeStringList([...left.tags || [], ...right.tags || []], (value) => value);
|
|
43
|
+
const paths = normalizeStringList([...left.paths || [], ...right.paths || []], normalizePath);
|
|
44
|
+
const maxAge = [left.maxAge, right.maxAge].filter((value) => typeof value === "number");
|
|
45
|
+
const swr = [left.swr, right.swr].filter((value) => typeof value === "number");
|
|
46
|
+
const lastModified = [left.lastModified, right.lastModified].filter((value) => value instanceof Date).sort((a, b) => b.getTime() - a.getTime())[0];
|
|
47
|
+
return {
|
|
48
|
+
...tags.length ? { tags } : {},
|
|
49
|
+
...paths.length ? { paths } : {},
|
|
50
|
+
...maxAge.length ? { maxAge: Math.min(...maxAge) } : {},
|
|
51
|
+
...swr.length ? { swr: Math.min(...swr) } : {},
|
|
52
|
+
...right.etag || left.etag ? { etag: right.etag || left.etag } : {},
|
|
53
|
+
...lastModified ? { lastModified } : {}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content cache contracts.
|
|
3
|
+
*
|
|
4
|
+
* Pure interfaces only — no implementation, no framework imports. The default
|
|
5
|
+
* implementation lives in `src/storage/cache.ts`; `integrations/nitro/context.ts`
|
|
6
|
+
* references these types to hold a per-context reference without creating a
|
|
7
|
+
* layering violation against the core → storage → integrations dependency order.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Deduplicates concurrent in-flight work by key. If two callers ask for the
|
|
11
|
+
* same key before the first factory resolves, both observe the same promise.
|
|
12
|
+
* The entry is removed as soon as the promise settles, so subsequent reads
|
|
13
|
+
* re-run the factory.
|
|
14
|
+
*/
|
|
15
|
+
export interface SingleFlightMap<T> {
|
|
16
|
+
run(key: string, factory: () => Promise<T>): Promise<T>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Request-scoped content cache. Holds parsed-content lists keyed by a config
|
|
20
|
+
* digest, plus two single-flight maps that prevent duplicate parse/load work
|
|
21
|
+
* inside a single request.
|
|
22
|
+
*/
|
|
23
|
+
export interface ContentCacheStore<TContent> {
|
|
24
|
+
getContents(key: string): TContent[] | undefined;
|
|
25
|
+
setContents(key: string, value: TContent[]): void;
|
|
26
|
+
clearContents(): void;
|
|
27
|
+
readonly inflightContents: SingleFlightMap<TContent[]>;
|
|
28
|
+
readonly inflightContentsList: SingleFlightMap<TContent[]>;
|
|
29
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './collection.js'
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ContentCollectionConfig } from '../../types/config';
|
|
2
|
+
export declare const resolveCollection: (file: string, collections?: Record<string, ContentCollectionConfig>, locales?: string[]) => string;
|
|
3
|
+
export declare const resolveCollections: (file: string, collections?: Record<string, ContentCollectionConfig>, locales?: string[]) => string[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import picomatch from "picomatch";
|
|
2
|
+
import { normalizeCollectionExcludes, normalizeCollectionSources } from "./sources.js";
|
|
3
|
+
const stripLocalePrefix = (file, locales) => {
|
|
4
|
+
const parts = file.split("/").filter(Boolean);
|
|
5
|
+
if (parts[0] && locales.includes(parts[0])) {
|
|
6
|
+
return parts.slice(1).join("/");
|
|
7
|
+
}
|
|
8
|
+
return file;
|
|
9
|
+
};
|
|
10
|
+
const createNumericSlugPattern = (source) => {
|
|
11
|
+
const translated = source.split("/").map((segment) => {
|
|
12
|
+
if (segment.includes("*")) {
|
|
13
|
+
return segment;
|
|
14
|
+
}
|
|
15
|
+
const match = /^(\d+)\.[^/]+?(\.[^.]+)?$/.exec(segment);
|
|
16
|
+
if (!match) {
|
|
17
|
+
return segment;
|
|
18
|
+
}
|
|
19
|
+
return `${match[1]}.*${match[2] || ""}`;
|
|
20
|
+
}).join("/");
|
|
21
|
+
return translated === source ? [source] : [source, translated];
|
|
22
|
+
};
|
|
23
|
+
const createSourceMatcher = (source) => {
|
|
24
|
+
const matchers = createNumericSlugPattern(source).map((pattern) => picomatch(pattern, { dot: true }));
|
|
25
|
+
return (file) => matchers.some((isMatch) => isMatch(file));
|
|
26
|
+
};
|
|
27
|
+
export const resolveCollection = (file, collections = {}, locales = []) => {
|
|
28
|
+
return resolveCollections(file, collections, locales)[0];
|
|
29
|
+
};
|
|
30
|
+
export const resolveCollections = (file, collections = {}, locales = []) => {
|
|
31
|
+
const normalizedFile = file.replace(/^\/+/, "");
|
|
32
|
+
const localeAgnosticFile = stripLocalePrefix(normalizedFile, locales);
|
|
33
|
+
const matches = [];
|
|
34
|
+
for (const [name, collection] of Object.entries(collections)) {
|
|
35
|
+
const excludes = normalizeCollectionExcludes(collection.exclude);
|
|
36
|
+
const isExcluded = excludes.some((source) => {
|
|
37
|
+
const isMatch = createSourceMatcher(source);
|
|
38
|
+
return isMatch(normalizedFile) || isMatch(localeAgnosticFile);
|
|
39
|
+
});
|
|
40
|
+
if (isExcluded) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
for (const source of normalizeCollectionSources(collection.source)) {
|
|
44
|
+
const isMatch = createSourceMatcher(source);
|
|
45
|
+
if (isMatch(normalizedFile) || isMatch(localeAgnosticFile)) {
|
|
46
|
+
matches.push(name);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return matches;
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './graph.js'
|