@hamur/content 0.0.0-stage → 0.0.2

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 (183) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +14 -2
  3. package/dist/chunks/bun-render-65mwzeq2.js +58 -0
  4. package/dist/chunks/bun-render-7jxnxg3v.js +714 -0
  5. package/dist/chunks/bun-render-mxhn5twt.js +130 -0
  6. package/dist/chunks/bun-render-w7fh3fg7.js +36 -0
  7. package/dist/src/adapters/html.js +134 -0
  8. package/dist/src/adapters/preact.js +126 -0
  9. package/dist/src/adapters/react.js +116 -0
  10. package/dist/src/adapters/solid.js +153 -0
  11. package/dist/src/adapters/svelte.js +90 -0
  12. package/dist/src/adapters/vue.js +166 -0
  13. package/dist/src/index.js +2732 -0
  14. package/dist/src/query.js +97 -0
  15. package/dist/src/render.js +12 -0
  16. package/dist/src/server/index.js +349 -0
  17. package/dist/types/src/adapters/html.d.ts +54 -0
  18. package/dist/types/src/adapters/page.d.ts +21 -0
  19. package/dist/types/src/adapters/preact.d.ts +53 -0
  20. package/dist/types/src/adapters/prose.d.ts +21 -0
  21. package/dist/types/src/adapters/react.d.ts +53 -0
  22. package/dist/types/src/adapters/search.d.ts +12 -0
  23. package/dist/types/src/adapters/solid.d.ts +54 -0
  24. package/dist/types/src/adapters/svelte-page.d.ts +9 -0
  25. package/dist/types/src/adapters/svelte-search.d.ts +9 -0
  26. package/dist/types/src/adapters/svelte.d.ts +24 -0
  27. package/dist/types/src/adapters/vue.d.ts +189 -0
  28. package/dist/types/src/build/api.d.ts +24 -0
  29. package/dist/types/src/build/dev-route.d.ts +4 -0
  30. package/dist/types/src/build/dev.d.ts +48 -0
  31. package/dist/types/src/build/graphql.d.ts +10 -0
  32. package/dist/types/src/build/image.d.ts +16 -0
  33. package/dist/types/src/build/index.d.ts +76 -0
  34. package/dist/types/src/build/live.d.ts +6 -0
  35. package/dist/types/src/build/prerender.d.ts +8 -0
  36. package/dist/types/src/build/query.d.ts +10 -0
  37. package/dist/types/src/build/raw.d.ts +23 -0
  38. package/dist/types/src/build/search.d.ts +9 -0
  39. package/dist/types/src/build/types.d.ts +16 -0
  40. package/dist/types/src/component.d.ts +10 -0
  41. package/dist/types/src/config.d.ts +6 -0
  42. package/dist/types/src/define.d.ts +14 -0
  43. package/dist/types/src/error.d.ts +4 -0
  44. package/dist/types/src/image.d.ts +15 -0
  45. package/dist/types/src/index.d.ts +64 -0
  46. package/dist/types/src/loaders/data.d.ts +12 -0
  47. package/dist/types/src/loaders/file.d.ts +3 -0
  48. package/dist/types/src/loaders/git.d.ts +27 -0
  49. package/dist/types/src/loaders/glob.d.ts +14 -0
  50. package/dist/types/src/module.d.ts +3 -0
  51. package/dist/types/src/query.d.ts +17 -0
  52. package/dist/types/src/render.d.ts +9 -0
  53. package/dist/types/src/runtime/client.d.ts +25 -0
  54. package/dist/types/src/runtime/dev-client.d.ts +4 -0
  55. package/dist/types/src/runtime/dev-plugin.d.ts +12 -0
  56. package/dist/types/src/runtime/dev-store.d.ts +5 -0
  57. package/dist/types/src/runtime/live.d.ts +36 -0
  58. package/dist/types/src/runtime/navigation.d.ts +35 -0
  59. package/dist/types/src/runtime/page-plugin.d.ts +2 -0
  60. package/dist/types/src/runtime/page-source.d.ts +12 -0
  61. package/dist/types/src/runtime/query.d.ts +100 -0
  62. package/dist/types/src/runtime/raw-path.d.ts +2 -0
  63. package/dist/types/src/runtime/refresh-body.d.ts +4 -0
  64. package/dist/types/src/runtime/search-loaders.d.ts +7 -0
  65. package/dist/types/src/runtime/search-plugin.d.ts +2 -0
  66. package/dist/types/src/runtime/search-store.d.ts +19 -0
  67. package/dist/types/src/runtime/search.d.ts +28 -0
  68. package/dist/types/src/runtime/sections.d.ts +36 -0
  69. package/dist/types/src/runtime/server-store.d.ts +4 -0
  70. package/dist/types/src/runtime/store.d.ts +31 -0
  71. package/dist/types/src/server/door-dev-static.d.ts +3 -0
  72. package/dist/types/src/server/door-dev.d.ts +4 -0
  73. package/dist/types/src/server/door-static.d.ts +2 -0
  74. package/dist/types/src/server/door.d.ts +3 -0
  75. package/dist/types/src/server/endpoint.d.ts +1 -0
  76. package/dist/types/src/server/graphql.d.ts +24 -0
  77. package/dist/types/src/server/index.d.ts +10 -0
  78. package/dist/types/src/server/install.d.ts +1 -0
  79. package/dist/types/src/server/live.d.ts +10 -0
  80. package/dist/types/src/server/query.d.ts +15 -0
  81. package/dist/types/src/server/refresh.d.ts +2 -0
  82. package/dist/types/src/server/rest.d.ts +62 -0
  83. package/dist/types/src/server/search.d.ts +5 -0
  84. package/dist/types/src/server-config.d.ts +12 -0
  85. package/dist/types/src/source.d.ts +24 -0
  86. package/dist/types/src/types.d.ts +293 -0
  87. package/package.json +140 -4
  88. package/src/adapters/ContentRenderer.svelte +27 -0
  89. package/src/adapters/ProseA.svelte +11 -0
  90. package/src/adapters/ProseBlockquote.svelte +7 -0
  91. package/src/adapters/ProseCode.svelte +7 -0
  92. package/src/adapters/ProseEm.svelte +7 -0
  93. package/src/adapters/ProseH1.svelte +7 -0
  94. package/src/adapters/ProseH2.svelte +7 -0
  95. package/src/adapters/ProseH3.svelte +7 -0
  96. package/src/adapters/ProseH4.svelte +7 -0
  97. package/src/adapters/ProseH5.svelte +7 -0
  98. package/src/adapters/ProseH6.svelte +7 -0
  99. package/src/adapters/ProseHr.svelte +5 -0
  100. package/src/adapters/ProseImg.svelte +5 -0
  101. package/src/adapters/ProseLi.svelte +7 -0
  102. package/src/adapters/ProseOl.svelte +7 -0
  103. package/src/adapters/ProseP.svelte +7 -0
  104. package/src/adapters/ProsePre.svelte +21 -0
  105. package/src/adapters/ProseStrong.svelte +7 -0
  106. package/src/adapters/ProseTable.svelte +7 -0
  107. package/src/adapters/ProseUl.svelte +7 -0
  108. package/src/adapters/html.ts +152 -0
  109. package/src/adapters/page.ts +52 -0
  110. package/src/adapters/preact.ts +154 -0
  111. package/src/adapters/prose.ts +55 -0
  112. package/src/adapters/react.ts +142 -0
  113. package/src/adapters/search.ts +32 -0
  114. package/src/adapters/solid.ts +183 -0
  115. package/src/adapters/svelte-defaults.ts +41 -0
  116. package/src/adapters/svelte-page.ts +29 -0
  117. package/src/adapters/svelte-search.ts +36 -0
  118. package/src/adapters/svelte.ts +30 -0
  119. package/src/adapters/test/OwnA.svelte +7 -0
  120. package/src/adapters/test/OwnH1.svelte +7 -0
  121. package/src/adapters/test/OwnPre.svelte +7 -0
  122. package/src/adapters/test/support.ts +106 -0
  123. package/src/adapters/vue.ts +182 -0
  124. package/src/build/api.ts +201 -0
  125. package/src/build/dev-route.ts +5 -0
  126. package/src/build/dev.ts +299 -0
  127. package/src/build/graphql.ts +197 -0
  128. package/src/build/image.ts +60 -0
  129. package/src/build/index.ts +597 -0
  130. package/src/build/live.ts +34 -0
  131. package/src/build/prerender.ts +34 -0
  132. package/src/build/query.ts +70 -0
  133. package/src/build/raw.ts +157 -0
  134. package/src/build/search.ts +64 -0
  135. package/src/build/types.ts +108 -0
  136. package/src/component.ts +86 -0
  137. package/src/config.ts +156 -0
  138. package/src/define.ts +33 -0
  139. package/src/env.d.ts +34 -0
  140. package/src/error.ts +4 -0
  141. package/src/image.ts +41 -0
  142. package/src/index.ts +103 -0
  143. package/src/loaders/data.ts +186 -0
  144. package/src/loaders/file.ts +53 -0
  145. package/src/loaders/git.ts +266 -0
  146. package/src/loaders/glob.ts +179 -0
  147. package/src/module.ts +26 -0
  148. package/src/query.ts +82 -0
  149. package/src/render.ts +16 -0
  150. package/src/runtime/client.ts +75 -0
  151. package/src/runtime/dev-client.ts +6 -0
  152. package/src/runtime/dev-plugin.ts +64 -0
  153. package/src/runtime/dev-store.ts +19 -0
  154. package/src/runtime/live.ts +331 -0
  155. package/src/runtime/navigation.ts +225 -0
  156. package/src/runtime/page-plugin.ts +13 -0
  157. package/src/runtime/page-source.ts +22 -0
  158. package/src/runtime/query.ts +605 -0
  159. package/src/runtime/raw-path.ts +2 -0
  160. package/src/runtime/refresh-body.ts +22 -0
  161. package/src/runtime/search-loaders.ts +14 -0
  162. package/src/runtime/search-plugin.ts +6 -0
  163. package/src/runtime/search-store.ts +73 -0
  164. package/src/runtime/search.ts +126 -0
  165. package/src/runtime/sections.ts +155 -0
  166. package/src/runtime/server-store.ts +12 -0
  167. package/src/runtime/store.ts +59 -0
  168. package/src/server/door-dev-static.ts +6 -0
  169. package/src/server/door-dev.ts +7 -0
  170. package/src/server/door-static.ts +4 -0
  171. package/src/server/door.ts +6 -0
  172. package/src/server/endpoint.ts +17 -0
  173. package/src/server/graphql.ts +59 -0
  174. package/src/server/index.ts +17 -0
  175. package/src/server/install.ts +6 -0
  176. package/src/server/live.ts +51 -0
  177. package/src/server/query.ts +46 -0
  178. package/src/server/refresh.ts +19 -0
  179. package/src/server/rest.ts +157 -0
  180. package/src/server/search.ts +22 -0
  181. package/src/server-config.ts +24 -0
  182. package/src/source.ts +99 -0
  183. package/src/types.ts +282 -0
