@lupinum/ginko-content 0.1.5 → 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.
Files changed (230) hide show
  1. package/compatibility.json +1 -1
  2. package/dist/cli.mjs +2 -2
  3. package/dist/cms-contract/build.js +15 -20
  4. package/dist/cms-contract/types.d.ts +12 -7
  5. package/dist/core/content/document +1 -0
  6. package/dist/core/content/document.d.ts +16 -0
  7. package/dist/core/content/document.js +2 -0
  8. package/dist/core/content/graph.d.ts +3 -1
  9. package/dist/core/content/graph.js +21 -20
  10. package/dist/core/content/locale.d.ts +6 -1
  11. package/dist/core/content/locale.js +17 -6
  12. package/dist/core/content/path.d.ts +5 -5
  13. package/dist/core/content/path.js +8 -8
  14. package/dist/core/content/snapshot +1 -0
  15. package/dist/core/content/snapshot.d.ts +25 -0
  16. package/dist/core/content/snapshot.js +99 -0
  17. package/dist/core/provider-errors.d.ts +1 -1
  18. package/dist/core/provider-errors.js +1 -0
  19. package/dist/core/query/builder.js +3 -3
  20. package/dist/core/query/execute.js +75 -36
  21. package/dist/core/query/filter.js +2 -2
  22. package/dist/core/query/lower.js +79 -3
  23. package/dist/core/query/params.js +7 -7
  24. package/dist/core/query/plan.d.ts +18 -0
  25. package/dist/core/query/plan.js +7 -0
  26. package/dist/core/references/resolve.js +6 -9
  27. package/dist/features/agent/agent-markdown +1 -0
  28. package/dist/features/agent/agent-markdown.d.ts +116 -0
  29. package/dist/features/agent/agent-markdown.js +138 -0
  30. package/dist/features/agent/walker +1 -0
  31. package/dist/features/agent/walker.d.ts +10 -0
  32. package/dist/features/agent/walker.js +174 -0
  33. package/dist/features/collections/resolve.d.ts +2 -2
  34. package/dist/features/collections/resolve.js +19 -16
  35. package/dist/features/localization/links.js +1 -1
  36. package/dist/features/localization/results.d.ts +3 -3
  37. package/dist/features/localization/results.js +46 -41
  38. package/dist/features/localization/translated-slugs.js +5 -5
  39. package/dist/features/navigation/build.d.ts +2 -2
  40. package/dist/features/navigation/build.js +23 -26
  41. package/dist/features/navigation/canonical.d.ts +10 -11
  42. package/dist/features/navigation/canonical.js +26 -21
  43. package/dist/features/navigation/resolve.js +4 -4
  44. package/dist/features/navigation/tree.js +3 -3
  45. package/dist/{runtime → features}/query/backlinks.js +3 -5
  46. package/dist/{runtime → features}/query/documents.js +1 -1
  47. package/dist/{runtime → features}/query/localized-docs.d.ts +1 -1
  48. package/dist/{runtime → features}/query/localized-docs.js +3 -6
  49. package/dist/{runtime → features}/query/navigation.d.ts +1 -1
  50. package/dist/{runtime → features}/query/navigation.js +8 -8
  51. package/dist/{runtime → features}/query/populate.js +6 -14
  52. package/dist/{runtime → features}/query/unified.d.ts +4 -4
  53. package/dist/{runtime → features}/query/unified.js +4 -2
  54. package/dist/{runtime → features}/query/variants.js +4 -4
  55. package/dist/features/search/navigation.js +2 -2
  56. package/dist/features/search/sections.d.ts +1 -1
  57. package/dist/features/search/sections.js +1 -1
  58. package/dist/features/sitemap/query.d.ts +5 -5
  59. package/dist/features/sitemap/query.js +6 -6
  60. package/dist/integrations/nitro/ingest.js +9 -20
  61. package/dist/integrations/nitro/storage.d.ts +1 -0
  62. package/dist/integrations/nitro/storage.js +21 -34
  63. package/dist/module.d.mts +135 -803
  64. package/dist/module.json +1 -1
  65. package/dist/module.mjs +143 -51
  66. package/dist/parsers/csv.js +3 -3
  67. package/dist/parsers/index.js +3 -3
  68. package/dist/parsers/json.js +8 -6
  69. package/dist/parsers/markdown-plugins.js +9 -5
  70. package/dist/parsers/markdown.js +7 -6
  71. package/dist/parsers/path-meta.js +21 -19
  72. package/dist/parsers/reserved +1 -0
  73. package/dist/parsers/reserved.d.ts +15 -0
  74. package/dist/parsers/reserved.js +35 -0
  75. package/dist/parsers/yaml.js +6 -4
  76. package/dist/public/agent +1 -0
  77. package/dist/public/agent.d.ts +17 -0
  78. package/dist/public/agent.js +34 -0
  79. package/dist/public/client.d.ts +2 -3
  80. package/dist/public/client.js +1 -2
  81. package/dist/public/provider-query +1 -0
  82. package/dist/public/provider-query.d.ts +58 -0
  83. package/dist/public/provider-query.js +5 -0
  84. package/dist/public/provider.d.ts +8 -3
  85. package/dist/public/provider.js +2 -0
  86. package/dist/public/server.d.ts +7 -12
  87. package/dist/public/server.js +5 -36
  88. package/dist/runtime/app/components/ContentRenderer.d.vue.ts +3 -3
  89. package/dist/runtime/app/components/ContentRenderer.vue +2 -2
  90. package/dist/runtime/app/components/ContentRenderer.vue.d.ts +3 -3
  91. package/dist/runtime/app/components/ContentRendererInline.d.vue.ts +1 -1
  92. package/dist/runtime/app/components/ContentRendererInline.vue.d.ts +1 -1
  93. package/dist/runtime/app/components/Prose/ProseImg.d.vue.ts +4 -4
  94. package/dist/runtime/app/components/Prose/ProseImg.vue.d.ts +4 -4
  95. package/dist/runtime/app/components/Prose/ProsePre.d.vue.ts +1 -1
  96. package/dist/runtime/app/components/Prose/ProsePre.vue.d.ts +1 -1
  97. package/dist/runtime/app/components/internal/ContentRendererMarkdown.d.vue.ts +1 -1
  98. package/dist/runtime/app/components/internal/ContentRendererMarkdown.vue +4 -4
  99. package/dist/runtime/app/components/internal/ContentRendererMarkdown.vue.d.ts +1 -1
  100. package/dist/runtime/app/components/internal/MarkdownRenderer.d.ts +3 -3
  101. package/dist/runtime/app/composables/preview.d.ts +1 -1
  102. package/dist/runtime/app/composables/query-api.d.ts +5 -5
  103. package/dist/runtime/app/composables/query-api.js +5 -3
  104. package/dist/runtime/app/composables/route.d.ts +1 -1
  105. package/dist/runtime/app/composables/route.js +4 -4
  106. package/dist/runtime/app/composables/search.js +1 -1
  107. package/dist/runtime/app/composables/use-content-document.js +1 -1
  108. package/dist/runtime/app/composables/use-content-list.js +1 -1
  109. package/dist/runtime/app/composables/use-content-navigation.js +2 -2
  110. package/dist/runtime/app/composables/use-content-page.js +4 -4
  111. package/dist/runtime/app/pages/content.vue +2 -1
  112. package/dist/runtime/markdown/plugins.js +6 -8
  113. package/dist/runtime/server/agent-markdown.d.ts +5 -65
  114. package/dist/runtime/server/agent-markdown.js +40 -315
  115. package/dist/runtime/server/agent-site.js +9 -2
  116. package/dist/runtime/server/api/agent-raw.js +1 -1
  117. package/dist/runtime/server/api/cache.d.ts +1 -1
  118. package/dist/runtime/server/api/cache.js +43 -4
  119. package/dist/runtime/server/api/locales.js +3 -3
  120. package/dist/runtime/server/api/navigation.d.ts +1 -1
  121. package/dist/runtime/server/api/navigation.js +3 -1
  122. package/dist/runtime/server/api/query.js +2 -2
  123. package/dist/runtime/server/api/search-index.d.ts +1 -1
  124. package/dist/runtime/server/api/sitemap.d.ts +1 -1
  125. package/dist/runtime/server/cache-adapters.d.ts +18 -0
  126. package/dist/runtime/server/cache-adapters.js +12 -0
  127. package/dist/runtime/server/collection-helpers.d.ts +2 -2
  128. package/dist/runtime/server/collection-helpers.js +15 -11
  129. package/dist/runtime/server/index.d.ts +6 -4
  130. package/dist/runtime/server/index.js +10 -3
  131. package/dist/runtime/server/middleware/agent-link-headers.js +1 -1
  132. package/dist/runtime/server/middleware/agent-markdown.js +1 -1
  133. package/dist/runtime/server/navigation-query.d.ts +2 -2
  134. package/dist/runtime/server/navigation-query.js +52 -7
  135. package/dist/runtime/server/navigation.d.ts +1 -1
  136. package/dist/runtime/server/provider-document +1 -0
  137. package/dist/runtime/server/provider-document.d.ts +59 -0
  138. package/dist/runtime/server/provider-document.js +48 -0
  139. package/dist/runtime/server/provider-query-wire +1 -0
  140. package/dist/runtime/server/provider-query-wire.d.ts +32 -0
  141. package/dist/runtime/server/provider-query-wire.js +27 -0
  142. package/dist/runtime/server/provider-query.d.ts +18 -9
  143. package/dist/runtime/server/provider-query.js +62 -28
  144. package/dist/runtime/server/provider-result.d.ts +4 -4
  145. package/dist/runtime/server/providers/filesystem.js +3 -11
  146. package/dist/runtime/server/providers/index.d.ts +18 -1
  147. package/dist/runtime/server/providers/index.js +72 -20
  148. package/dist/runtime/server/query-api.d.ts +5 -5
  149. package/dist/runtime/server/query-api.js +9 -6
  150. package/dist/runtime/server/query-executor.d.ts +3 -3
  151. package/dist/runtime/server/query-executor.js +43 -59
  152. package/dist/runtime/server/search.d.ts +1 -1
  153. package/dist/runtime/server/search.js +4 -4
  154. package/dist/runtime/server/sitemap.js +5 -5
  155. package/dist/runtime/server/storage-access.d.ts +4 -1
  156. package/dist/runtime/server/storage-access.js +27 -2
  157. package/dist/runtime/transformers/component-resolver.d.ts +1 -1
  158. package/dist/storage/content.d.ts +2 -6
  159. package/dist/storage/content.js +19 -8
  160. package/dist/storage/contents.d.ts +9 -1
  161. package/dist/storage/contents.js +26 -19
  162. package/dist/storage/driver.d.ts +2 -2
  163. package/dist/storage/driver.js +2 -1
  164. package/dist/storage/graph.js +4 -0
  165. package/dist/storage/manifest.js +3 -1
  166. package/dist/storage/references.js +9 -5
  167. package/dist/storage/snapshot-runtime +1 -0
  168. package/dist/storage/snapshot-runtime.d.ts +11 -0
  169. package/dist/storage/snapshot-runtime.js +46 -0
  170. package/dist/storage/validation.d.ts +1 -1
  171. package/dist/storage/validation.js +79 -105
  172. package/dist/testing/provider-contract.d.ts +14 -4
  173. package/dist/testing/provider-contract.js +121 -68
  174. package/dist/testing/provider-fixture.d.ts +1 -1
  175. package/dist/testing/provider-fixture.js +124 -120
  176. package/dist/types/config.d.ts +17 -4
  177. package/dist/types/content.d.ts +104 -70
  178. package/dist/types/fields.js +1 -1
  179. package/dist/types/module.d.ts +1 -1
  180. package/dist/types/query-parts/public.d.ts +14 -5
  181. package/dist/types/query-parts/results.d.ts +6 -2
  182. package/dist/types/query-parts/transport.d.ts +19 -0
  183. package/dist/types/virtual.d.ts +6 -0
  184. package/dist/types.d.mts +2 -2
  185. package/dist/web-types.json +1 -1
  186. package/package.json +39 -9
  187. package/dist/runtime/app/plugins/markdown-components +0 -1
  188. package/dist/runtime/app/plugins/markdown-components.d.ts +0 -2
  189. package/dist/runtime/app/plugins/markdown-components.js +0 -19
  190. /package/dist/{runtime → features/agent}/agent-paths +0 -0
  191. /package/dist/{runtime → features/agent}/agent-paths.d.ts +0 -0
  192. /package/dist/{runtime → features/agent}/agent-paths.js +0 -0
  193. /package/dist/{runtime → features}/query/backlinks +0 -0
  194. /package/dist/{runtime → features}/query/backlinks.d.ts +0 -0
  195. /package/dist/{runtime → features}/query/context +0 -0
  196. /package/dist/{runtime → features}/query/context.d.ts +0 -0
  197. /package/dist/{runtime → features}/query/context.js +0 -0
  198. /package/dist/{runtime → features}/query/documents +0 -0
  199. /package/dist/{runtime → features}/query/documents.d.ts +0 -0
  200. /package/dist/{runtime → features}/query/errors +0 -0
  201. /package/dist/{runtime → features}/query/errors.d.ts +0 -0
  202. /package/dist/{runtime → features}/query/errors.js +0 -0
  203. /package/dist/{runtime → features}/query/handles +0 -0
  204. /package/dist/{runtime → features}/query/handles.d.ts +0 -0
  205. /package/dist/{runtime → features}/query/handles.js +0 -0
  206. /package/dist/{runtime → features}/query/locale-options +0 -0
  207. /package/dist/{runtime → features}/query/locale-options.d.ts +0 -0
  208. /package/dist/{runtime → features}/query/locale-options.js +0 -0
  209. /package/dist/{runtime → features}/query/localized-docs +0 -0
  210. /package/dist/{runtime → features}/query/navigation +0 -0
  211. /package/dist/{runtime → features}/query/pagination +0 -0
  212. /package/dist/{runtime → features}/query/pagination.d.ts +0 -0
  213. /package/dist/{runtime → features}/query/pagination.js +0 -0
  214. /package/dist/{runtime → features}/query/populate +0 -0
  215. /package/dist/{runtime → features}/query/populate.d.ts +0 -0
  216. /package/dist/{runtime → features}/query/public-limits +0 -0
  217. /package/dist/{runtime → features}/query/public-limits.d.ts +0 -0
  218. /package/dist/{runtime → features}/query/public-limits.js +0 -0
  219. /package/dist/{runtime → features}/query/resolve +0 -0
  220. /package/dist/{runtime → features}/query/resolve.d.ts +0 -0
  221. /package/dist/{runtime → features}/query/resolve.js +0 -0
  222. /package/dist/{runtime → features}/query/responses +0 -0
  223. /package/dist/{runtime → features}/query/responses.d.ts +0 -0
  224. /package/dist/{runtime → features}/query/responses.js +0 -0
  225. /package/dist/{runtime → features}/query/routes +0 -0
  226. /package/dist/{runtime → features}/query/routes.d.ts +0 -0
  227. /package/dist/{runtime → features}/query/routes.js +0 -0
  228. /package/dist/{runtime → features}/query/unified +0 -0
  229. /package/dist/{runtime → features}/query/variants +0 -0
  230. /package/dist/{runtime → features}/query/variants.d.ts +0 -0
