blodemd 0.0.13 → 0.0.14

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 (136) hide show
  1. package/README.md +1 -1
  2. package/dev-server/lib/local-runtime.tsx +12 -15
  3. package/dev-server/package.json +5 -1
  4. package/dist/cli.mjs +1193 -978
  5. package/dist/cli.mjs.map +1 -1
  6. package/docs/app/globals.css +1 -1
  7. package/docs/components/api/api-playground.tsx +2 -5
  8. package/docs/components/api/api-reference.tsx +29 -3
  9. package/docs/components/docs/contextual-menu.tsx +37 -33
  10. package/docs/components/docs/copy-page-menu.tsx +18 -0
  11. package/docs/components/docs/doc-header.tsx +4 -1
  12. package/docs/components/docs/doc-shell.tsx +48 -18
  13. package/docs/components/docs/doc-sidebar.tsx +131 -89
  14. package/docs/components/docs/doc-toc.tsx +1 -0
  15. package/docs/components/docs/mobile-nav.tsx +72 -68
  16. package/docs/components/docs/sidebar-active-highlight.tsx +34 -0
  17. package/docs/components/docs/sidebar-scroll-area.tsx +9 -4
  18. package/docs/components/git/repo-picker.tsx +5 -2
  19. package/docs/components/mdx/index.tsx +31 -21
  20. package/docs/components/posthog-provider.tsx +42 -0
  21. package/docs/components/tenant-analytics.tsx +49 -0
  22. package/docs/components/third-parties.tsx +4 -1
  23. package/docs/components/ui/copy-button.tsx +16 -2
  24. package/docs/components/ui/search-dialog.tsx +431 -0
  25. package/docs/components/ui/search.tsx +44 -427
  26. package/docs/components/web-mcp.tsx +115 -0
  27. package/docs/lib/agent-skills.ts +48 -0
  28. package/docs/lib/config.ts +4 -5
  29. package/docs/lib/docs-collection.ts +7 -22
  30. package/docs/lib/docs-runtime.tsx +160 -10
  31. package/docs/lib/llms-full.ts +82 -0
  32. package/docs/lib/marketing-markdown.ts +79 -0
  33. package/docs/lib/marketing-site.ts +31 -0
  34. package/docs/lib/mdx.ts +17 -6
  35. package/docs/lib/routes.ts +19 -3
  36. package/docs/lib/shiki.ts +4 -0
  37. package/docs/lib/tenancy.ts +15 -2
  38. package/docs/lib/tenant-headers.ts +29 -0
  39. package/docs/lib/tenant-static.ts +73 -99
  40. package/package.json +8 -5
  41. package/packages/@repo/common/package.json +1 -1
  42. package/packages/@repo/contracts/dist/analytics.d.ts +21 -0
  43. package/packages/@repo/contracts/dist/analytics.d.ts.map +1 -0
  44. package/packages/@repo/contracts/dist/analytics.js +18 -0
  45. package/packages/@repo/contracts/dist/deployment.js +1 -1
  46. package/packages/@repo/contracts/dist/git.js +2 -2
  47. package/packages/@repo/contracts/dist/ids.d.ts.map +1 -1
  48. package/packages/@repo/contracts/dist/ids.js +2 -1
  49. package/packages/@repo/contracts/dist/index.d.ts +1 -0
  50. package/packages/@repo/contracts/dist/index.d.ts.map +1 -1
  51. package/packages/@repo/contracts/dist/index.js +1 -0
  52. package/packages/@repo/contracts/dist/project.d.ts +18 -1
  53. package/packages/@repo/contracts/dist/project.d.ts.map +1 -1
  54. package/packages/@repo/contracts/dist/project.js +3 -1
  55. package/packages/@repo/contracts/dist/tenant.d.ts +36 -0
  56. package/packages/@repo/contracts/dist/tenant.d.ts.map +1 -1
  57. package/packages/@repo/contracts/dist/tenant.js +2 -0
  58. package/packages/@repo/contracts/package.json +1 -1
  59. package/packages/@repo/contracts/src/analytics.ts +33 -0
  60. package/packages/@repo/contracts/src/deployment.ts +1 -1
  61. package/packages/@repo/contracts/src/git.ts +2 -2
  62. package/packages/@repo/contracts/src/ids.ts +2 -1
  63. package/packages/@repo/contracts/src/index.ts +1 -0
  64. package/packages/@repo/contracts/src/project.ts +3 -1
  65. package/packages/@repo/contracts/src/tenant.ts +2 -0
  66. package/packages/@repo/models/dist/docs-config.d.ts +0 -198
  67. package/packages/@repo/models/dist/docs-config.d.ts.map +1 -1
  68. package/packages/@repo/models/dist/docs-config.js +3 -2
  69. package/packages/@repo/models/dist/tenant.d.ts +12 -0
  70. package/packages/@repo/models/dist/tenant.d.ts.map +1 -1
  71. package/packages/@repo/models/package.json +1 -1
  72. package/packages/@repo/models/src/docs-config.ts +3 -3
  73. package/packages/@repo/models/src/tenant.ts +15 -0
  74. package/packages/@repo/prebuild/dist/openapi.d.ts.map +1 -1
  75. package/packages/@repo/prebuild/dist/openapi.js +32 -4
  76. package/packages/@repo/prebuild/package.json +1 -1
  77. package/packages/@repo/prebuild/src/openapi.ts +42 -4
  78. package/packages/@repo/previewing/dist/blob-source.d.ts.map +1 -1
  79. package/packages/@repo/previewing/dist/blob-source.js +18 -5
  80. package/packages/@repo/previewing/dist/config-loader.d.ts +134 -0
  81. package/packages/@repo/previewing/dist/config-loader.d.ts.map +1 -0
  82. package/packages/@repo/previewing/dist/config-loader.js +231 -0
  83. package/packages/@repo/previewing/dist/constants.d.ts +15 -0
  84. package/packages/@repo/previewing/dist/constants.d.ts.map +1 -0
  85. package/packages/@repo/previewing/dist/constants.js +14 -0
  86. package/packages/@repo/previewing/dist/content-index.d.ts +7 -0
  87. package/packages/@repo/previewing/dist/content-index.d.ts.map +1 -0
  88. package/packages/@repo/previewing/dist/content-index.js +291 -0
  89. package/packages/@repo/previewing/dist/index.d.ts +13 -121
  90. package/packages/@repo/previewing/dist/index.d.ts.map +1 -1
  91. package/packages/@repo/previewing/dist/index.js +11 -1003
  92. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts +3 -0
  93. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts.map +1 -0
  94. package/packages/@repo/previewing/dist/markdown/agent-markdown.js +176 -0
  95. package/packages/@repo/previewing/dist/markdown/format.d.ts +8 -0
  96. package/packages/@repo/previewing/dist/markdown/format.d.ts.map +1 -0
  97. package/packages/@repo/previewing/dist/markdown/format.js +43 -0
  98. package/packages/@repo/previewing/dist/markdown/links.d.ts +3 -0
  99. package/packages/@repo/previewing/dist/markdown/links.d.ts.map +1 -0
  100. package/packages/@repo/previewing/dist/markdown/links.js +31 -0
  101. package/packages/@repo/previewing/dist/openapi-pages.d.ts +7 -0
  102. package/packages/@repo/previewing/dist/openapi-pages.d.ts.map +1 -0
  103. package/packages/@repo/previewing/dist/openapi-pages.js +200 -0
  104. package/packages/@repo/previewing/dist/search-index.d.ts +4 -0
  105. package/packages/@repo/previewing/dist/search-index.d.ts.map +1 -0
  106. package/packages/@repo/previewing/dist/search-index.js +23 -0
  107. package/packages/@repo/previewing/dist/serialization.d.ts +13 -0
  108. package/packages/@repo/previewing/dist/serialization.d.ts.map +1 -0
  109. package/packages/@repo/previewing/dist/serialization.js +108 -0
  110. package/packages/@repo/previewing/dist/toc-index.d.ts +5 -0
  111. package/packages/@repo/previewing/dist/toc-index.d.ts.map +1 -0
  112. package/packages/@repo/previewing/dist/toc-index.js +53 -0
  113. package/packages/@repo/previewing/dist/types.d.ts +92 -0
  114. package/packages/@repo/previewing/dist/types.d.ts.map +1 -0
  115. package/packages/@repo/previewing/dist/types.js +1 -0
  116. package/packages/@repo/previewing/dist/utility-index.d.ts +7 -0
  117. package/packages/@repo/previewing/dist/utility-index.d.ts.map +1 -0
  118. package/packages/@repo/previewing/dist/utility-index.js +201 -0
  119. package/packages/@repo/previewing/package.json +1 -1
  120. package/packages/@repo/previewing/src/blob-source.ts +20 -5
  121. package/packages/@repo/previewing/src/config-loader.ts +316 -0
  122. package/packages/@repo/previewing/src/constants.ts +16 -0
  123. package/packages/@repo/previewing/src/content-index.ts +384 -0
  124. package/packages/@repo/previewing/src/index.ts +69 -1515
  125. package/packages/@repo/previewing/src/markdown/agent-markdown.ts +254 -0
  126. package/packages/@repo/previewing/src/markdown/format.ts +63 -0
  127. package/packages/@repo/previewing/src/markdown/links.ts +46 -0
  128. package/packages/@repo/previewing/src/openapi-pages.ts +319 -0
  129. package/packages/@repo/previewing/src/search-index.ts +38 -0
  130. package/packages/@repo/previewing/src/serialization.ts +191 -0
  131. package/packages/@repo/previewing/src/toc-index.ts +72 -0
  132. package/packages/@repo/previewing/src/types.ts +105 -0
  133. package/packages/@repo/previewing/src/utility-index.ts +304 -0
  134. package/packages/@repo/validation/package.json +1 -1
  135. package/scripts/repo-packages.mjs +8 -0
  136. package/docs/components/ui/site-footer.tsx +0 -41