@@ -0,0 +1,12 @@
1
+ import { type SearchCollection } from "../runtime/search-store.ts";
2
+ export type { SearchHit } from "../runtime/search.ts";
3
+ export type { SearchOptions, SearchStatus } from "../runtime/search-store.ts";
4
+ export interface UseSearchCollectionOptions {
5
+ /** Loads the index when the component mounts instead of on the first `search()`; default `false`. */
6
+ immediate?: boolean;
7
+ }
8
+ /** The collection's search state, one per page load; throws for a collection that `content.search.collections` does not list. */
9
+ export declare function searchCollectionOf(name: string): SearchCollection;
10
+ /** `hamur dev`: the collection's index, when a page loaded it, is loaded again. */
11
+ export declare function forgetSearch(name: string): void;
12
+ export declare const ignore: () => void;
@@ -0,0 +1,54 @@
1
+ import { type Accessor, type Component } from "solid-js";
2
+ import { type JSX } from "@solidjs/web";
3
+ import type { MdRoot } from "hamur/markdown";
4
+ import type { CollectionName } from "../index.ts";
5
+ import type { PageFields } from "../types.ts";
6
+ import { type ContentPage } from "./page.ts";
7
+ import { type SearchHit, type SearchOptions, type SearchStatus, type UseSearchCollectionOptions } from "./search.ts";
8
+ export type { ContentPage, SearchHit, SearchOptions, SearchStatus, UseSearchCollectionOptions };
9
+ export interface ContentRendererProps {
10
+ /** A page entry, which renders its `body`, or a Markdown AST. */
11
+ value: PageFields | MdRoot;
12
+ /** Markdown components by kebab-case name and prose components by `Prose<Tag>` name; `false` registers none. */
13
+ components?: Record<string, Component<any>> | false;
14
+ /** The wrapper element; `"div"` by default. */
15
+ tag?: string;
16
+ /** Renders the entry's `excerpt` instead of its `body`. */
17
+ excerpt?: boolean;
18
+ /** Space-separated tags whose element is dropped and whose children are kept. */
19
+ unwrap?: string;
20
+ }
21
+ export type ProseProps = Record<string, unknown> & {
22
+ children?: JSX.Element;
23
+ };
24
+ export declare const ProseH1: (props: ProseProps) => JSX.Element;
25
+ export declare const ProseH2: (props: ProseProps) => JSX.Element;
26
+ export declare const ProseH3: (props: ProseProps) => JSX.Element;
27
+ export declare const ProseH4: (props: ProseProps) => JSX.Element;
28
+ export declare const ProseH5: (props: ProseProps) => JSX.Element;
29
+ export declare const ProseH6: (props: ProseProps) => JSX.Element;
30
+ export declare const ProseP: (props: ProseProps) => JSX.Element;
31
+ export declare const ProseUl: (props: ProseProps) => JSX.Element;
32
+ export declare const ProseOl: (props: ProseProps) => JSX.Element;
33
+ export declare const ProseLi: (props: ProseProps) => JSX.Element;
34
+ export declare const ProseBlockquote: (props: ProseProps) => JSX.Element;
35
+ export declare const ProseCode: (props: ProseProps) => JSX.Element;
36
+ export declare const ProseImg: (props: ProseProps) => JSX.Element;
37
+ export declare const ProseTable: (props: ProseProps) => JSX.Element;
38
+ export declare const ProseHr: (props: ProseProps) => JSX.Element;
39
+ export declare const ProseStrong: (props: ProseProps) => JSX.Element;
40
+ export declare const ProseEm: (props: ProseProps) => JSX.Element;
41
+ /** An internal `href` is a `Link`, as `MarkdownRenderer` writes it. */
42
+ export declare function ProseA(props: ProseProps): JSX.Element;
43
+ export declare function ProsePre(props: ProseProps): JSX.Element;
44
+ /** A page entry's body, or a Markdown AST, through `MarkdownRenderer` with the prose components of `components`. */
45
+ export declare function ContentRenderer(props: ContentRendererProps): JSX.Element;
46
+ export interface UseSearchCollectionResult {
47
+ status: Accessor<SearchStatus>;
48
+ search(query: string, options?: SearchOptions): Promise<SearchHit[]>;
49
+ init(): Promise<void>;
50
+ }
51
+ /** The collection's search index, loaded on the first `search()` or `init()`, or at mount with `immediate`; `status` is a signal. */
52
+ export declare function useSearchCollection(name: string, { immediate }?: UseSearchCollectionOptions): UseSearchCollectionResult;
53
+ /** An accessor of the entry of `collection` whose `path` is the route path, `undefined` while it loads; reading it throws the 404 when there is none. */
54
+ export declare function useContentPage<N extends CollectionName>(collection: N): Accessor<ContentPage<N> | undefined>;
@@ -0,0 +1,9 @@
1
+ import type { CollectionName } from "../index.ts";
2
+ import { type ContentPage } from "./page.ts";
3
+ export type { ContentPage };
4
+ export interface UseContentPageResult<N extends string> {
5
+ /** The entry whose `path` is the route path, `undefined` while it loads; reading it throws the 404 when there is none. */
6
+ readonly page: ContentPage<N> | undefined;
7
+ }
8
+ /** The entry of `collection` whose `path` is the route path; `page` is reactive where it is read. */
9
+ export declare function useContentPage<N extends CollectionName>(collection: N): UseContentPageResult<N>;
@@ -0,0 +1,9 @@
1
+ import { type SearchHit, type SearchOptions, type SearchStatus, type UseSearchCollectionOptions } from "./search.ts";
2
+ export type { SearchHit, SearchOptions, SearchStatus, UseSearchCollectionOptions };
3
+ export interface UseSearchCollectionResult {
4
+ readonly status: SearchStatus;
5
+ search(query: string, options?: SearchOptions): Promise<SearchHit[]>;
6
+ init(): Promise<void>;
7
+ }
8
+ /** The collection's search index, loaded on the first `search()` or `init()`, or at mount with `immediate`; `status` is reactive where it is read. */
9
+ export declare function useSearchCollection(name: string, { immediate }?: UseSearchCollectionOptions): UseSearchCollectionResult;
@@ -0,0 +1,24 @@
1
+ export { default as ContentRenderer } from "./ContentRenderer.svelte";
2
+ export { default as ProseA } from "./ProseA.svelte";
3
+ export { default as ProseH1 } from "./ProseH1.svelte";
4
+ export { default as ProseH2 } from "./ProseH2.svelte";
5
+ export { default as ProseH3 } from "./ProseH3.svelte";
6
+ export { default as ProseH4 } from "./ProseH4.svelte";
7
+ export { default as ProseH5 } from "./ProseH5.svelte";
8
+ export { default as ProseH6 } from "./ProseH6.svelte";
9
+ export { default as ProseP } from "./ProseP.svelte";
10
+ export { default as ProseUl } from "./ProseUl.svelte";
11
+ export { default as ProseOl } from "./ProseOl.svelte";
12
+ export { default as ProseLi } from "./ProseLi.svelte";
13
+ export { default as ProseBlockquote } from "./ProseBlockquote.svelte";
14
+ export { default as ProsePre } from "./ProsePre.svelte";
15
+ export { default as ProseCode } from "./ProseCode.svelte";
16
+ export { default as ProseImg } from "./ProseImg.svelte";
17
+ export { default as ProseTable } from "./ProseTable.svelte";
18
+ export { default as ProseHr } from "./ProseHr.svelte";
19
+ export { default as ProseStrong } from "./ProseStrong.svelte";
20
+ export { default as ProseEm } from "./ProseEm.svelte";
21
+ export { useSearchCollection } from "./svelte-search.ts";
22
+ export type { SearchHit, SearchOptions, SearchStatus, UseSearchCollectionOptions, UseSearchCollectionResult, } from "./svelte-search.ts";
23
+ export { useContentPage } from "./svelte-page.ts";
24
+ export type { ContentPage, UseContentPageResult } from "./svelte-page.ts";
@@ -0,0 +1,189 @@
1
+ import { type Component, type ComputedRef, type PropType } from "vue";
2
+ import type { MdRoot } from "hamur/markdown";
3
+ import type { CollectionName } from "../index.ts";
4
+ import type { PageFields } from "../types.ts";
5
+ import { type ContentPage } from "./page.ts";
6
+ import { type SearchHit, type SearchOptions, type SearchStatus, type UseSearchCollectionOptions } from "./search.ts";
7
+ export type { ContentPage, SearchHit, SearchOptions, SearchStatus, UseSearchCollectionOptions };
8
+ export interface ContentRendererProps {
9
+ /** A page entry, which renders its `body`, or a Markdown AST. */
10
+ value: PageFields | MdRoot;
11
+ /** Markdown components by kebab-case name and prose components by `Prose<Tag>` name; `false` registers none. */
12
+ components?: Record<string, Component> | false;
13
+ /** The wrapper element; `"div"` by default. */
14
+ tag?: string;
15
+ /** Renders the entry's `excerpt` instead of its `body`. */
16
+ excerpt?: boolean;
17
+ /** Space-separated tags whose element is dropped and whose children are kept. */
18
+ unwrap?: string;
19
+ }
20
+ export declare const ProseH1: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
+ [key: string]: any;
22
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
23
+ export declare const ProseH2: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
24
+ [key: string]: any;
25
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
+ export declare const ProseH3: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
27
+ [key: string]: any;
28
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
29
+ export declare const ProseH4: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
30
+ [key: string]: any;
31
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
+ export declare const ProseH5: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
33
+ [key: string]: any;
34
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
35
+ export declare const ProseH6: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
36
+ [key: string]: any;
37
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
38
+ export declare const ProseP: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
39
+ [key: string]: any;
40
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
41
+ export declare const ProseUl: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
42
+ [key: string]: any;
43
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
44
+ export declare const ProseOl: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
45
+ [key: string]: any;
46
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
47
+ export declare const ProseLi: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
48
+ [key: string]: any;
49
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
50
+ export declare const ProseBlockquote: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
51
+ [key: string]: any;
52
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
53
+ export declare const ProseCode: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
54
+ [key: string]: any;
55
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
56
+ export declare const ProseImg: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
57
+ [key: string]: any;
58
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
59
+ export declare const ProseTable: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
60
+ [key: string]: any;
61
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
62
+ export declare const ProseHr: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
63
+ [key: string]: any;
64
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
65
+ export declare const ProseStrong: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
66
+ [key: string]: any;
67
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
68
+ export declare const ProseEm: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
69
+ [key: string]: any;
70
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
71
+ /** An internal `href` is a `Link`, as `MarkdownRenderer` writes it. */
72
+ export declare const ProseA: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
73
+ href: {
74
+ type: StringConstructor;
75
+ default: undefined;
76
+ };
77
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
78
+ [key: string]: any;
79
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
80
+ href: {
81
+ type: StringConstructor;
82
+ default: undefined;
83
+ };
84
+ }>> & Readonly<{}>, {
85
+ href: string;
86
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
87
+ export declare const ProsePre: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
88
+ language: {
89
+ type: StringConstructor;
90
+ default: undefined;
91
+ };
92
+ filename: {
93
+ type: StringConstructor;
94
+ default: undefined;
95
+ };
96
+ highlights: {
97
+ type: PropType<number[]>;
98
+ default: undefined;
99
+ };
100
+ code: {
101
+ type: StringConstructor;
102
+ default: undefined;
103
+ };
104
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
105
+ [key: string]: any;
106
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
107
+ language: {
108
+ type: StringConstructor;
109
+ default: undefined;
110
+ };
111
+ filename: {
112
+ type: StringConstructor;
113
+ default: undefined;
114
+ };
115
+ highlights: {
116
+ type: PropType<number[]>;
117
+ default: undefined;
118
+ };
119
+ code: {
120
+ type: StringConstructor;
121
+ default: undefined;
122
+ };
123
+ }>> & Readonly<{}>, {
124
+ language: string;
125
+ filename: string;
126
+ highlights: number[];
127
+ code: string;
128
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
129
+ /** A page entry's body, or a Markdown AST, through `MarkdownRenderer` with the prose components of `components`. */
130
+ export declare const ContentRenderer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
131
+ value: {
132
+ type: PropType<PageFields | MdRoot>;
133
+ default: undefined;
134
+ };
135
+ components: {
136
+ type: PropType<Record<string, Component> | false>;
137
+ default: undefined;
138
+ };
139
+ tag: {
140
+ type: StringConstructor;
141
+ default: string;
142
+ };
143
+ excerpt: {
144
+ type: BooleanConstructor;
145
+ default: boolean;
146
+ };
147
+ unwrap: {
148
+ type: StringConstructor;
149
+ default: undefined;
150
+ };
151
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
152
+ [key: string]: any;
153
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
154
+ value: {
155
+ type: PropType<PageFields | MdRoot>;
156
+ default: undefined;
157
+ };
158
+ components: {
159
+ type: PropType<Record<string, Component> | false>;
160
+ default: undefined;
161
+ };
162
+ tag: {
163
+ type: StringConstructor;
164
+ default: string;
165
+ };
166
+ excerpt: {
167
+ type: BooleanConstructor;
168
+ default: boolean;
169
+ };
170
+ unwrap: {
171
+ type: StringConstructor;
172
+ default: undefined;
173
+ };
174
+ }>> & Readonly<{}>, {
175
+ value: MdRoot | PageFields;
176
+ components: false | Record<string, Component>;
177
+ tag: string;
178
+ excerpt: boolean;
179
+ unwrap: string;
180
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
181
+ export interface UseSearchCollectionResult {
182
+ status: ComputedRef<SearchStatus>;
183
+ search(query: string, options?: SearchOptions): Promise<SearchHit[]>;
184
+ init(): Promise<void>;
185
+ }
186
+ /** The collection's search index, loaded on the first `search()` or `init()`, or at mount with `immediate`; `status` is a read-only ref. */
187
+ export declare function useSearchCollection(name: string, { immediate }?: UseSearchCollectionOptions): UseSearchCollectionResult;
188
+ /** Awaited in `setup`, resolves to a ref of the entry of `collection` whose `path` is the route path; rejects with the 404 when there is none. */
189
+ export declare function useContentPage<N extends CollectionName>(collection: N): Promise<ComputedRef<ContentPage<N>>>;
@@ -0,0 +1,24 @@
1
+ import { type HamurContext } from "hamur/kit";
2
+ import type { CollectionDefinition, ContentConfig } from "../types.ts";
3
+ /** `content.api`, both surfaces off by default; `graphql` needs `server.graphql` on. */
4
+ export declare function resolveApi(value: unknown, preset: string, serverGraphQL: boolean): {
5
+ rest: boolean;
6
+ graphql: boolean;
7
+ };
8
+ /** The schema's output as JSON Schema, or undefined when it has none or the conversion throws. */
9
+ export declare function outputSchema(collection: CollectionDefinition): Record<string, unknown> | undefined;
10
+ /**
11
+ * The array of entries one REST answer holds. The entry is its own `$defs` member, so OpenAPI makes it a
12
+ * component and a recursive schema's `#` still means the entry: the collection schema's output with the built fields
13
+ * merged into its `properties` and `required`, and without `additionalProperties` at its root, which a strict schema
14
+ * sets to `false` and every entry, holding the built fields, would then fail.
15
+ */
16
+ export declare function restSchema(name: string, collection: CollectionDefinition): Record<string, unknown>;
17
+ /** The collections REST serves: every exposed one (live collections are not in `collections`). */
18
+ export declare const restCollections: (config: ContentConfig) => string[];
19
+ /** `.hamur/content/server/rest.ts`: one `GET /api/_content/<name>` per exposed collection, and `/api/_content/:collection` answering 404 for any other name. */
20
+ export declare function restModule(config: ContentConfig, runtime: string): string;
21
+ /** The generated door: the package door's handlers by relative path (a door follows only those), then the REST handlers. */
22
+ export declare function restDoor(config: ContentConfig, serverDir: string, doorDir: string, dev: boolean): string;
23
+ /** With `content.api.rest`, the module's door is generated, so each collection's route is a literal. */
24
+ export declare function setupRest(config: ContentConfig, hamur: HamurContext): void;
@@ -0,0 +1,4 @@
1
+ /** `hamur dev`: the runner answers `<route>/chunks/<name>.json` and `<route>/search/<name>.json` from the dev index. */
2
+ export declare const DEV_ROUTE = "/_hamur/content/dev";
3
+ /** `hamur dev` re-runs the build loaders here, then the app's dev door drops the live results and answers 204. */
4
+ export declare const REFRESH_ROUTE = "/_hamur/content/refresh";
@@ -0,0 +1,48 @@
1
+ import { type HamurContext } from "hamur/kit";
2
+ import type { CollectionDefinition, ContentConfig, ContentEntry, LoadedContentConfig } from "../types.ts";
3
+ import type { ContentIndex } from "./index.ts";
4
+ export interface ContentUpdate {
5
+ collection: string;
6
+ id: string;
7
+ }
8
+ export interface ContentFailure {
9
+ collection: string;
10
+ /** The failing file, relative to the root. */
11
+ file: string;
12
+ /** The message, which names the file and the field. */
13
+ message: string;
14
+ }
15
+ /** A file whose error is gone: its collection read cleanly again, with the file fixed or removed. */
16
+ export interface ContentFixed {
17
+ collection: string;
18
+ file: string;
19
+ }
20
+ /** The collections a saved file may change: those with a source that matches it, and any loader collection when it is below `content/`. */
21
+ export declare function collectionsOf(config: ContentConfig, rootDir: string, file: string): string[];
22
+ /** The ids of the entries `file` gives a source collection: its stem, and `<stem>/<n>` for an array file. */
23
+ export declare function fileIds(collection: CollectionDefinition, rootDir: string, file: string, entries: readonly ContentEntry[]): string[];
24
+ /** The ids added, removed or changed between two reads of a collection. */
25
+ export declare function changedIds(before: readonly ContentEntry[], after: readonly ContentEntry[]): string[];
26
+ export interface ContentUpdaterOptions {
27
+ config: ContentConfig;
28
+ rootDir: string;
29
+ index: Pick<ContentIndex, "read" | "rebuild">;
30
+ update(update: ContentUpdate): void;
31
+ fail(failure: ContentFailure): void;
32
+ fixed(fixed: ContentFixed): void;
33
+ }
34
+ export interface ContentUpdater {
35
+ /** Queues `file`; resolves when every queued file is handled, `undefined` when no collection reads it. */
36
+ changed(file: string): Promise<void> | undefined;
37
+ /** Queues `names` to be read again, loaders run again; resolves when every queued collection is handled. */
38
+ refresh(names: readonly string[]): Promise<void>;
39
+ /** The errors still standing, one per collection and file, for a page that loads after they were sent. */
40
+ errors(): ContentFailure[];
41
+ }
42
+ /**
43
+ * Rebuilds the collections of each saved file one at a time, so a slow parse is never overtaken by an older
44
+ * one; files saved while a rebuild runs wait and are read together in the next one.
45
+ */
46
+ export declare function createContentUpdater({ config, rootDir, index, update, fail, fixed, }: ContentUpdaterOptions): ContentUpdater;
47
+ /** Under `hamur dev`, a saved content file updates the dev index and the pages that read it. */
48
+ export declare function setupDev(hamur: HamurContext, config: LoadedContentConfig, index: ContentIndex, search: readonly string[]): void;
@@ -0,0 +1,10 @@
1
+ import { type HamurContext } from "hamur/kit";
2
+ import type { ContentConfig } from "../types.ts";
3
+ export interface ContentGraphQL {
4
+ schema: string;
5
+ resolvers: string;
6
+ }
7
+ /** `content.graphql` and its resolvers module over the exposed collections; `runtime` is `src/server/graphql.ts`. */
8
+ export declare function contentGraphQL(config: ContentConfig, runtime: string): ContentGraphQL | undefined;
9
+ /** With `content.api.graphql`, `.hamur/content/content.graphql` and its resolvers join the app's schema through `addServerGraphQL`. */
10
+ export declare function setupGraphQL(config: ContentConfig, hamur: HamurContext): void;
@@ -0,0 +1,16 @@
1
+ import { type HamurContext } from "hamur/kit";
2
+ import { type ImageScope } from "../image.ts";
3
+ export interface ImageOutput {
4
+ /** Where the emitted files are written. */
5
+ dir: string;
6
+ /** The URL prefix of `dir`, with `app.baseURL`. */
7
+ url: string;
8
+ }
9
+ export interface EntryImages extends ImageScope {
10
+ used: boolean;
11
+ }
12
+ export declare const withImages: <T>(scope: ImageScope, run: () => Promise<T>) => Promise<T>;
13
+ /** Serves `<buildDir>/content/images/` below `app.buildAssetsDir` and empties it, so the files of the last build do not ship. */
14
+ export declare function setupImages(hamur: HamurContext): ImageOutput;
15
+ /** The scope of one entry file: reads the image beside it, writes it as `<name>-<8 hex>.<ext>` and reads its size from the header. */
16
+ export declare function entryImages(file: string | undefined, output: ImageOutput | undefined): EntryImages;
@@ -0,0 +1,76 @@
1
+ import { type HamurContext } from "hamur/kit";
2
+ import { parseMarkdown, type MarkdownOptions } from "hamur/markdown";
3
+ import type { Logger } from "hamur/server";
4
+ import { type CsvOptions } from "../loaders/data.ts";
5
+ import { type ImageOutput } from "./image.ts";
6
+ import type { CollectionDefinition, ContentConfig, ContentEntry, ContentFile, ContentOptions, Transformer } from "../types.ts";
7
+ export interface IndexContext {
8
+ rootDir: string;
9
+ markdown: MarkdownOptions;
10
+ siteUrl?: string;
11
+ buildDir: string;
12
+ /** `<cacheDir>`, where remote sources are cached; default `<rootDir>/node_modules/.cache/hamur`. */
13
+ cacheDir?: string;
14
+ /** Hash of everything but an entry that changes how every entry parses; a different one drops the last build's index. */
15
+ digest: string;
16
+ /** Where `image()` writes the files it resolves; without it `image()` fails. */
17
+ images?: ImageOutput;
18
+ /** `hamur dev` keeps drafts; every build leaves them out. */
19
+ dev: boolean;
20
+ /** `content.csv` with its defaults. */
21
+ csv?: CsvOptions;
22
+ log(message: string): void;
23
+ logger?: Logger;
24
+ /** Replaces `hamur/markdown`'s `parseMarkdown`. */
25
+ parseMarkdown?: typeof parseMarkdown;
26
+ /** `content.config.ts`'s `transformers`. */
27
+ transformers?: readonly Transformer[];
28
+ /** Filled with each entry's file, by `<collection>\0<id>`, for `content.raw` and `content.llms`. */
29
+ files?: Map<string, string>;
30
+ /** Filled with each entry's loader body, by `<collection>\0<id>`, for `content.raw: "body"`. */
31
+ bodies?: Map<string, string>;
32
+ /** The `content:file:*` hooks. */
33
+ hooks?: {
34
+ beforeParse(file: ContentFile, collection: string): Promise<void>;
35
+ afterParse(file: ContentFile, entry: ContentEntry, collection: string): Promise<void>;
36
+ };
37
+ }
38
+ /** A value of the index is JSON; a `Date` becomes its ISO string. */
39
+ export declare function toJson(value: unknown, shown: string, path?: string[]): unknown;
40
+ export declare const fileKey: (collection: string, id: string) => string;
41
+ /** One collection's entries in loader order, drafts left out of a build; an entry whose digest equals the last build's is not parsed again. */
42
+ export declare function collectionEntries(name: string, collection: CollectionDefinition, ctx: IndexContext): Promise<ContentEntry[]>;
43
+ /** Every collection's entries, built once per build context. */
44
+ export declare function buildIndex(config: ContentConfig, ctx: IndexContext): Promise<Record<string, ContentEntry[]>>;
45
+ export interface ContentIndex {
46
+ /** Every collection's entries, read once per build and kept for the process in `hamur dev`. */
47
+ read(): Promise<Record<string, ContentEntry[]>>;
48
+ /** The file an entry was read from, when its loader gave one. */
49
+ file(collection: string, id: string): string | undefined;
50
+ /** The Markdown the entry's loader gave as `body`, frontmatter included. */
51
+ body(collection: string, id: string): string | undefined;
52
+ /** `hamur dev`: runs the collection's loader again, parses the entries whose digest changed and keeps the result. */
53
+ rebuild(name: string): Promise<ContentEntry[]>;
54
+ /** `hamur dev`: forgets a failed `read`, so the next one starts again. */
55
+ reset(): void;
56
+ }
57
+ /** `hamur dev`: the file `#hamur/content/store` reads a collection from, written whole and renamed into place. */
58
+ export declare const devChunkPath: (buildDir: string, name: string) => string;
59
+ /** Everything of the transformers the index can key on: names, extensions and the source of `parse` and `transform`; what they import is not hashed. */
60
+ export declare function transformersKey(transformers: readonly Transformer[]): string;
61
+ /** `content.chunkSize`, a positive integer, 1000 by default. */
62
+ export declare function resolveChunkSize(value: unknown): number;
63
+ export interface ChunkRange {
64
+ first: string;
65
+ last: string;
66
+ }
67
+ /** Splits entries into chunks of `size` in source order; an empty collection has no chunk. */
68
+ export declare function splitChunks(entries: ContentEntry[], size: number): ContentEntry[][];
69
+ export declare const chunkRangesOf: (chunks: ContentEntry[][]) => ChunkRange[];
70
+ /** `#hamur/content/chunks/<name>.json` is the whole collection (the client's chunk); the server imports `<name>.<n>.json`, chunks of `content.chunkSize` entries, on the collection's first read. */
71
+ export declare function setupIndex(hamur: HamurContext, config: ContentConfig, options?: ContentOptions): ContentIndex;
72
+ /** `#hamur/content/store`; in `hamur dev` each collection is read from its dev file on every query. */
73
+ export declare function storeModule(config: ContentConfig, store: string, dev?: {
74
+ module: string;
75
+ buildDir: string;
76
+ }, chunks?: Record<string, ChunkRange[]>): string;
@@ -0,0 +1,6 @@
1
+ import { type HamurContext } from "hamur/kit";
2
+ import type { LoadedContentConfig } from "../types.ts";
3
+ /** `#hamur/content/live`: every collection name, and the live collections read from `content.config.ts` itself. */
4
+ export declare function liveModule(configFile: string, config: LoadedContentConfig): string;
5
+ /** The live loaders reach the server bundle through `#hamur/content/live`, which imports `content.config.ts`. */
6
+ export declare function setupLive(config: LoadedContentConfig, hamur: HamurContext): void;
@@ -0,0 +1,8 @@
1
+ import type { HamurContext } from "hamur/kit";
2
+ import type { ContentConfig, ContentEntry, ContentOptions } from "../types.ts";
3
+ /** `content.prerender`, `true` by default on the `static` preset. */
4
+ export declare function resolvePrerender(value: unknown, preset: string): boolean;
5
+ /** The `path` of every entry of every page collection, drafts left out. */
6
+ export declare function pagePaths(config: ContentConfig, index: Record<string, ContentEntry[]>): string[];
7
+ /** Adds the page paths to the prerender routes, which `hamur generate` then writes. */
8
+ export declare function setupPrerender(options: ContentOptions, config: ContentConfig, entries: () => Promise<Record<string, ContentEntry[]>>, hamur: HamurContext): void;
@@ -0,0 +1,10 @@
1
+ import { type HamurContext } from "hamur/kit";
2
+ import type { ContentConfig, ContentOptions } from "../types.ts";
3
+ /** `content.clientQuery`, `"local"` by default on the `static` preset, which serves no endpoint. */
4
+ export declare function resolveClientQuery(value: unknown, preset: string): "api" | "local";
5
+ /** `#hamur/content/client`: every collection's name, type, exposure and order; under `"local"` an exposed one imports its chunk, or in `hamur dev` fetches it from `devLoad`'s module. */
6
+ export declare function clientModule(config: ContentConfig, mode: "api" | "local", devLoad?: string, raw?: string): string;
7
+ /** The module's one door: `POST /_hamur/content/query` except on `static`, and in `hamur dev` the refresh route. */
8
+ export declare function doorOf(preset: string, dev: boolean): string;
9
+ /** The door with `POST /_hamur/content/query` (none on `static`), the store handed to `queryCollection`, and `#hamur/content/client`; with `content.api.rest` the door is generated, and `content.api.graphql` adds the collections' schema. */
10
+ export declare function setupQuery(options: ContentOptions, config: ContentConfig, hamur: HamurContext): void;
@@ -0,0 +1,23 @@
1
+ import { type HamurContext } from "hamur/kit";
2
+ import { rawPath } from "../runtime/raw-path.ts";
3
+ import type { ContentConfig, ContentEntry, ContentOptions, LlmsOptions, PageEntry } from "../types.ts";
4
+ import type { ContentIndex } from "./index.ts";
5
+ export { rawPath };
6
+ /** `content.raw`, `false` by default; `"body"` serves the loader's body, `true` the file on disk. */
7
+ export declare function resolveRaw(value: unknown): boolean | "body";
8
+ /** Checks `content.llms` against the collections and `site.url`. */
9
+ export declare function resolveLlms(value: unknown, config: ContentConfig, siteUrl: string | undefined): LlmsOptions | undefined;
10
+ export interface LlmsSection {
11
+ title: string;
12
+ entries: PageEntry[];
13
+ }
14
+ /** Each section's page entries, in the collection's order, which `where` narrows. */
15
+ export declare function llmsSections(llms: LlmsOptions, config: ContentConfig, index: Record<string, ContentEntry[]>): LlmsSection[];
16
+ /** An absolute URL of a page: `site.url`, `app.baseURL` and the entry's path. */
17
+ export declare const pageUrl: (origin: string, baseURL: string, path: string) => string;
18
+ /** The llmstxt.org file. */
19
+ export declare function llmsText(llms: LlmsOptions, sections: readonly LlmsSection[], origin: string, baseURL: string): string;
20
+ /** Every listed page's source joined by a rule. */
21
+ export declare const llmsFullText: (sources: readonly string[]) => string;
22
+ /** Writes `<path>.md`, `llms.txt` and `llms-full.txt` as public files, so every preset serves them and the static preset's output holds them. */
23
+ export declare function setupRaw(options: ContentOptions, config: ContentConfig, index: ContentIndex, hamur: HamurContext): void;
@@ -0,0 +1,9 @@
1
+ import { type SearchIndex } from "../runtime/search.ts";
2
+ import type { ContentConfig, ContentEntry, ContentOptions } from "../types.ts";
3
+ /** `content.search.collections`, each an exposed page collection of `content.config.ts`. */
4
+ export declare function resolveSearch(value: ContentOptions["search"] | undefined, config: ContentConfig): string[];
5
+ export declare function searchIndexOf(entries: readonly ContentEntry[]): SearchIndex;
6
+ /** `#hamur/content/search`: each listed collection's index as a lazily imported chunk, which the client bundler hashes; in `hamur dev` fetched from `devLoad`'s module. */
7
+ export declare function searchModule(names: readonly string[], devLoad?: string): string;
8
+ /** Returns the collections that get a search index. */
9
+ export declare function setupSearch(options: ContentOptions, config: ContentConfig, entries: () => Promise<Record<string, ContentEntry[]>>, dev?: boolean): string[];
@@ -0,0 +1,16 @@
1
+ import { type HamurContext } from "hamur/kit";
2
+ import type { CollectionSource, ContentConfig, LoadedContentConfig } from "../types.ts";
3
+ /** `.hamur/types/content.d.ts`, one `HamurContentCollections` entry per collection and one `HamurLiveCollections` entry per live collection, typed from the config file's own types. */
4
+ export declare function contentTypes(config: ContentConfig, configImport: string, live?: readonly string[]): string;
5
+ /** The globs of a collection's sources from the root, as an editor matches a file: `content/<cwd>/<include>`. */
6
+ export declare function sourceGlobs(source: CollectionSource | undefined): string[];
7
+ export interface SchemaFiles {
8
+ /** The schema files below the build directory, by collection. */
9
+ files: Record<string, string>;
10
+ /** Each schema file from the root, with the globs it validates (the shape of `yaml.schemas`). */
11
+ map: Record<string, string[]>;
12
+ }
13
+ /** The JSON Schema of each collection whose schema implements Standard JSON Schema: what an author writes, so the schema's input. */
14
+ export declare function schemaFiles(config: ContentConfig, buildFolder: string, warn: (message: string) => void): SchemaFiles;
15
+ /** The item types and the editor schemas. */
16
+ export declare function setupTypes(config: LoadedContentConfig, hamur: HamurContext): void;
@@ -0,0 +1,10 @@
1
+ import type { StandardSchemaV1 } from "hamur/server";
2
+ /** The `propsSchema` of a component module `M`, as its Standard Schema. */
3
+ export type PropsSchemaOf<M> = M extends {
4
+ propsSchema: infer S extends StandardSchemaV1;
5
+ } ? S : StandardSchemaV1;
6
+ /** The `propsSchema` a component file exports, as a collection's schema; imported when `content.config.ts` loads. */
7
+ export declare function fromComponent<M = unknown>(path: string): PropsSchemaOf<M>;
8
+ export declare const componentPathOf: (schema: unknown) => string | undefined;
9
+ /** Imports the component (or its `.props.ts` next to a `.vue` or `.svelte` file) and returns its `propsSchema`. */
10
+ export declare function loadPropsSchema(path: string, rootDir: string): Promise<StandardSchemaV1>;
@@ -0,0 +1,6 @@
1
+ import type { LoadedContentConfig } from "./types.ts";
2
+ export { defineCollection, defineContentConfig, defineLiveCollection, defineTransformer } from "./define.ts";
3
+ /** Imports `<rootDir>/content.config.ts` and checks its collections. */
4
+ export declare function setupConfig(rootDir: string): Promise<LoadedContentConfig>;
5
+ /** Checks the config and returns it with its live collections moved from `collections` to `live`. */
6
+ export declare function checkConfig(value: unknown): LoadedContentConfig;
@@ -0,0 +1,14 @@
1
+ import type { CollectionDefinition, ContentConfig, LiveCollectionDefinition, LiveLoader, Transformer } from "./types.ts";
2
+ import type { StandardSchemaV1 } from "hamur/server";
3
+ export declare function defineContentConfig<C extends Record<string, CollectionDefinition | LiveCollectionDefinition>>(config: ContentConfig<C>): ContentConfig<C>;
4
+ export declare function defineTransformer<T extends Transformer>(transformer: T): T;
5
+ export declare function defineCollection<T extends CollectionDefinition>(collection: T): T;
6
+ /** A collection fetched at request time by `loader`, read with `getLiveCollection` and `getLiveEntry`. */
7
+ export declare function defineLiveCollection<L extends LiveLoader, S extends StandardSchemaV1>(collection: {
8
+ loader: L;
9
+ schema: S;
10
+ }): LiveCollectionDefinition<L, S>;
11
+ export declare function defineLiveCollection<L extends LiveLoader>(collection: {
12
+ loader: L;
13
+ schema?: undefined;
14
+ }): LiveCollectionDefinition<L, undefined>;
@@ -0,0 +1,4 @@
1
+ import { DiagnosticError } from "hamur/kit";
2
+ /** An error whose message is already final; a loader's other errors get `content: loader "<name>" failed:`. */
3
+ export declare class ContentError extends DiagnosticError {
4
+ }