@@ -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 '../../query/unified';
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, options?: O & ManyOptions<H, PopulateSpec | undefined>): Promise<Array<LocalizedDoc<PopulatedDocument<DocumentFromHandle<H>, PopulateFromOptions<O>>>>>;
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, options?: Omit<TreeOptions<H>, 'fields'> & {
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 "../../query/unified.js";
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, options = {}) {
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, options = {}) {
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
- canonicalPath: ComputedRef<string | undefined>;
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
- canonicalPath: activePublisher.canonicalPath,
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
- canonicalPath: value.canonicalPath,
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.canonicalPath) === normalizedPath || Object.values(contentRoute.localePaths).some((localePath) => normalizeRoutePath(localePath) === normalizedPath);
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
- canonicalPath: computed(() => activeContentRoute.value?.canonicalPath),
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: ["_path", "title", "description", "body", ...extraFields]
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 "../../query/unified.js";
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 "../../query/unified.js";
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 "../../query/unified.js";
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._id ?? item._canonicalKey ?? item.path ?? item._path ?? item.title;
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 = []) => {
@@ -32,10 +32,10 @@ const localePathMatches = (entry, path) => {
32
32
  const routeMetaMatchesPath = (value, path) => {
33
33
  if (!value) return false;
34
34
  const normalizedPath = normalizeRoutePath(path);
35
- const legacyPath = value;
36
- if (normalizeRoutePath(legacyPath._path) === normalizedPath || normalizeRoutePath(legacyPath._requestedPath) === normalizedPath || normalizeRoutePath(legacyPath._requestedRoute) === normalizedPath) return true;
37
- const requestedRoute = value.resolved?.requestedRoute ?? value._requestedRoute;
38
- return normalizeRoutePath(value.path) === normalizedPath || normalizeRoutePath(value.canonicalPath) === normalizedPath || normalizeRoutePath(requestedRoute) === normalizedPath || Object.values(value.localePaths || {}).some((entry) => localePathMatches(entry, path));
35
+ const resolved = value.resolved;
36
+ if (normalizeRoutePath(value.path) === normalizedPath || normalizeRoutePath(resolved?.requestedPath) === normalizedPath || normalizeRoutePath(resolved?.requestedRoute) === normalizedPath) return true;
37
+ const requestedRoute = resolved?.requestedRoute;
38
+ return normalizeRoutePath(value.path) === normalizedPath || normalizeRoutePath(value.unprefixedPath) === normalizedPath || normalizeRoutePath(requestedRoute) === normalizedPath || Object.values(value.localePaths || {}).some((entry) => localePathMatches(entry, path));
39
39
  };
40
40
  export async function useContentPage(handle, options = {}) {
41
41
  const route = useRoute();
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
- import { setResponseStatus, useContentPage } from "#imports";
2
+ import { setResponseStatus } from "nuxt/app";
3
+ import { useContentPage } from "../composables/use-content";
3
4
  const { page } = await useContentPage("pages", {
4
5
  notFound: false
5
6
  });
@@ -1,23 +1,21 @@
1
1
  import { defineAsyncComponent } from "vue";
2
2
  export { resolveMarkdownPlugins } from "../../parsers/markdown-plugins";
3
+ const importOptionalMarkdownComponent = async (specifier) => await import(
4
+ /* @vite-ignore */
5
+ specifier
6
+ );
3
7
  const builtinMarkdownPlugins = {
4
8
  math: {
5
9
  componentName: "Math",
6
10
  component: defineAsyncComponent(async () => {
7
- const mod = await import(
8
- /* @vite-ignore */
9
- ["@comark/vue", "plugins/math"].join("/")
10
- );
11
+ const mod = await importOptionalMarkdownComponent("@comark/vue/plugins/math");
11
12
  return mod.Math;
12
13
  })
13
14
  },
14
15
  mermaid: {
15
16
  componentName: "Mermaid",
16
17
  component: defineAsyncComponent(async () => {
17
- const mod = await import(
18
- /* @vite-ignore */
19
- ["@comark/vue", "plugins/mermaid"].join("/")
20
- );
18
+ const mod = await importOptionalMarkdownComponent("@comark/vue/plugins/mermaid");
21
19
  return mod.Mermaid;
22
20
  })
23
21
  }
@@ -1,74 +1,14 @@
1
1
  import type { H3Event } from 'h3';
2
- import type { MarkdownNode, ParsedContent } from '../../types/content';
3
- import type { AgentMetadataField, ContentCollectionConfig } from '../../types/config';
4
- export interface AgentMarkdownPublicSignals {
5
- search?: 'yes' | 'no';
6
- aiInput?: 'yes' | 'no';
7
- aiTrain?: 'yes' | 'no';
8
- }
9
- export interface ResolvedAgentMarkdownOptions {
10
- includeInIndex: boolean;
11
- includeInFull: boolean;
12
- metadata: AgentMetadataField[];
13
- }
14
- export interface AgentMarkdown {
15
- path: string;
16
- markdownPath: string;
17
- rawPath: string;
18
- locale?: string;
19
- collection: string;
20
- title: string;
21
- description: string;
22
- markdown: string;
23
- sourceFile?: string;
24
- canonicalUrl: string;
25
- lastModified?: string;
26
- publicSignals?: AgentMarkdownPublicSignals;
27
- metadataFields: string[];
28
- includeInIndex: boolean;
29
- includeInFull: boolean;
30
- }
31
- export type AgentMarkdownMeta = Omit<AgentMarkdown, 'markdown'>;
32
- export interface AgentMarkdownContext {
33
- collection: string;
34
- page: ParsedContent;
35
- path: string;
36
- locale?: string;
37
- prop: (name: string) => string;
38
- props: (node?: MarkdownNode) => Record<string, unknown>;
39
- cleanProps: (node?: MarkdownNode) => Record<string, unknown>;
40
- children: (node?: MarkdownNode) => string;
41
- renderChildren: (node: MarkdownNode) => string;
42
- renderNode: (node: MarkdownNode) => string;
43
- blockquote: (value: string) => string;
44
- jsonFence: (value: unknown) => string;
45
- link: (label: string, href: string) => string;
46
- omitted: (name: string, reason?: string) => string;
47
- xmlComponent: (name: string, props?: Record<string, unknown>, children?: string) => string;
48
- }
49
- export type AgentMarkdownSerializer = (node: MarkdownNode, ctx: AgentMarkdownContext) => string | null | undefined;
50
- export type AgentMarkdownSerializerMap = Record<string, AgentMarkdownSerializer>;
51
- export interface AgentMarkdownSerializerRegistrationOptions {
52
- override?: boolean;
53
- }
54
- export interface AgentMarkdownComponent {
55
- render: AgentMarkdownSerializer;
56
- }
57
- export type AgentMarkdownComponentMap = Record<string, AgentMarkdownComponent>;
58
- export declare const getMarkdownProp: (node: MarkdownNode, name: string) => string;
59
- export declare const renderMarkdownChildren: (node: MarkdownNode, ctx: AgentMarkdownContext) => string;
60
- export declare const blockquoteMarkdown: (value: string) => string;
61
- export declare const linkMarkdown: (label: string, href: string) => string;
62
- export declare const imageMarkdown: (alt: string, src: string) => string;
63
- export declare const jsonFenceMarkdown: (value: unknown) => string;
64
- export declare const xmlComponentMarkdown: (name: string, props?: Record<string, unknown>, children?: string) => string;
2
+ import type { AgentMarkdown, AgentMarkdownComponent, AgentMarkdownComponentMap, AgentMarkdownMeta, AgentMarkdownRegistry, AgentMarkdownSerializer, AgentMarkdownSerializerMap, AgentMarkdownSerializerRegistrationOptions } from '../../features/agent/agent-markdown';
3
+ export * from '../../features/agent/agent-markdown';
4
+ export { renderAgentMarkdownBody } from '../../features/agent/walker';
5
+ /** The current app's serializer registry the walker resolves tags against. */
6
+ export declare const getAgentMarkdownRegistry: () => AgentMarkdownRegistry;
65
7
  export declare const registerAgentMarkdownSerializer: (name: string, serializer: AgentMarkdownSerializer, options?: AgentMarkdownSerializerRegistrationOptions) => void;
66
8
  export declare const registerAgentMarkdownSerializers: (entries: AgentMarkdownSerializerMap, options?: AgentMarkdownSerializerRegistrationOptions) => void;
67
- export declare const defineAgentMarkdownComponent: (component: AgentMarkdownComponent) => AgentMarkdownComponent;
68
9
  export declare const registerAgentMarkdownComponent: (name: string, component: AgentMarkdownComponent, options?: AgentMarkdownSerializerRegistrationOptions) => void;
69
10
  export declare const registerAgentMarkdownComponents: (entries: AgentMarkdownComponentMap, options?: AgentMarkdownSerializerRegistrationOptions) => void;
70
11
  export declare const clearAgentMarkdownSerializers: () => void;
71
- export declare const resolveAgentMarkdownOptions: (collection: ContentCollectionConfig | undefined) => ResolvedAgentMarkdownOptions | null;
72
12
  export declare function resolveContentMarkdown(event: H3Event, collection: string, routeOrPath?: string, options?: {
73
13
  locale?: string;
74
14
  }): Promise<AgentMarkdown | null>;