@lupinum/ginko-content 0.1.6 → 0.2.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/compatibility.json +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cms-contract/build.js +15 -20
- package/dist/cms-contract/types.d.ts +12 -7
- package/dist/core/content/document +1 -0
- package/dist/core/content/document.d.ts +16 -0
- package/dist/core/content/document.js +2 -0
- package/dist/core/content/graph.d.ts +3 -1
- package/dist/core/content/graph.js +21 -20
- package/dist/core/content/locale.d.ts +6 -1
- package/dist/core/content/locale.js +17 -6
- package/dist/core/content/path.d.ts +5 -5
- package/dist/core/content/path.js +8 -8
- package/dist/core/content/snapshot +1 -0
- package/dist/core/content/snapshot.d.ts +25 -0
- package/dist/core/content/snapshot.js +99 -0
- package/dist/core/provider-errors.d.ts +1 -1
- package/dist/core/provider-errors.js +1 -0
- package/dist/core/query/builder.js +3 -3
- package/dist/core/query/execute.js +75 -36
- package/dist/core/query/filter.js +2 -2
- package/dist/core/query/lower.js +79 -3
- package/dist/core/query/params.js +7 -7
- package/dist/core/query/plan.d.ts +18 -0
- package/dist/core/query/plan.js +7 -0
- package/dist/core/references/resolve.js +6 -9
- package/dist/features/agent/agent-markdown +1 -0
- package/dist/features/agent/agent-markdown.d.ts +116 -0
- package/dist/features/agent/agent-markdown.js +138 -0
- package/dist/features/agent/walker +1 -0
- package/dist/features/agent/walker.d.ts +10 -0
- package/dist/features/agent/walker.js +174 -0
- package/dist/features/collections/resolve.d.ts +2 -2
- package/dist/features/collections/resolve.js +19 -16
- package/dist/features/localization/links.js +1 -1
- package/dist/features/localization/results.d.ts +3 -3
- package/dist/features/localization/results.js +46 -41
- package/dist/features/localization/translated-slugs.js +5 -5
- package/dist/features/navigation/build.d.ts +2 -2
- package/dist/features/navigation/build.js +23 -26
- package/dist/features/navigation/canonical.d.ts +10 -11
- package/dist/features/navigation/canonical.js +26 -21
- package/dist/features/navigation/resolve.js +4 -4
- package/dist/features/navigation/tree.js +3 -3
- package/dist/{runtime → features}/query/backlinks.js +3 -5
- package/dist/{runtime → features}/query/documents.js +1 -1
- package/dist/{runtime → features}/query/localized-docs.d.ts +1 -1
- package/dist/{runtime → features}/query/localized-docs.js +3 -6
- package/dist/{runtime → features}/query/navigation.d.ts +1 -1
- package/dist/{runtime → features}/query/navigation.js +8 -8
- package/dist/{runtime → features}/query/populate.js +6 -14
- package/dist/{runtime → features}/query/unified.d.ts +4 -4
- package/dist/{runtime → features}/query/unified.js +4 -2
- package/dist/{runtime → features}/query/variants.js +4 -4
- package/dist/features/search/navigation.js +2 -2
- package/dist/features/search/sections.d.ts +1 -1
- package/dist/features/search/sections.js +1 -1
- package/dist/features/sitemap/query.d.ts +5 -5
- package/dist/features/sitemap/query.js +6 -6
- package/dist/integrations/nitro/ingest.js +9 -20
- package/dist/integrations/nitro/storage.d.ts +1 -0
- package/dist/integrations/nitro/storage.js +22 -8
- package/dist/module.d.mts +135 -812
- package/dist/module.json +1 -1
- package/dist/module.mjs +70 -27
- package/dist/parsers/csv.js +3 -3
- package/dist/parsers/index.js +3 -3
- package/dist/parsers/json.js +8 -6
- package/dist/parsers/markdown-plugins.js +9 -5
- package/dist/parsers/markdown.js +7 -6
- package/dist/parsers/path-meta.js +21 -19
- package/dist/parsers/reserved +1 -0
- package/dist/parsers/reserved.d.ts +15 -0
- package/dist/parsers/reserved.js +35 -0
- package/dist/parsers/yaml.js +6 -4
- package/dist/public/agent +1 -0
- package/dist/public/agent.d.ts +17 -0
- package/dist/public/agent.js +34 -0
- package/dist/public/client.d.ts +2 -3
- package/dist/public/client.js +1 -2
- package/dist/public/provider-query +1 -0
- package/dist/public/provider-query.d.ts +58 -0
- package/dist/public/provider-query.js +5 -0
- package/dist/public/provider.d.ts +8 -3
- package/dist/public/provider.js +2 -0
- package/dist/public/server.d.ts +7 -12
- package/dist/public/server.js +5 -36
- package/dist/runtime/app/components/ContentRenderer.d.vue.ts +3 -3
- package/dist/runtime/app/components/ContentRenderer.vue +2 -2
- package/dist/runtime/app/components/ContentRenderer.vue.d.ts +3 -3
- package/dist/runtime/app/components/ContentRendererInline.d.vue.ts +1 -1
- package/dist/runtime/app/components/ContentRendererInline.vue.d.ts +1 -1
- package/dist/runtime/app/components/Prose/ProseImg.d.vue.ts +4 -4
- package/dist/runtime/app/components/Prose/ProseImg.vue.d.ts +4 -4
- package/dist/runtime/app/components/Prose/ProsePre.d.vue.ts +1 -1
- package/dist/runtime/app/components/Prose/ProsePre.vue.d.ts +1 -1
- package/dist/runtime/app/components/internal/ContentRendererMarkdown.d.vue.ts +1 -1
- package/dist/runtime/app/components/internal/ContentRendererMarkdown.vue +4 -4
- package/dist/runtime/app/components/internal/ContentRendererMarkdown.vue.d.ts +1 -1
- package/dist/runtime/app/components/internal/MarkdownRenderer.d.ts +3 -3
- package/dist/runtime/app/composables/preview.d.ts +1 -1
- package/dist/runtime/app/composables/query-api.d.ts +5 -5
- package/dist/runtime/app/composables/query-api.js +5 -3
- package/dist/runtime/app/composables/route.d.ts +1 -1
- package/dist/runtime/app/composables/route.js +4 -4
- package/dist/runtime/app/composables/search.js +1 -1
- package/dist/runtime/app/composables/use-content-document.js +1 -1
- package/dist/runtime/app/composables/use-content-list.js +1 -1
- package/dist/runtime/app/composables/use-content-navigation.js +2 -2
- package/dist/runtime/app/composables/use-content-page.js +4 -4
- package/dist/runtime/app/pages/content.vue +2 -1
- package/dist/runtime/markdown/plugins.js +6 -8
- package/dist/runtime/server/agent-markdown.d.ts +5 -65
- package/dist/runtime/server/agent-markdown.js +40 -315
- package/dist/runtime/server/agent-site.js +1 -1
- package/dist/runtime/server/api/agent-raw.js +1 -1
- package/dist/runtime/server/api/cache.d.ts +1 -1
- package/dist/runtime/server/api/cache.js +43 -4
- package/dist/runtime/server/api/locales.js +3 -3
- package/dist/runtime/server/api/navigation.d.ts +1 -1
- package/dist/runtime/server/api/navigation.js +3 -1
- package/dist/runtime/server/api/query.js +2 -2
- package/dist/runtime/server/api/search-index.d.ts +1 -1
- package/dist/runtime/server/api/sitemap.d.ts +1 -1
- package/dist/runtime/server/cache-adapters.d.ts +18 -0
- package/dist/runtime/server/cache-adapters.js +12 -0
- package/dist/runtime/server/collection-helpers.d.ts +2 -2
- package/dist/runtime/server/collection-helpers.js +15 -11
- package/dist/runtime/server/index.d.ts +6 -4
- package/dist/runtime/server/index.js +10 -3
- package/dist/runtime/server/middleware/agent-link-headers.js +1 -1
- package/dist/runtime/server/middleware/agent-markdown.js +1 -1
- package/dist/runtime/server/navigation-query.d.ts +2 -2
- package/dist/runtime/server/navigation-query.js +52 -7
- package/dist/runtime/server/navigation.d.ts +1 -1
- package/dist/runtime/server/provider-document +1 -0
- package/dist/runtime/server/provider-document.d.ts +59 -0
- package/dist/runtime/server/provider-document.js +48 -0
- package/dist/runtime/server/provider-query-wire +1 -0
- package/dist/runtime/server/provider-query-wire.d.ts +32 -0
- package/dist/runtime/server/provider-query-wire.js +27 -0
- package/dist/runtime/server/provider-query.d.ts +18 -9
- package/dist/runtime/server/provider-query.js +62 -28
- package/dist/runtime/server/provider-result.d.ts +4 -4
- package/dist/runtime/server/providers/filesystem.js +3 -11
- package/dist/runtime/server/providers/index.d.ts +18 -1
- package/dist/runtime/server/providers/index.js +72 -20
- package/dist/runtime/server/query-api.d.ts +5 -5
- package/dist/runtime/server/query-api.js +9 -6
- package/dist/runtime/server/query-executor.d.ts +3 -3
- package/dist/runtime/server/query-executor.js +43 -59
- package/dist/runtime/server/search.d.ts +1 -1
- package/dist/runtime/server/search.js +4 -4
- package/dist/runtime/server/sitemap.js +5 -5
- package/dist/runtime/server/storage-access.d.ts +4 -1
- package/dist/runtime/server/storage-access.js +27 -2
- package/dist/runtime/transformers/component-resolver.d.ts +1 -1
- package/dist/storage/content.d.ts +2 -6
- package/dist/storage/content.js +19 -8
- package/dist/storage/contents.d.ts +9 -1
- package/dist/storage/contents.js +26 -19
- package/dist/storage/driver.d.ts +2 -2
- package/dist/storage/driver.js +2 -1
- package/dist/storage/graph.js +4 -0
- package/dist/storage/manifest.js +3 -1
- package/dist/storage/references.js +9 -5
- package/dist/storage/snapshot-runtime +1 -0
- package/dist/storage/snapshot-runtime.d.ts +11 -0
- package/dist/storage/snapshot-runtime.js +46 -0
- package/dist/storage/validation.d.ts +1 -1
- package/dist/storage/validation.js +47 -102
- package/dist/testing/provider-contract.d.ts +14 -4
- package/dist/testing/provider-contract.js +121 -68
- package/dist/testing/provider-fixture.d.ts +1 -1
- package/dist/testing/provider-fixture.js +124 -120
- package/dist/types/config.d.ts +8 -4
- package/dist/types/content.d.ts +104 -70
- package/dist/types/fields.js +1 -1
- package/dist/types/module.d.ts +1 -1
- package/dist/types/query-parts/public.d.ts +14 -5
- package/dist/types/query-parts/results.d.ts +6 -2
- package/dist/types/query-parts/transport.d.ts +19 -0
- package/dist/types/virtual.d.ts +6 -0
- package/dist/types.d.mts +2 -2
- package/dist/web-types.json +1 -1
- package/package.json +39 -9
- package/dist/runtime/app/plugins/markdown-components +0 -1
- package/dist/runtime/app/plugins/markdown-components.d.ts +0 -2
- package/dist/runtime/app/plugins/markdown-components.js +0 -19
- /package/dist/{runtime → features/agent}/agent-paths +0 -0
- /package/dist/{runtime → features/agent}/agent-paths.d.ts +0 -0
- /package/dist/{runtime → features/agent}/agent-paths.js +0 -0
- /package/dist/{runtime → features}/query/backlinks +0 -0
- /package/dist/{runtime → features}/query/backlinks.d.ts +0 -0
- /package/dist/{runtime → features}/query/context +0 -0
- /package/dist/{runtime → features}/query/context.d.ts +0 -0
- /package/dist/{runtime → features}/query/context.js +0 -0
- /package/dist/{runtime → features}/query/documents +0 -0
- /package/dist/{runtime → features}/query/documents.d.ts +0 -0
- /package/dist/{runtime → features}/query/errors +0 -0
- /package/dist/{runtime → features}/query/errors.d.ts +0 -0
- /package/dist/{runtime → features}/query/errors.js +0 -0
- /package/dist/{runtime → features}/query/handles +0 -0
- /package/dist/{runtime → features}/query/handles.d.ts +0 -0
- /package/dist/{runtime → features}/query/handles.js +0 -0
- /package/dist/{runtime → features}/query/locale-options +0 -0
- /package/dist/{runtime → features}/query/locale-options.d.ts +0 -0
- /package/dist/{runtime → features}/query/locale-options.js +0 -0
- /package/dist/{runtime → features}/query/localized-docs +0 -0
- /package/dist/{runtime → features}/query/navigation +0 -0
- /package/dist/{runtime → features}/query/pagination +0 -0
- /package/dist/{runtime → features}/query/pagination.d.ts +0 -0
- /package/dist/{runtime → features}/query/pagination.js +0 -0
- /package/dist/{runtime → features}/query/populate +0 -0
- /package/dist/{runtime → features}/query/populate.d.ts +0 -0
- /package/dist/{runtime → features}/query/public-limits +0 -0
- /package/dist/{runtime → features}/query/public-limits.d.ts +0 -0
- /package/dist/{runtime → features}/query/public-limits.js +0 -0
- /package/dist/{runtime → features}/query/resolve +0 -0
- /package/dist/{runtime → features}/query/resolve.d.ts +0 -0
- /package/dist/{runtime → features}/query/resolve.js +0 -0
- /package/dist/{runtime → features}/query/responses +0 -0
- /package/dist/{runtime → features}/query/responses.d.ts +0 -0
- /package/dist/{runtime → features}/query/responses.js +0 -0
- /package/dist/{runtime → features}/query/routes +0 -0
- /package/dist/{runtime → features}/query/routes.d.ts +0 -0
- /package/dist/{runtime → features}/query/routes.js +0 -0
- /package/dist/{runtime → features}/query/unified +0 -0
- /package/dist/{runtime → features}/query/variants +0 -0
- /package/dist/{runtime → features}/query/variants.d.ts +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider wire contract v1 (CS-5).
|
|
3
|
+
*
|
|
4
|
+
* The single query envelope crossing the `ContentProvider` boundary. It wraps
|
|
5
|
+
* the executor-facing `ContentQueryPlan` (see `../core/query/plan.ts`) rather
|
|
6
|
+
* than the open-ended builder params that used to leak across the seam:
|
|
7
|
+
*
|
|
8
|
+
* - **closed** — no index signatures; every field is named.
|
|
9
|
+
* - **versioned** — `v` lets providers reject a wire they do not understand.
|
|
10
|
+
* - **JSON-pure** — the plan carries no `RegExp` instances, `Date`s, or
|
|
11
|
+
* functions (regex operands are lowered to a tagged JSON object), so the
|
|
12
|
+
* whole envelope survives `JSON.parse(JSON.stringify(query))`. The provider
|
|
13
|
+
* registry asserts this in dev.
|
|
14
|
+
*
|
|
15
|
+
* Providers pattern-match `plan.filter` (a `FilterExpr` tree); they never
|
|
16
|
+
* parse builder params again.
|
|
17
|
+
*
|
|
18
|
+
* The builder-params → wire lowering helpers (`toContentProviderQuery`,
|
|
19
|
+
* `toContentProviderNavigationQuery`, `PROVIDER_QUERY_VERSION`) live in the
|
|
20
|
+
* runtime adapter layer (`../runtime/server/provider-query-wire`) so the
|
|
21
|
+
* internal query IR is not named in the public facade; they are re-exported
|
|
22
|
+
* here to keep the exported surface stable.
|
|
23
|
+
*/
|
|
24
|
+
import type { ContentQueryPlan } from '../core/query/plan';
|
|
25
|
+
export type { ContentQueryPlan } from '../core/query/plan';
|
|
26
|
+
export { PROVIDER_QUERY_VERSION, toContentProviderQuery, toContentProviderNavigationQuery } from '../runtime/server/provider-query-wire';
|
|
27
|
+
/** The single wire type crossing the provider `query`/`navigationQuery` boundary. */
|
|
28
|
+
export interface ContentProviderQuery {
|
|
29
|
+
/** Wire version — always `PROVIDER_QUERY_VERSION` (1). */
|
|
30
|
+
v: 1;
|
|
31
|
+
/** `null` = cross-collection query (navigation / search aggregation paths). */
|
|
32
|
+
collection: string | null;
|
|
33
|
+
plan: ContentQueryPlan;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Navigation-only knobs that are NOT part of the query plan. Navigation adds
|
|
37
|
+
* projection fields, a canonical-vs-localized routing flag, and a locale
|
|
38
|
+
* resolution spec — all of which configure `navigationQuery` tree shaping
|
|
39
|
+
* rather than document selection, so they travel beside the plan instead of
|
|
40
|
+
* being smuggled through it.
|
|
41
|
+
*
|
|
42
|
+
* `resolveLocale` is carried here in its un-lowered builder shape because
|
|
43
|
+
* navigation walks the fallback chain itself and must distinguish
|
|
44
|
+
* `fallback: true` (expand from config) / `false` (exact) / an explicit chain —
|
|
45
|
+
* a distinction the executor plan intentionally normalizes away.
|
|
46
|
+
*/
|
|
47
|
+
export interface ContentProviderNavigationOptions {
|
|
48
|
+
/** Extra fields the navigation tree should carry beyond the defaults. */
|
|
49
|
+
fields?: string[];
|
|
50
|
+
/** Emit canonical (locale-agnostic) routes instead of localized ones. */
|
|
51
|
+
canonical?: boolean;
|
|
52
|
+
/** Locale resolution for the navigation tree, in builder shape. */
|
|
53
|
+
resolveLocale?: {
|
|
54
|
+
locale?: string;
|
|
55
|
+
fallback?: boolean | string[];
|
|
56
|
+
exact?: boolean;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -2,11 +2,16 @@ import type { H3Event } from 'h3';
|
|
|
2
2
|
import type { ContentQueryResponse } from '../types/api';
|
|
3
3
|
import type { NavItem, ParsedContent } from '../types/content';
|
|
4
4
|
import type { ContentProviderName } from '../types/config';
|
|
5
|
-
import type { ContentCollectionItemSurroundingsOptions, ContentCollectionNavigationOptions, ContentCollectionPageOptions, ContentCollectionRouteMetaOptions, ContentCollectionSearchSectionsOptions, ContentPageResult,
|
|
5
|
+
import type { ContentCollectionItemSurroundingsOptions, ContentCollectionNavigationOptions, ContentCollectionPageOptions, ContentCollectionRouteMetaOptions, ContentCollectionSearchSectionsOptions, ContentPageResult, ContentRouteMeta, ContentSearchSection, ContentSitemapEntry } from '../types/query';
|
|
6
6
|
import type { QueryCollectionsSitemapEntriesOptions } from '../features/sitemap/query';
|
|
7
7
|
import type { ContentProviderSearchRequest, ContentSearchResult } from '../types/search';
|
|
8
8
|
import type { ContentCacheHint, ContentCacheHintInput } from '../core/cache-hints';
|
|
9
|
+
import type { ContentProviderNavigationOptions, ContentProviderQuery } from './provider-query';
|
|
9
10
|
export type { ContentCacheHint, ContentCacheHintInput } from '../core/cache-hints';
|
|
11
|
+
export type { ContentProviderQuery, ContentProviderNavigationOptions, ContentQueryPlan } from './provider-query';
|
|
12
|
+
export { PROVIDER_QUERY_VERSION, toContentProviderQuery, toContentProviderNavigationQuery } from './provider-query';
|
|
13
|
+
export { createContentProviderError } from './provider-errors';
|
|
14
|
+
export type { ContentProviderErrorCode } from './provider-errors';
|
|
10
15
|
export declare const contentProviderResultMarker = "__ginkoContentProviderResult";
|
|
11
16
|
export interface ContentProviderResult<T = unknown> {
|
|
12
17
|
readonly [contentProviderResultMarker]: true;
|
|
@@ -53,8 +58,8 @@ export interface ContentProviderCapabilities {
|
|
|
53
58
|
export interface ContentProvider {
|
|
54
59
|
name: ContentProviderName;
|
|
55
60
|
capabilities: ContentProviderCapabilities;
|
|
56
|
-
query: <T = ParsedContent>(event: H3Event, query:
|
|
57
|
-
navigationQuery?: (event: H3Event, query:
|
|
61
|
+
query: <T = ParsedContent>(event: H3Event, query: ContentProviderQuery) => Promise<MaybeContentProviderResult<ContentQueryResponse<T>>>;
|
|
62
|
+
navigationQuery?: (event: H3Event, query: ContentProviderQuery, options?: ContentProviderNavigationOptions) => Promise<MaybeContentProviderResult<NavItem[]>>;
|
|
58
63
|
navigation?: (event: H3Event, collection: string, options?: string[] | ContentCollectionNavigationOptions) => Promise<MaybeContentProviderResult<NavItem[]>>;
|
|
59
64
|
surroundings?: (event: H3Event, collection: string, path: string, options?: ContentCollectionItemSurroundingsOptions) => Promise<MaybeContentProviderResult<Array<NavItem | null>>>;
|
|
60
65
|
searchSections?: (event: H3Event, collection: string, options?: ContentCollectionSearchSectionsOptions) => Promise<MaybeContentProviderResult<ContentSearchSection[]>>;
|
package/dist/public/provider.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { PROVIDER_QUERY_VERSION, toContentProviderQuery, toContentProviderNavigationQuery } from "./provider-query.js";
|
|
2
|
+
export { createContentProviderError } from "./provider-errors.js";
|
|
1
3
|
export const contentProviderResultMarker = "__ginkoContentProviderResult";
|
|
2
4
|
export const withContentCache = (data, cache) => ({
|
|
3
5
|
[contentProviderResultMarker]: true,
|
package/dist/public/server.d.ts
CHANGED
|
@@ -6,19 +6,14 @@
|
|
|
6
6
|
* re-exported here for ergonomic discoverability from `@lupinum/ginko-content/server`.
|
|
7
7
|
*/
|
|
8
8
|
export { one, many, paginate, backlinks, resolveOne, variants, tree, neighbors, createServerContentQueryContext } from '../runtime/server/query-api.js';
|
|
9
|
-
export { getCollectionPath } from '../
|
|
10
|
-
export type { CollectionPathOptions } from '../
|
|
11
|
-
export {
|
|
12
|
-
export { clearAgentMarkdownSerializers, blockquoteMarkdown, defineAgentMarkdownComponent, getMarkdownProp, jsonFenceMarkdown, linkMarkdown, queryMarkdownEnabledContent, registerAgentMarkdownComponent, registerAgentMarkdownComponents, registerAgentMarkdownSerializer, registerAgentMarkdownSerializers, renderMarkdownChildren, resolveAgentMarkdownOptions, resolveContentMarkdown, resolveContentMarkdownByRoute, xmlComponentMarkdown } from '../runtime/server/agent-markdown.js';
|
|
13
|
-
export { buildAgentPageIndex, collectAgentMarkdownPrerenderRoutes, getAgentLocales, isSupportedAgentLocale, localeFromAgentPath, renderAgentMarkdownFrontmatter, renderAgentMarkdownPage, renderLlmsFullTxt, renderLlmsTxt, resolveMarkdownForPublicRoute, routePathFromIndexSlug, routePathFromRawSlug } from '../runtime/server/agent-site.js';
|
|
14
|
-
export type { AgentMarkdown, AgentMarkdownComponent, AgentMarkdownComponentMap, AgentMarkdownContext, AgentMarkdownMeta, AgentMarkdownPublicSignals, AgentMarkdownSerializer, AgentMarkdownSerializerMap, ResolvedAgentMarkdownOptions } from '../runtime/server/agent-markdown.js';
|
|
15
|
-
export type { AgentPage, AgentPageSource } from '../runtime/server/agent-site.js';
|
|
16
|
-
export type { QueryWhere, QueryOperators, ContentSelector, ContentPageResult, ContentQueryBuilderParams, ContentRouteMeta, ContentSearchSection, ContentResolvedMeta, ContentSitemapEntry, BacklinkFields, BacklinkSource, BacklinksOptions, BacklinksResult, LocaleFallback, DocumentFromHandle, OneOptions, ManyOptions, PaginationOptions, PaginationResult, PopulateSpec, PopulatedDocument, ResolveOneOptions, ResolveOneResult, LocalizedDoc, LocalizedContentDocument, LocalePathEntry, NeighborsOptions, NeighborsResult, SortSpec, TreeOptions, VariantsOptions, ContentVariant } from '../types/query.js';
|
|
9
|
+
export { getCollectionPath } from '../features/query/routes.js';
|
|
10
|
+
export type { CollectionPathOptions } from '../features/query/routes.js';
|
|
11
|
+
export type { QueryWhere, QueryOperators, ContentSelector, ContentPageResult, ContentRouteMeta, ContentSearchSection, ContentResolvedMeta, ContentSitemapEntry, BacklinkFields, BacklinkSource, BacklinksOptions, BacklinksResult, LocaleFallback, DocumentFromHandle, OneOptions, ManyOptions, PaginationOptions, PaginationResult, PopulateSpec, PopulatedDocument, ResolveOneOptions, ResolveOneResult, LocalizedDoc, LocalizedContentDocument, LocalePathEntry, NeighborsOptions, NeighborsResult, SortSpec, TreeOptions, VariantsOptions, ContentVariant } from '../types/query.js';
|
|
17
12
|
export type { ContentQueryResponse } from '../types/api.js';
|
|
18
13
|
export declare const queryCollectionsSitemapEntries: typeof import('../runtime/server/sitemap-provider.js').queryCollectionsSitemapEntries;
|
|
19
14
|
export { createContentProviderError } from './provider-errors.js';
|
|
20
|
-
export { contentCacheHeaders, noopContentCache, vercelContentCache, type VercelContentCacheOptions } from '../runtime/server/cache-adapters.js';
|
|
15
|
+
export { contentCacheHeaders, noopContentCache, vercelContentCache, headersContentCache, type VercelContentCacheOptions } from '../runtime/server/cache-adapters.js';
|
|
21
16
|
export { clearContentCacheHint, collectContentCacheHint, getContentCacheHint } from '../runtime/server/cache-hints.js';
|
|
22
|
-
export
|
|
23
|
-
export {
|
|
24
|
-
export type {
|
|
17
|
+
export { PROVIDER_QUERY_VERSION, toContentProviderNavigationQuery, toContentProviderQuery, withContentCache } from './provider.js';
|
|
18
|
+
export { normalizeProviderDocument, shapeProviderDocument } from '../runtime/server/provider-document.js';
|
|
19
|
+
export type { ProviderDocumentInput, ShapeProviderDocumentOptions } from '../runtime/server/provider-document.js';
|
package/dist/public/server.js
CHANGED
|
@@ -9,40 +9,7 @@ export {
|
|
|
9
9
|
neighbors,
|
|
10
10
|
createServerContentQueryContext
|
|
11
11
|
} from "../runtime/server/query-api.js";
|
|
12
|
-
export { getCollectionPath } from "../
|
|
13
|
-
export { agentMarkdownPathForRoute, agentRawPathForRoute, normalizeAgentRoutePath } from "../runtime/agent-paths.js";
|
|
14
|
-
export {
|
|
15
|
-
clearAgentMarkdownSerializers,
|
|
16
|
-
blockquoteMarkdown,
|
|
17
|
-
defineAgentMarkdownComponent,
|
|
18
|
-
getMarkdownProp,
|
|
19
|
-
jsonFenceMarkdown,
|
|
20
|
-
linkMarkdown,
|
|
21
|
-
queryMarkdownEnabledContent,
|
|
22
|
-
registerAgentMarkdownComponent,
|
|
23
|
-
registerAgentMarkdownComponents,
|
|
24
|
-
registerAgentMarkdownSerializer,
|
|
25
|
-
registerAgentMarkdownSerializers,
|
|
26
|
-
renderMarkdownChildren,
|
|
27
|
-
resolveAgentMarkdownOptions,
|
|
28
|
-
resolveContentMarkdown,
|
|
29
|
-
resolveContentMarkdownByRoute,
|
|
30
|
-
xmlComponentMarkdown
|
|
31
|
-
} from "../runtime/server/agent-markdown.js";
|
|
32
|
-
export {
|
|
33
|
-
buildAgentPageIndex,
|
|
34
|
-
collectAgentMarkdownPrerenderRoutes,
|
|
35
|
-
getAgentLocales,
|
|
36
|
-
isSupportedAgentLocale,
|
|
37
|
-
localeFromAgentPath,
|
|
38
|
-
renderAgentMarkdownFrontmatter,
|
|
39
|
-
renderAgentMarkdownPage,
|
|
40
|
-
renderLlmsFullTxt,
|
|
41
|
-
renderLlmsTxt,
|
|
42
|
-
resolveMarkdownForPublicRoute,
|
|
43
|
-
routePathFromIndexSlug,
|
|
44
|
-
routePathFromRawSlug
|
|
45
|
-
} from "../runtime/server/agent-site.js";
|
|
12
|
+
export { getCollectionPath } from "../features/query/routes.js";
|
|
46
13
|
export const queryCollectionsSitemapEntries = async (...args) => {
|
|
47
14
|
const { queryCollectionsSitemapEntries: queryCollectionsSitemapEntries2 } = await import("../runtime/server/sitemap-provider.js");
|
|
48
15
|
return await queryCollectionsSitemapEntries2(...args);
|
|
@@ -51,11 +18,13 @@ export { createContentProviderError } from "./provider-errors.js";
|
|
|
51
18
|
export {
|
|
52
19
|
contentCacheHeaders,
|
|
53
20
|
noopContentCache,
|
|
54
|
-
vercelContentCache
|
|
21
|
+
vercelContentCache,
|
|
22
|
+
headersContentCache
|
|
55
23
|
} from "../runtime/server/cache-adapters.js";
|
|
56
24
|
export {
|
|
57
25
|
clearContentCacheHint,
|
|
58
26
|
collectContentCacheHint,
|
|
59
27
|
getContentCacheHint
|
|
60
28
|
} from "../runtime/server/cache-hints.js";
|
|
61
|
-
export { withContentCache } from "./provider.js";
|
|
29
|
+
export { PROVIDER_QUERY_VERSION, toContentProviderNavigationQuery, toContentProviderQuery, withContentCache } from "./provider.js";
|
|
30
|
+
export { normalizeProviderDocument, shapeProviderDocument } from "../runtime/server/provider-document.js";
|
|
@@ -19,7 +19,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
19
19
|
default: undefined;
|
|
20
20
|
};
|
|
21
21
|
class: {
|
|
22
|
-
type: (
|
|
22
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
|
|
23
23
|
default: undefined;
|
|
24
24
|
};
|
|
25
25
|
unwrap: {
|
|
@@ -45,7 +45,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
45
45
|
default: undefined;
|
|
46
46
|
};
|
|
47
47
|
class: {
|
|
48
|
-
type: (
|
|
48
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
|
|
49
49
|
default: undefined;
|
|
50
50
|
};
|
|
51
51
|
unwrap: {
|
|
@@ -55,8 +55,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
55
55
|
}>> & Readonly<{}>, {
|
|
56
56
|
excerpt: boolean;
|
|
57
57
|
value: Record<string, any>;
|
|
58
|
+
tag: string;
|
|
58
59
|
class: string | unknown[] | Record<string, any>;
|
|
59
60
|
prose: boolean;
|
|
60
|
-
tag: string;
|
|
61
61
|
unwrap: string | boolean;
|
|
62
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -12,7 +12,7 @@ function normalizeBody(value, excerpt) {
|
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
14
|
function warnUnsupportedValue(value, excerpt) {
|
|
15
|
-
const path = value?.
|
|
15
|
+
const path = value?.path ? ` for "${value.path}"` : "";
|
|
16
16
|
const target = excerpt ? "excerpt" : "body";
|
|
17
17
|
console.warn(
|
|
18
18
|
`[ginko-content] <ContentRenderer> could not render ${target}${path}. Pass the full content document with a markdown body, or provide an \`empty\` slot for empty/unsupported content.`
|
|
@@ -52,7 +52,7 @@ export default defineComponent({
|
|
|
52
52
|
() => props.excerpt,
|
|
53
53
|
(newExcerpt) => {
|
|
54
54
|
if (newExcerpt && !props.value?.excerpt) {
|
|
55
|
-
console.warn(`No excerpt found for document content/${props?.value?.
|
|
55
|
+
console.warn(`No excerpt found for document content/${props?.value?.path}.${props?.value?.file?.extension}!`);
|
|
56
56
|
console.warn("Make sure to use <!--more--> in your content if you want to use excerpt feature.");
|
|
57
57
|
}
|
|
58
58
|
},
|
|
@@ -19,7 +19,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
19
19
|
default: undefined;
|
|
20
20
|
};
|
|
21
21
|
class: {
|
|
22
|
-
type: (
|
|
22
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
|
|
23
23
|
default: undefined;
|
|
24
24
|
};
|
|
25
25
|
unwrap: {
|
|
@@ -45,7 +45,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
45
45
|
default: undefined;
|
|
46
46
|
};
|
|
47
47
|
class: {
|
|
48
|
-
type: (
|
|
48
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
|
|
49
49
|
default: undefined;
|
|
50
50
|
};
|
|
51
51
|
unwrap: {
|
|
@@ -55,8 +55,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
55
55
|
}>> & Readonly<{}>, {
|
|
56
56
|
excerpt: boolean;
|
|
57
57
|
value: Record<string, any>;
|
|
58
|
+
tag: string;
|
|
58
59
|
class: string | unknown[] | Record<string, any>;
|
|
59
60
|
prose: boolean;
|
|
60
|
-
tag: string;
|
|
61
61
|
unwrap: string | boolean;
|
|
62
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -41,9 +41,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
41
41
|
default: () => {};
|
|
42
42
|
};
|
|
43
43
|
}>> & Readonly<{}>, {
|
|
44
|
+
tag: string;
|
|
44
45
|
components: Record<string, any>;
|
|
45
46
|
prose: boolean;
|
|
46
|
-
tag: string;
|
|
47
47
|
unwrap: string | boolean;
|
|
48
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
49
|
declare const _default: typeof __VLS_export;
|
|
@@ -41,9 +41,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
41
41
|
default: () => {};
|
|
42
42
|
};
|
|
43
43
|
}>> & Readonly<{}>, {
|
|
44
|
+
tag: string;
|
|
44
45
|
components: Record<string, any>;
|
|
45
46
|
prose: boolean;
|
|
46
|
-
tag: string;
|
|
47
47
|
unwrap: string | boolean;
|
|
48
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
49
49
|
declare const _default: typeof __VLS_export;
|
|
@@ -12,11 +12,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
12
12
|
default: undefined;
|
|
13
13
|
};
|
|
14
14
|
width: {
|
|
15
|
-
type: (
|
|
15
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
16
16
|
default: undefined;
|
|
17
17
|
};
|
|
18
18
|
height: {
|
|
19
|
-
type: (
|
|
19
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
20
20
|
default: undefined;
|
|
21
21
|
};
|
|
22
22
|
loading: {
|
|
@@ -37,11 +37,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
37
37
|
default: undefined;
|
|
38
38
|
};
|
|
39
39
|
width: {
|
|
40
|
-
type: (
|
|
40
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
41
41
|
default: undefined;
|
|
42
42
|
};
|
|
43
43
|
height: {
|
|
44
|
-
type: (
|
|
44
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
45
45
|
default: undefined;
|
|
46
46
|
};
|
|
47
47
|
loading: {
|
|
@@ -12,11 +12,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
12
12
|
default: undefined;
|
|
13
13
|
};
|
|
14
14
|
width: {
|
|
15
|
-
type: (
|
|
15
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
16
16
|
default: undefined;
|
|
17
17
|
};
|
|
18
18
|
height: {
|
|
19
|
-
type: (
|
|
19
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
20
20
|
default: undefined;
|
|
21
21
|
};
|
|
22
22
|
loading: {
|
|
@@ -37,11 +37,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
37
37
|
default: undefined;
|
|
38
38
|
};
|
|
39
39
|
width: {
|
|
40
|
-
type: (
|
|
40
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
41
41
|
default: undefined;
|
|
42
42
|
};
|
|
43
43
|
height: {
|
|
44
|
-
type: (
|
|
44
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
45
45
|
default: undefined;
|
|
46
46
|
};
|
|
47
47
|
loading: {
|
|
@@ -62,8 +62,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
62
62
|
};
|
|
63
63
|
}>> & Readonly<{}>, {
|
|
64
64
|
code: string;
|
|
65
|
-
meta: string;
|
|
66
65
|
style: string | Record<string, any>;
|
|
66
|
+
meta: string;
|
|
67
67
|
class: string;
|
|
68
68
|
language: string;
|
|
69
69
|
filename: string;
|
|
@@ -62,8 +62,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
62
62
|
};
|
|
63
63
|
}>> & Readonly<{}>, {
|
|
64
64
|
code: string;
|
|
65
|
-
meta: string;
|
|
66
65
|
style: string | Record<string, any>;
|
|
66
|
+
meta: string;
|
|
67
67
|
class: string;
|
|
68
68
|
language: string;
|
|
69
69
|
filename: string;
|
|
@@ -59,9 +59,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
59
59
|
}>> & Readonly<{}>, {
|
|
60
60
|
excerpt: boolean;
|
|
61
61
|
data: Record<string, any>;
|
|
62
|
+
tag: string;
|
|
62
63
|
components: Record<string, any>;
|
|
63
64
|
prose: boolean;
|
|
64
|
-
tag: string;
|
|
65
65
|
unwrap: string | boolean;
|
|
66
66
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
67
67
|
declare const _default: typeof __VLS_export;
|
|
@@ -44,8 +44,8 @@ const runtimeContent = useRuntimeConfig().public?.content || {};
|
|
|
44
44
|
const attrs = useAttrs();
|
|
45
45
|
const { unwrap: unwrapRoot } = useUnwrap();
|
|
46
46
|
const localePath = useLocalePath();
|
|
47
|
-
const locale = computed(() => props.value.locale || props.value.
|
|
48
|
-
const linkLocale = computed(() => props.value.
|
|
47
|
+
const locale = computed(() => props.value.locale || props.value.resolved?.locale || props.value.locale);
|
|
48
|
+
const linkLocale = computed(() => props.value.resolved?.requestedLocale || locale.value);
|
|
49
49
|
const defaultLocale = computed(() => props.value.defaultLocale || runtimeContent.defaultLocale);
|
|
50
50
|
const locales = computed(() => {
|
|
51
51
|
const variantLocales = Array.isArray(props.value.variants) ? props.value.variants.map((variant) => variant.locale).filter((locale2) => Boolean(locale2)) : [];
|
|
@@ -64,7 +64,7 @@ const body = computed(() => {
|
|
|
64
64
|
}
|
|
65
65
|
const resolvedRefs = resolveMarkdownRenderRefs(
|
|
66
66
|
body2,
|
|
67
|
-
props.value.
|
|
67
|
+
props.value.resolved?.resolvedRefs,
|
|
68
68
|
runtimeContent.links,
|
|
69
69
|
(route) => localePath(route, linkLocale.value)
|
|
70
70
|
);
|
|
@@ -105,7 +105,7 @@ const rendererAttrs = computed(() => {
|
|
|
105
105
|
:default-locale="defaultLocale"
|
|
106
106
|
:locales="locales"
|
|
107
107
|
:components="resolvedComponents"
|
|
108
|
-
:data-content-id="debug ? value.
|
|
108
|
+
:data-content-id="debug ? value.id : void 0"
|
|
109
109
|
v-bind="rendererAttrs"
|
|
110
110
|
/>
|
|
111
111
|
</template>
|
|
@@ -59,9 +59,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
59
59
|
}>> & Readonly<{}>, {
|
|
60
60
|
excerpt: boolean;
|
|
61
61
|
data: Record<string, any>;
|
|
62
|
+
tag: string;
|
|
62
63
|
components: Record<string, any>;
|
|
63
64
|
prose: boolean;
|
|
64
|
-
tag: string;
|
|
65
65
|
unwrap: string | boolean;
|
|
66
66
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
67
67
|
declare const _default: typeof __VLS_export;
|
|
@@ -19,7 +19,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
19
19
|
default: string;
|
|
20
20
|
};
|
|
21
21
|
class: {
|
|
22
|
-
type: (
|
|
22
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
|
|
23
23
|
default: undefined;
|
|
24
24
|
};
|
|
25
25
|
dataContentId: {
|
|
@@ -58,7 +58,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
58
58
|
default: string;
|
|
59
59
|
};
|
|
60
60
|
class: {
|
|
61
|
-
type: (
|
|
61
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor)[];
|
|
62
62
|
default: undefined;
|
|
63
63
|
};
|
|
64
64
|
dataContentId: {
|
|
@@ -79,12 +79,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
79
79
|
};
|
|
80
80
|
}>> & Readonly<{}>, {
|
|
81
81
|
locale: string;
|
|
82
|
+
tag: string;
|
|
82
83
|
defaultLocale: string;
|
|
83
84
|
locales: string[];
|
|
84
85
|
class: string | unknown[] | Record<string, any>;
|
|
85
86
|
components: Record<string, any>;
|
|
86
87
|
prose: boolean | undefined;
|
|
87
|
-
tag: string;
|
|
88
88
|
dataContentId: string;
|
|
89
89
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
90
90
|
export default _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ParsedContent } from '../../../types/content';
|
|
2
|
-
import type { ContentCollectionTarget, ContentVariant, ContentTreeItem, BacklinksOptions, BacklinksResult, BacklinkSource, DocumentFromHandle, ManyOptions, LocalizedDoc, NeighborsOptions, NeighborsResult, OneOptions, PopulateSpec, PopulateFromOptions, PopulatedDocument, PaginationOptions, PaginationResult, ResolveOneOptions, ResolveOneResult, TreeOptions, VariantsOptions } from '../../../types/query';
|
|
3
|
-
import { type ContentQueryContext } from '
|
|
2
|
+
import type { ContentCollectionTarget, ContentVariant, ContentTreeItem, BacklinksOptions, BacklinksResult, BacklinkSource, DocumentFromHandle, ManyOptions, LocalizedDoc, NeighborsOptions, NeighborsResult, OneOptions, OptionsArg, PopulateSpec, PopulateFromOptions, PopulatedDocument, PaginationOptions, PaginationResult, ResolveOneOptions, ResolveOneResult, TreeOptions, VariantsOptions } from '../../../types/query';
|
|
3
|
+
import { type ContentQueryContext } from '../../../features/query/unified';
|
|
4
4
|
export declare const createClientContentQueryContext: () => ContentQueryContext;
|
|
5
5
|
export declare function resolveOne<const H extends ContentCollectionTarget, O extends ResolveOneOptions<H, PopulateSpec | undefined>>(handle: H, options: O): Promise<ResolveOneResult<PopulatedDocument<DocumentFromHandle<H>, PopulateFromOptions<O>>>>;
|
|
6
6
|
export declare function one<const H extends ContentCollectionTarget, O extends OneOptions<H, PopulateSpec | undefined>>(handle: H, options: O): Promise<LocalizedDoc<PopulatedDocument<DocumentFromHandle<H>, PopulateFromOptions<O>>> | null>;
|
|
7
|
-
export declare function many<const H extends ContentCollectionTarget, O extends ManyOptions<H, PopulateSpec | undefined>>(handle: H,
|
|
7
|
+
export declare function many<const H extends ContentCollectionTarget, O extends ManyOptions<H, PopulateSpec | undefined>>(handle: H, ...args: OptionsArg<H, O & ManyOptions<H, PopulateSpec | undefined>>): Promise<Array<LocalizedDoc<PopulatedDocument<DocumentFromHandle<H>, PopulateFromOptions<O>>>>>;
|
|
8
8
|
export declare function paginate<const H extends ContentCollectionTarget, O extends PaginationOptions<H, PopulateSpec | undefined>>(handle: H, options: O): Promise<PaginationResult<PopulatedDocument<DocumentFromHandle<H>, PopulateFromOptions<O>>>>;
|
|
9
9
|
export declare function backlinks<const Target extends ContentCollectionTarget, const Source extends BacklinkSource | ReadonlyArray<BacklinkSource>, P extends PopulateSpec | undefined = undefined>(handle: Target, options: BacklinksOptions<Target, Source, P>): Promise<BacklinksResult<Source, P>>;
|
|
10
10
|
export declare function variants<H extends ContentCollectionTarget>(handle: H, options: VariantsOptions<H>): Promise<Array<ContentVariant<H extends {
|
|
@@ -12,9 +12,9 @@ export declare function variants<H extends ContentCollectionTarget>(handle: H, o
|
|
|
12
12
|
_output: infer O;
|
|
13
13
|
};
|
|
14
14
|
} ? O & ParsedContent : ParsedContent>>>;
|
|
15
|
-
export declare function tree<H extends ContentCollectionTarget, Fields extends ReadonlyArray<string> | undefined = undefined>(handle: H,
|
|
15
|
+
export declare function tree<H extends ContentCollectionTarget, Fields extends ReadonlyArray<string> | undefined = undefined>(handle: H, ...args: OptionsArg<H, Omit<TreeOptions<H>, 'fields'> & {
|
|
16
16
|
fields?: Fields;
|
|
17
|
-
}): Promise<ContentTreeItem<H extends {
|
|
17
|
+
}>): Promise<ContentTreeItem<H extends {
|
|
18
18
|
__schema: {
|
|
19
19
|
_output: infer O;
|
|
20
20
|
};
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
resolveOne as resolveOneWithContext,
|
|
10
10
|
tree as treeWithContext,
|
|
11
11
|
variants as variantsWithContext
|
|
12
|
-
} from "
|
|
12
|
+
} from "../../../features/query/unified";
|
|
13
13
|
export const createClientContentQueryContext = () => {
|
|
14
14
|
const runtime = getContentRuntime();
|
|
15
15
|
const fetcher = getContentApiFetcher();
|
|
@@ -26,7 +26,8 @@ export async function resolveOne(handle, options) {
|
|
|
26
26
|
export async function one(handle, options) {
|
|
27
27
|
return await oneWithContext(createClientContentQueryContext(), handle, options);
|
|
28
28
|
}
|
|
29
|
-
export async function many(handle,
|
|
29
|
+
export async function many(handle, ...args) {
|
|
30
|
+
const options = args[0] ?? {};
|
|
30
31
|
return await manyWithContext(createClientContentQueryContext(), handle, options);
|
|
31
32
|
}
|
|
32
33
|
export async function paginate(handle, options) {
|
|
@@ -38,7 +39,8 @@ export async function backlinks(handle, options) {
|
|
|
38
39
|
export async function variants(handle, options) {
|
|
39
40
|
return await variantsWithContext(createClientContentQueryContext(), handle, options);
|
|
40
41
|
}
|
|
41
|
-
export async function tree(handle,
|
|
42
|
+
export async function tree(handle, ...args) {
|
|
43
|
+
const options = args[0] ?? {};
|
|
42
44
|
return await treeWithContext(createClientContentQueryContext(), handle, options);
|
|
43
45
|
}
|
|
44
46
|
export async function neighbors(handle, options) {
|
|
@@ -5,7 +5,7 @@ export declare function useContentSwitchLocalePath(): (locale: string) => string
|
|
|
5
5
|
export declare function useContentRoute(value: MaybeRefOrGetter<ContentRouteValue>): {
|
|
6
6
|
switchLocalePath: (locale: string) => string;
|
|
7
7
|
localePaths: ComputedRef<Record<string, string>>;
|
|
8
|
-
|
|
8
|
+
unprefixedPath: ComputedRef<string | undefined>;
|
|
9
9
|
path: ComputedRef<string | undefined>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -25,7 +25,7 @@ const syncPublishedContentRoute = (meta, setI18nParams) => {
|
|
|
25
25
|
meta[CONTENT_ROUTE_META_KEY] = {
|
|
26
26
|
token: activePublisher.token,
|
|
27
27
|
path: activePublisher.path,
|
|
28
|
-
|
|
28
|
+
unprefixedPath: activePublisher.unprefixedPath,
|
|
29
29
|
localePaths: activePublisher.localePaths
|
|
30
30
|
};
|
|
31
31
|
setI18nParams(activePublisher.localeParams);
|
|
@@ -46,7 +46,7 @@ const normalizeContentRoute = (value) => {
|
|
|
46
46
|
}
|
|
47
47
|
return {
|
|
48
48
|
path: value.path,
|
|
49
|
-
|
|
49
|
+
unprefixedPath: value.unprefixedPath,
|
|
50
50
|
localePaths: stringPaths
|
|
51
51
|
};
|
|
52
52
|
};
|
|
@@ -58,7 +58,7 @@ const normalizeRoutePath = (path) => {
|
|
|
58
58
|
};
|
|
59
59
|
const contentRouteMatches = (contentRoute, path) => {
|
|
60
60
|
const normalizedPath = normalizeRoutePath(path);
|
|
61
|
-
return normalizeRoutePath(contentRoute.path) === normalizedPath || normalizeRoutePath(contentRoute.
|
|
61
|
+
return normalizeRoutePath(contentRoute.path) === normalizedPath || normalizeRoutePath(contentRoute.unprefixedPath) === normalizedPath || Object.values(contentRoute.localePaths).some((localePath) => normalizeRoutePath(localePath) === normalizedPath);
|
|
62
62
|
};
|
|
63
63
|
const resolveLocalizedRouteParams = (page, router, route, getRouteBaseName) => {
|
|
64
64
|
if (!page) {
|
|
@@ -144,7 +144,7 @@ export function useContentRoute(value) {
|
|
|
144
144
|
return {
|
|
145
145
|
switchLocalePath: useContentSwitchLocalePath(),
|
|
146
146
|
localePaths: computed(() => activeContentRoute.value?.localePaths || {}),
|
|
147
|
-
|
|
147
|
+
unprefixedPath: computed(() => activeContentRoute.value?.unprefixedPath),
|
|
148
148
|
path: computed(() => activeContentRoute.value?.path)
|
|
149
149
|
};
|
|
150
150
|
}
|
|
@@ -90,7 +90,7 @@ const loadSearchSections = async (collection, options) => {
|
|
|
90
90
|
loadPages: async (extraFields) => {
|
|
91
91
|
return await many(collection, {
|
|
92
92
|
...locale ? { locale } : {},
|
|
93
|
-
select: ["
|
|
93
|
+
select: ["path", "title", "description", "body", ...extraFields]
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -4,7 +4,7 @@ import { createClientContentQueryContext } from "./query-api.js";
|
|
|
4
4
|
import {
|
|
5
5
|
one as oneWithContext,
|
|
6
6
|
resolveOne as resolveOneWithContext
|
|
7
|
-
} from "
|
|
7
|
+
} from "../../../features/query/unified";
|
|
8
8
|
import { contentCollectionName, resolveOptions, stableKey } from "./use-content-shared.js";
|
|
9
9
|
export async function useContentOne(handle, options) {
|
|
10
10
|
const resolved = computed(() => resolveOptions(options));
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
many as manyWithContext,
|
|
7
7
|
paginate as paginateWithContext,
|
|
8
8
|
variants as variantsWithContext
|
|
9
|
-
} from "
|
|
9
|
+
} from "../../../features/query/unified";
|
|
10
10
|
import { contentCollectionName, resolveOptions, stableKey } from "./use-content-shared.js";
|
|
11
11
|
export async function useContentMany(handle, options = {}) {
|
|
12
12
|
const resolved = computed(() => resolveOptions(options));
|
|
@@ -2,11 +2,11 @@ import { computed } from "vue";
|
|
|
2
2
|
import { useAsyncData } from "#imports";
|
|
3
3
|
import { resolveCollectionI18n } from "../../../features/localization/path";
|
|
4
4
|
import { createClientContentQueryContext } from "./query-api.js";
|
|
5
|
-
import { neighbors as neighborsWithContext, tree as treeWithContext } from "
|
|
5
|
+
import { neighbors as neighborsWithContext, tree as treeWithContext } from "../../../features/query/unified";
|
|
6
6
|
import { getContentRoute, getContentRuntime } from "./runtime.js";
|
|
7
7
|
import { contentCollectionName, resolveLocaleFromRoutePath, resolveOptions, stableKey } from "./use-content-shared.js";
|
|
8
8
|
const navigationNodeId = (item) => {
|
|
9
|
-
const id = item.id ?? item.
|
|
9
|
+
const id = item.id ?? item.id ?? item.canonicalKey ?? item.path ?? item.path ?? item.title;
|
|
10
10
|
return typeof id === "string" && id.length ? id : item.title;
|
|
11
11
|
};
|
|
12
12
|
export const normalizeContentNavigation = (items = []) => {
|