@@ -0,0 +1,291 @@
1
+ import path from "node:path";
2
+ import { normalizePath } from "@repo/common";
3
+ import { PageModeSchema } from "@repo/models";
4
+ import { validateFrontmatter } from "@repo/validation";
5
+ import { parseFrontmatter } from "./markdown/format.js";
6
+ const validModes = new Set(PageModeSchema.options);
7
+ export const buildPageMetadataMap = (index) => {
8
+ const map = new Map();
9
+ for (const entry of index.entries) {
10
+ if (entry.kind !== "entry") {
11
+ continue;
12
+ }
13
+ const fm = entry.frontmatter;
14
+ const meta = {
15
+ title: entry.title,
16
+ };
17
+ if (typeof fm.sidebarTitle === "string") {
18
+ meta.sidebarTitle = fm.sidebarTitle;
19
+ }
20
+ if (typeof fm.icon === "string") {
21
+ meta.icon = fm.icon;
22
+ }
23
+ if (typeof fm.iconType === "string") {
24
+ meta.iconType = fm.iconType;
25
+ }
26
+ if (typeof fm.tag === "string") {
27
+ meta.tag = fm.tag;
28
+ }
29
+ if (typeof fm.hidden === "boolean") {
30
+ meta.hidden = fm.hidden;
31
+ }
32
+ if (typeof fm.deprecated === "boolean") {
33
+ meta.deprecated = fm.deprecated;
34
+ }
35
+ if (typeof fm.url === "string") {
36
+ meta.url = fm.url;
37
+ }
38
+ if (typeof fm.mode === "string" && validModes.has(fm.mode)) {
39
+ meta.mode = fm.mode;
40
+ }
41
+ if (typeof fm.noindex === "boolean") {
42
+ meta.noindex = fm.noindex;
43
+ }
44
+ if (typeof fm.hideFooterPagination === "boolean") {
45
+ meta.hideFooterPagination = fm.hideFooterPagination;
46
+ }
47
+ if (typeof fm.hideApiMarker === "boolean") {
48
+ meta.hideApiMarker = fm.hideApiMarker;
49
+ }
50
+ if (Array.isArray(fm.keywords)) {
51
+ meta.keywords = fm.keywords;
52
+ }
53
+ map.set(entry.slug, meta);
54
+ }
55
+ return map;
56
+ };
57
+ const DOC_FILE_EXTENSION_REGEX = /\.(mdx|md)$/;
58
+ const INDEX_SUFFIX = "/index";
59
+ const titleFromSlug = (slug) => {
60
+ const clean = slug.replaceAll("-", " ").split("/").pop() ?? slug;
61
+ if (clean === "index") {
62
+ return "Overview";
63
+ }
64
+ return clean.replaceAll(/\b\w/g, (char) => char.toUpperCase());
65
+ };
66
+ const slugFromFile = (relativePath) => {
67
+ const clean = normalizePath(relativePath);
68
+ const withoutExt = clean.replace(DOC_FILE_EXTENSION_REGEX, "");
69
+ if (withoutExt.endsWith(INDEX_SUFFIX)) {
70
+ const trimmed = withoutExt.slice(0, -INDEX_SUFFIX.length);
71
+ return trimmed.length ? trimmed : "index";
72
+ }
73
+ return withoutExt.length ? withoutExt : "index";
74
+ };
75
+ const listContentFiles = async (source, directory) => {
76
+ const files = await source.listFiles(directory);
77
+ return files.filter((file) => DOC_FILE_EXTENSION_REGEX.test(file));
78
+ };
79
+ const sortDefaults = {
80
+ blog: { direction: "desc", field: "date" },
81
+ courses: { direction: "asc", field: "order" },
82
+ docs: { direction: "asc", field: "title" },
83
+ forms: { direction: "asc", field: "title" },
84
+ notes: { direction: "desc", field: "date" },
85
+ products: { direction: "asc", field: "title" },
86
+ sheets: { direction: "asc", field: "title" },
87
+ site: { direction: "asc", field: "title" },
88
+ slides: { direction: "asc", field: "title" },
89
+ todos: { direction: "desc", field: "date" },
90
+ };
91
+ const normalizeSortValue = (value) => {
92
+ if (typeof value === "number") {
93
+ return value;
94
+ }
95
+ if (typeof value === "string") {
96
+ const timestamp = Date.parse(value);
97
+ if (!Number.isNaN(timestamp)) {
98
+ return timestamp;
99
+ }
100
+ return value.toLowerCase();
101
+ }
102
+ return null;
103
+ };
104
+ const compareValues = (a, b, direction) => {
105
+ const left = normalizeSortValue(a);
106
+ const right = normalizeSortValue(b);
107
+ if (left === null && right === null) {
108
+ return 0;
109
+ }
110
+ if (left === null) {
111
+ return 1;
112
+ }
113
+ if (right === null) {
114
+ return -1;
115
+ }
116
+ const multiplier = direction === "desc" ? -1 : 1;
117
+ if (typeof left === "number" && typeof right === "number") {
118
+ return (left - right) * multiplier;
119
+ }
120
+ if (left < right) {
121
+ return -1 * multiplier;
122
+ }
123
+ if (left > right) {
124
+ return 1 * multiplier;
125
+ }
126
+ return 0;
127
+ };
128
+ const autoIndexTypes = new Set([
129
+ "blog",
130
+ "courses",
131
+ "products",
132
+ "notes",
133
+ "forms",
134
+ "sheets",
135
+ "slides",
136
+ "todos",
137
+ ]);
138
+ const getCollectionIndex = (collection, slugPrefix) => {
139
+ if (collection.index) {
140
+ return collection.index;
141
+ }
142
+ if (autoIndexTypes.has(collection.type)) {
143
+ const slug = slugPrefix || collection.id;
144
+ return {
145
+ slug,
146
+ title: titleFromSlug(slug),
147
+ };
148
+ }
149
+ return null;
150
+ };
151
+ const addEntry = (entry, index, errors) => {
152
+ if (index.bySlug.has(entry.slug)) {
153
+ errors.push(`slug "${entry.slug}" is defined more than once`);
154
+ return;
155
+ }
156
+ index.entries.push(entry);
157
+ index.bySlug.set(entry.slug, entry);
158
+ };
159
+ const resolveEntrySlug = (relativeSlug, slugPrefix) => {
160
+ if (!slugPrefix) {
161
+ return relativeSlug;
162
+ }
163
+ if (relativeSlug === "index") {
164
+ return slugPrefix;
165
+ }
166
+ return normalizePath(`${slugPrefix}/${relativeSlug}`);
167
+ };
168
+ const buildEntryFromFile = async ({ collection, errors, file, root, slugPrefix, source, }) => {
169
+ const sourcePath = root
170
+ ? normalizePath(path.join(root, file))
171
+ : normalizePath(file);
172
+ let entrySource = "";
173
+ try {
174
+ entrySource = await source.readFile(sourcePath);
175
+ }
176
+ catch (error) {
177
+ errors.push(error instanceof Error ? error.message : `Failed to read ${sourcePath}`);
178
+ return null;
179
+ }
180
+ const { frontmatter } = parseFrontmatter(entrySource);
181
+ const frontmatterResult = validateFrontmatter(collection.type, frontmatter);
182
+ if (!frontmatterResult.success) {
183
+ for (const issue of frontmatterResult.errors) {
184
+ errors.push(`${sourcePath}: ${issue}`);
185
+ }
186
+ }
187
+ const resolvedFrontmatter = frontmatterResult.success
188
+ ? frontmatterResult.data
189
+ : frontmatter;
190
+ const relativeSlug = slugFromFile(file);
191
+ const slug = resolveEntrySlug(relativeSlug, slugPrefix);
192
+ const title = typeof resolvedFrontmatter?.title === "string"
193
+ ? resolvedFrontmatter.title
194
+ : titleFromSlug(slug);
195
+ const description = typeof resolvedFrontmatter?.description === "string"
196
+ ? resolvedFrontmatter.description
197
+ : undefined;
198
+ const hidden = typeof resolvedFrontmatter?.hidden === "boolean"
199
+ ? resolvedFrontmatter.hidden
200
+ : undefined;
201
+ return {
202
+ collectionId: collection.id,
203
+ description,
204
+ frontmatter: resolvedFrontmatter,
205
+ hidden: hidden || undefined,
206
+ kind: "entry",
207
+ relativePath: sourcePath,
208
+ slug,
209
+ sourcePath,
210
+ title,
211
+ type: collection.type,
212
+ };
213
+ };
214
+ export const buildContentIndex = async (source, config) => {
215
+ const errors = [];
216
+ const index = {
217
+ byCollection: new Map(),
218
+ bySlug: new Map(),
219
+ entries: [],
220
+ errors,
221
+ };
222
+ for (const collection of config.collections) {
223
+ const root = normalizePath(collection.root ?? "");
224
+ const slugPrefix = normalizePath(collection.slugPrefix ?? "");
225
+ let files = [];
226
+ try {
227
+ files = await listContentFiles(source, root);
228
+ }
229
+ catch (error) {
230
+ errors.push(error instanceof Error ? error.message : `Failed to read ${root || "."}`);
231
+ continue;
232
+ }
233
+ const collectionEntries = [];
234
+ const resolvedEntries = await Promise.all(files.map(async (file) => await buildEntryFromFile({
235
+ collection,
236
+ errors,
237
+ file,
238
+ root,
239
+ slugPrefix,
240
+ source,
241
+ })));
242
+ for (const entry of resolvedEntries) {
243
+ if (!entry) {
244
+ continue;
245
+ }
246
+ collectionEntries.push(entry);
247
+ addEntry(entry, index, errors);
248
+ }
249
+ const sortConfig = {
250
+ ...sortDefaults[collection.type],
251
+ ...collection.sort,
252
+ };
253
+ const sortField = sortConfig.field ?? "title";
254
+ const sortDirection = sortConfig.direction ?? "asc";
255
+ collectionEntries.sort((left, right) => {
256
+ const leftValue = left.kind === "entry"
257
+ ? left.frontmatter[sortField]
258
+ : undefined;
259
+ const rightValue = right.kind === "entry"
260
+ ? right.frontmatter[sortField]
261
+ : undefined;
262
+ return compareValues(leftValue, rightValue, sortDirection);
263
+ });
264
+ index.byCollection.set(collection.id, collectionEntries);
265
+ const collectionIndex = getCollectionIndex(collection, slugPrefix);
266
+ if (collectionIndex) {
267
+ const indexEntry = {
268
+ collectionId: collection.id,
269
+ description: collectionIndex.description,
270
+ kind: "index",
271
+ slug: collectionIndex.slug,
272
+ title: collectionIndex.title ?? titleFromSlug(collectionIndex.slug),
273
+ type: collection.type,
274
+ };
275
+ addEntry(indexEntry, index, errors);
276
+ }
277
+ }
278
+ return index;
279
+ };
280
+ export const shouldIncludeSearchEntry = (entry, pageMetadataMap, config) => {
281
+ const pageMeta = pageMetadataMap.get(entry.slug);
282
+ if (pageMeta?.hidden || pageMeta?.noindex) {
283
+ return false;
284
+ }
285
+ if (config.seo?.indexing !== "all" &&
286
+ entry.kind === "entry" &&
287
+ entry.hidden === true) {
288
+ return false;
289
+ }
290
+ return true;
291
+ };
@@ -1,124 +1,16 @@
1
- import type { ContentType, DocsOpenApiSource, FrontmatterByType, PageMode, SiteConfig } from "@repo/models";
2
- import type { OpenApiOperation, OpenApiSpec } from "@repo/prebuild";
3
- import type { ContentSource } from "./content-source.js";
4
1
  export { BlobContentSource, createBlobSource } from "./blob-source.js";
5
- export { createFsSource, FsContentSource } from "./fs-source.js";
2
+ export { getDocsCollection, getDocsCollectionWithNavigation, getDocsNavigation, loadSiteConfig, } from "./config-loader.js";
3
+ export { LEGACY_PROJECT_NAME_FALLBACK_WARNING, PREBUILT_INDEX_PATH, PREBUILT_OPENAPI_INDEX_PATH, PREBUILT_SEARCH_INDEX_PATH, PREBUILT_TOC_INDEX_PATH, PREBUILT_UTILITY_INDEX_PATH, PREBUILT_UTILITY_LLMS_FULL_PATH, PREBUILT_UTILITY_LLMS_PATH, PREBUILT_UTILITY_LLMS_SEGMENT_PREFIX, PREBUILT_UTILITY_SITEMAP_PATH, PREBUILT_UTILITY_SKILLS_INDEX_PATH, PREBUILT_UTILITY_SKILLS_MD_PREFIX, UTILITY_DOCS_ROOT_TOKEN, } from "./constants.js";
4
+ export { buildContentIndex, buildPageMetadataMap } from "./content-index.js";
6
5
  export type { CompiledMdxResult, ContentSource } from "./content-source.js";
7
- export declare const PREBUILT_INDEX_PATH = "_content-index.json";
8
- export declare const PREBUILT_OPENAPI_INDEX_PATH = "_openapi-index.json";
9
- export declare const PREBUILT_SEARCH_INDEX_PATH = "_search-index.json";
10
- export declare const PREBUILT_TOC_INDEX_PATH = "_toc-index.json";
11
- export declare const PREBUILT_UTILITY_INDEX_PATH = "_utility-index.json";
12
- export declare const PREBUILT_UTILITY_SITEMAP_PATH = "_utility/sitemap.xml";
13
- export declare const PREBUILT_UTILITY_LLMS_PATH = "_utility/llms.txt";
14
- export declare const PREBUILT_UTILITY_LLMS_FULL_PATH = "_utility/llms-full.txt";
15
- export declare const PREBUILT_UTILITY_SKILLS_INDEX_PATH = "_utility/skills-index.json";
16
- export declare const PREBUILT_UTILITY_SKILLS_MD_PREFIX = "_utility/skills/";
17
- export declare const UTILITY_DOCS_ROOT_TOKEN = "__BLODEMD_DOCS_ROOT__";
18
- export declare const LEGACY_PROJECT_NAME_FALLBACK_WARNING = "docs.json.slug is recommended. Falling back to docs.json.name as the deployment slug is deprecated.";
19
- export type SiteConfigResult = {
20
- ok: true;
21
- config: SiteConfig;
22
- warnings: string[];
23
- } | {
24
- ok: false;
25
- errors: string[];
26
- };
27
- export type ContentEntry = {
28
- kind: "entry";
29
- slug: string;
30
- title: string;
31
- description?: string;
32
- hidden?: boolean;
33
- type: ContentType;
34
- collectionId: string;
35
- sourcePath: string;
36
- relativePath: string;
37
- frontmatter: FrontmatterByType[ContentType];
38
- } | {
39
- kind: "index";
40
- slug: string;
41
- title: string;
42
- description?: string;
43
- type: ContentType;
44
- collectionId: string;
45
- };
46
- export interface ContentIndex {
47
- entries: ContentEntry[];
48
- bySlug: Map<string, ContentEntry>;
49
- byCollection: Map<string, ContentEntry[]>;
50
- errors: string[];
51
- }
52
- export interface PageMetadata {
53
- title?: string;
54
- sidebarTitle?: string;
55
- icon?: string;
56
- iconType?: string;
57
- tag?: string;
58
- hidden?: boolean;
59
- deprecated?: boolean;
60
- url?: string;
61
- mode?: PageMode;
62
- noindex?: boolean;
63
- hideFooterPagination?: boolean;
64
- hideApiMarker?: boolean;
65
- keywords?: string[];
66
- }
67
- export interface SearchIndexItem {
68
- href?: string;
69
- title: string;
70
- path: string;
71
- }
72
- export interface TocItem {
73
- id: string;
74
- level: number;
75
- title: string;
76
- }
77
- export interface UtilityPage {
78
- content: string;
79
- description?: string;
80
- slug: string;
81
- title: string;
82
- }
83
- export interface UtilityIndex {
84
- description?: string;
85
- name: string;
86
- pages: UtilityPage[];
87
- slug?: string;
88
- }
89
- export interface UtilityArtifact {
90
- content: string;
91
- contentType: string;
92
- path: string;
93
- }
94
- export interface PrebuiltOpenApiEntry {
95
- identifier: string;
96
- operation: OpenApiOperation;
97
- slug: string;
98
- source: DocsOpenApiSource;
99
- sourceKey: string;
100
- spec: OpenApiSpec;
101
- }
102
- export declare const buildPageMetadataMap: (index: ContentIndex) => Map<string, PageMetadata>;
103
- export declare const loadSiteConfig: (source: ContentSource) => Promise<SiteConfigResult>;
104
- export declare const loadContentSource: (source: ContentSource, relativePath: string) => Promise<string>;
105
- export declare const buildContentIndex: (source: ContentSource, config: SiteConfig) => Promise<ContentIndex>;
106
- export declare const extractToc: (source: string) => TocItem[];
107
- export declare const formatMarkdownPage: (title: string, source: string) => string;
108
- export declare const formatMarkdownPageSection: (title: string, url: string, source: string) => string;
109
- export declare const buildSearchIndex: (index: ContentIndex, config: SiteConfig, utilityIndex?: UtilityIndex) => SearchIndexItem[];
110
- export declare const buildUtilityIndex: (index: ContentIndex, source: ContentSource, config: SiteConfig) => Promise<UtilityIndex>;
111
- export declare const getPrebuiltUtilityLlmPagePath: (slug: string) => string;
112
- export declare const buildUtilityArtifacts: (index: UtilityIndex) => UtilityArtifact[];
113
- export declare const buildTocIndex: (index: ContentIndex, source: ContentSource) => Promise<Map<string, TocItem[]>>;
114
- export declare const serializeContentIndex: (index: ContentIndex) => string;
115
- export declare const serializeOpenApiIndex: (entries: PrebuiltOpenApiEntry[]) => string;
116
- export declare const loadPrebuiltContentIndex: (source: ContentSource) => Promise<ContentIndex | null>;
117
- export declare const loadPrebuiltOpenApiIndex: (source: ContentSource) => Promise<PrebuiltOpenApiEntry[] | null>;
118
- export declare const serializeSearchIndex: (items: SearchIndexItem[]) => string;
119
- export declare const loadPrebuiltSearchIndex: (source: ContentSource) => Promise<SearchIndexItem[] | null>;
120
- export declare const serializeTocIndex: (itemsBySlug: Map<string, TocItem[]>) => string;
121
- export declare const loadPrebuiltTocIndex: (source: ContentSource) => Promise<Map<string, TocItem[]> | null>;
122
- export declare const serializeUtilityIndex: (index: UtilityIndex) => string;
123
- export declare const loadPrebuiltUtilityIndex: (source: ContentSource) => Promise<UtilityIndex | null>;
6
+ export { createFsSource, FsContentSource } from "./fs-source.js";
7
+ export { prepareLlmsFullContent, toAgentMarkdown, } from "./markdown/agent-markdown.js";
8
+ export { formatMarkdownPage, formatMarkdownPageSection, stripFrontmatter, } from "./markdown/format.js";
9
+ export { absolutiseInternalLinks, sanitizePlaceholderUrls, } from "./markdown/links.js";
10
+ export { formatOpenApiPageContent } from "./openapi-pages.js";
11
+ export { buildSearchIndex } from "./search-index.js";
12
+ export { loadPrebuiltContentIndex, loadPrebuiltOpenApiIndex, loadPrebuiltSearchIndex, loadPrebuiltTocIndex, loadPrebuiltUtilityIndex, serializeContentIndex, serializeOpenApiIndex, serializeSearchIndex, serializeTocIndex, serializeUtilityIndex, } from "./serialization.js";
13
+ export { buildTocIndex, extractToc } from "./toc-index.js";
14
+ export type { ContentEntry, ContentIndex, PageMetadata, PrebuiltOpenApiEntry, SearchIndexItem, SiteConfigResult, TocItem, UtilityArtifact, UtilityIndex, UtilityPage, UtilitySegment, } from "./types.js";
15
+ export { buildUtilityArtifacts, buildUtilityIndex, getPrebuiltUtilityLlmPagePath, } from "./utility-index.js";
124
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,WAAW,EAEX,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACX,MAAM,cAAc,CAAC;AAQtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE5E,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AACjE,eAAO,MAAM,0BAA0B,uBAAuB,CAAC;AAC/D,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AACzD,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AACjE,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AACpE,eAAO,MAAM,0BAA0B,sBAAsB,CAAC;AAC9D,eAAO,MAAM,+BAA+B,2BAA2B,CAAC;AACxE,eAAO,MAAM,kCAAkC,+BAA+B,CAAC;AAC/E,eAAO,MAAM,iCAAiC,qBAAqB,CAAC;AACpE,eAAO,MAAM,uBAAuB,0BAA0B,CAAC;AAC/D,eAAO,MAAM,oCAAoC,wGACsD,CAAC;AAExG,MAAM,MAAM,gBAAgB,GACxB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CA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