blume 2.2.1 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cli/{chunk-080mfch6.js → chunk-0wt5amrk.js} +15 -15
- package/dist/cli/{chunk-k45sq16q.js → chunk-0xyedh7k.js} +39 -23
- package/dist/cli/{chunk-k45sq16q.js.map → chunk-0xyedh7k.js.map} +3 -3
- package/dist/cli/{chunk-f260jdrn.js → chunk-0ynr0fr7.js} +5 -5
- package/dist/cli/{chunk-e1n41w9m.js → chunk-1ay3hzn0.js} +3 -3
- package/dist/cli/{chunk-b680sv30.js → chunk-2f6btenb.js} +10 -8
- package/dist/cli/chunk-2f6btenb.js.map +13 -0
- package/dist/cli/{chunk-gwy55cx3.js → chunk-426rytg6.js} +2 -2
- package/dist/cli/{chunk-9h8mh2tk.js → chunk-5f96yq2c.js} +1 -1
- package/dist/cli/{chunk-x60e15st.js → chunk-5xq12jz7.js} +17 -17
- package/dist/cli/{chunk-x7bh6d9j.js → chunk-6xag1c83.js} +4 -4
- package/dist/cli/{chunk-487b95qy.js → chunk-88q28zav.js} +41 -25
- package/dist/cli/{chunk-487b95qy.js.map → chunk-88q28zav.js.map} +3 -3
- package/dist/cli/{chunk-yg8ckc3g.js → chunk-88zkpg89.js} +2 -2
- package/dist/cli/{chunk-ppa6mg4d.js → chunk-8fm3b4vm.js} +6 -6
- package/dist/cli/{chunk-rtvgmg2j.js → chunk-8h2t2vyj.js} +2 -2
- package/dist/cli/{chunk-2ssh60qh.js → chunk-982qfeny.js} +6 -6
- package/dist/cli/{chunk-t2h8pwy1.js → chunk-9emfspcp.js} +4 -4
- package/dist/cli/{chunk-9jqmq5hv.js → chunk-akj2p7k1.js} +6 -6
- package/dist/cli/{chunk-beb0z983.js → chunk-b664x65a.js} +16 -16
- package/dist/cli/{chunk-kmswjxj9.js → chunk-b7n58hgj.js} +3 -3
- package/dist/cli/{chunk-fnxgtjeq.js → chunk-c0qddrxr.js} +1 -1
- package/dist/cli/{chunk-p834rkcn.js → chunk-g62vnvaw.js} +5 -5
- package/dist/cli/{chunk-zxd5jrgx.js → chunk-gc7knd2s.js} +76 -34
- package/dist/cli/{chunk-zxd5jrgx.js.map → chunk-gc7knd2s.js.map} +4 -4
- package/dist/cli/{chunk-r5nm9w0c.js → chunk-hwjspffr.js} +105 -36
- package/dist/cli/{chunk-r5nm9w0c.js.map → chunk-hwjspffr.js.map} +11 -10
- package/dist/cli/{chunk-40vk8kgf.js → chunk-p4fe7tax.js} +7 -7
- package/dist/cli/{chunk-34wap3ed.js → chunk-psg2za5z.js} +3 -3
- package/dist/cli/{chunk-hktq4j5r.js → chunk-pxp1y6yz.js} +16 -10
- package/dist/cli/{chunk-hktq4j5r.js.map → chunk-pxp1y6yz.js.map} +4 -4
- package/dist/cli/{chunk-qcyxkj44.js → chunk-qax1aekz.js} +43 -17
- package/dist/cli/chunk-qax1aekz.js.map +15 -0
- package/dist/cli/{chunk-h0qwdbem.js → chunk-r5ajrw1g.js} +2 -2
- package/dist/cli/{chunk-q1wwrxzw.js → chunk-rc2qk3qx.js} +3 -3
- package/dist/cli/chunk-rc2qk3qx.js.map +10 -0
- package/dist/cli/{chunk-69rjf786.js → chunk-ry2ymbxf.js} +5 -5
- package/dist/cli/{chunk-gxhcf2hs.js → chunk-t43g7v22.js} +2 -2
- package/dist/cli/{chunk-ydqzkhjn.js → chunk-x0jqyq1g.js} +6 -6
- package/dist/cli/{chunk-aafhwx74.js → chunk-x25s4gph.js} +1 -1
- package/dist/cli/{chunk-nqna8dzp.js → chunk-xkx216rd.js} +17 -17
- package/dist/cli/{chunk-etckvbrh.js → chunk-xv8nkt56.js} +14 -14
- package/dist/cli/{chunk-hn3g2b89.js → chunk-yrmw5n2b.js} +9 -9
- package/dist/cli/{chunk-4zxh25hc.js → chunk-zgca0vxs.js} +2 -2
- package/dist/cli/{chunk-c5bjxq8v.js → chunk-zj6bcx0n.js} +2 -2
- package/dist/cli/{chunk-1ch3ct3r.js → chunk-zjfwzrvd.js} +14 -14
- package/dist/cli/{chunk-j4nfgn2j.js → chunk-znwhf37a.js} +1 -1
- package/dist/cli/index.js +18 -18
- package/dist/types/ai/ask-context.d.ts +8 -0
- package/dist/types/ai/link-text.d.ts +5 -0
- package/dist/types/ai/relative-links.d.ts +26 -6
- package/dist/types/core/config-input.d.ts +35 -1
- package/dist/types/core/data.d.ts +14 -0
- package/dist/types/core/last-modified.d.ts +33 -18
- package/dist/types/core/links.d.ts +16 -0
- package/dist/types/core/schema.d.ts +16 -1
- package/dist/types/core/types.d.ts +10 -0
- package/dist/types/deploy/sitemap.d.ts +9 -0
- package/dist/types/search/documents.d.ts +3 -1
- package/dist/types/search/fold.d.ts +33 -0
- package/dist/types/search/orama-index.d.ts +4 -4
- package/dist/types/seo/jsonld.d.ts +33 -0
- package/docs/configuration/search.mdx +2 -2
- package/docs/content/frontmatter.mdx +1 -1
- package/docs/content/i18n.mdx +1 -1
- package/docs/content/sources/remote-mdx.mdx +1 -1
- package/docs/discoverability/open-graph.mdx +16 -1
- package/docs/discoverability/sitemap-and-robots.mdx +12 -0
- package/docs/discoverability/structured-data.mdx +44 -0
- package/package.json +1 -1
- package/src/ai/ask-context.ts +52 -14
- package/src/ai/ask-data.ts +4 -1
- package/src/ai/ask-tools.ts +17 -5
- package/src/ai/link-text.ts +6 -0
- package/src/ai/llms.ts +1 -7
- package/src/ai/markdown.ts +8 -4
- package/src/ai/relative-links.ts +155 -48
- package/src/ai/site-skill.ts +1 -4
- package/src/astro/generate.ts +7 -0
- package/src/astro/templates.ts +36 -20
- package/src/components/layout/PageActions.astro +45 -18
- package/src/components/layout/PageLayout.astro +25 -12
- package/src/components/layout/RootLayout.astro +8 -1
- package/src/components/layout/locale-redirect.ts +38 -19
- package/src/components/layout/search/types.ts +12 -4
- package/src/core/config-input.ts +34 -1
- package/src/core/config.ts +5 -2
- package/src/core/data.ts +14 -0
- package/src/core/last-modified.ts +80 -34
- package/src/core/links.ts +43 -2
- package/src/core/manifest.ts +2 -0
- package/src/core/project-graph.ts +83 -43
- package/src/core/schema.ts +47 -9
- package/src/core/types.ts +10 -0
- package/src/deploy/sitemap.ts +127 -49
- package/src/openapi/proxy.ts +5 -1
- package/src/search/documents.ts +34 -11
- package/src/search/fold.ts +175 -0
- package/src/search/orama-index.ts +40 -49
- package/src/seo/jsonld.ts +100 -23
- package/dist/cli/chunk-b680sv30.js.map +0 -13
- package/dist/cli/chunk-q1wwrxzw.js.map +0 -10
- package/dist/cli/chunk-qcyxkj44.js.map +0 -14
- /package/dist/cli/{chunk-080mfch6.js.map → chunk-0wt5amrk.js.map} +0 -0
- /package/dist/cli/{chunk-f260jdrn.js.map → chunk-0ynr0fr7.js.map} +0 -0
- /package/dist/cli/{chunk-e1n41w9m.js.map → chunk-1ay3hzn0.js.map} +0 -0
- /package/dist/cli/{chunk-gwy55cx3.js.map → chunk-426rytg6.js.map} +0 -0
- /package/dist/cli/{chunk-9h8mh2tk.js.map → chunk-5f96yq2c.js.map} +0 -0
- /package/dist/cli/{chunk-x60e15st.js.map → chunk-5xq12jz7.js.map} +0 -0
- /package/dist/cli/{chunk-x7bh6d9j.js.map → chunk-6xag1c83.js.map} +0 -0
- /package/dist/cli/{chunk-yg8ckc3g.js.map → chunk-88zkpg89.js.map} +0 -0
- /package/dist/cli/{chunk-ppa6mg4d.js.map → chunk-8fm3b4vm.js.map} +0 -0
- /package/dist/cli/{chunk-rtvgmg2j.js.map → chunk-8h2t2vyj.js.map} +0 -0
- /package/dist/cli/{chunk-2ssh60qh.js.map → chunk-982qfeny.js.map} +0 -0
- /package/dist/cli/{chunk-t2h8pwy1.js.map → chunk-9emfspcp.js.map} +0 -0
- /package/dist/cli/{chunk-9jqmq5hv.js.map → chunk-akj2p7k1.js.map} +0 -0
- /package/dist/cli/{chunk-beb0z983.js.map → chunk-b664x65a.js.map} +0 -0
- /package/dist/cli/{chunk-kmswjxj9.js.map → chunk-b7n58hgj.js.map} +0 -0
- /package/dist/cli/{chunk-fnxgtjeq.js.map → chunk-c0qddrxr.js.map} +0 -0
- /package/dist/cli/{chunk-p834rkcn.js.map → chunk-g62vnvaw.js.map} +0 -0
- /package/dist/cli/{chunk-40vk8kgf.js.map → chunk-p4fe7tax.js.map} +0 -0
- /package/dist/cli/{chunk-34wap3ed.js.map → chunk-psg2za5z.js.map} +0 -0
- /package/dist/cli/{chunk-h0qwdbem.js.map → chunk-r5ajrw1g.js.map} +0 -0
- /package/dist/cli/{chunk-69rjf786.js.map → chunk-ry2ymbxf.js.map} +0 -0
- /package/dist/cli/{chunk-gxhcf2hs.js.map → chunk-t43g7v22.js.map} +0 -0
- /package/dist/cli/{chunk-ydqzkhjn.js.map → chunk-x0jqyq1g.js.map} +0 -0
- /package/dist/cli/{chunk-aafhwx74.js.map → chunk-x25s4gph.js.map} +0 -0
- /package/dist/cli/{chunk-nqna8dzp.js.map → chunk-xkx216rd.js.map} +0 -0
- /package/dist/cli/{chunk-etckvbrh.js.map → chunk-xv8nkt56.js.map} +0 -0
- /package/dist/cli/{chunk-hn3g2b89.js.map → chunk-yrmw5n2b.js.map} +0 -0
- /package/dist/cli/{chunk-4zxh25hc.js.map → chunk-zgca0vxs.js.map} +0 -0
- /package/dist/cli/{chunk-c5bjxq8v.js.map → chunk-zj6bcx0n.js.map} +0 -0
- /package/dist/cli/{chunk-1ch3ct3r.js.map → chunk-zjfwzrvd.js.map} +0 -0
- /package/dist/cli/{chunk-j4nfgn2j.js.map → chunk-znwhf37a.js.map} +0 -0
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./index.js";
|
|
10
10
|
import {
|
|
11
11
|
AGENTS
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-x25s4gph.js";
|
|
13
13
|
import {
|
|
14
14
|
i18nEnabled,
|
|
15
15
|
localeCodes,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
folderMetaSchema,
|
|
19
19
|
scanBody,
|
|
20
20
|
createModuleLoader
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-hwjspffr.js";
|
|
22
22
|
import {
|
|
23
23
|
seconds,
|
|
24
24
|
money,
|
|
@@ -34,11 +34,11 @@ import {
|
|
|
34
34
|
import {
|
|
35
35
|
findFolderMetaFiles,
|
|
36
36
|
scanProject
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-gc7knd2s.js";
|
|
38
38
|
import"./chunk-zccbjcj0.js";
|
|
39
39
|
import {
|
|
40
40
|
parseTimeoutSeconds
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-c0qddrxr.js";
|
|
42
42
|
|
|
43
43
|
// src/cli/commands/translate.ts
|
|
44
44
|
import { defineCommand } from "citty";
|
|
@@ -1212,4 +1212,4 @@ export {
|
|
|
1212
1212
|
};
|
|
1213
1213
|
|
|
1214
1214
|
//# debugId=7CBDF68DDB18B6AB64756E2164756E21
|
|
1215
|
-
//# sourceMappingURL=chunk-
|
|
1215
|
+
//# sourceMappingURL=chunk-0ynr0fr7.js.map
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
commandsFor,
|
|
8
8
|
detectProjectPackageManager
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-hwjspffr.js";
|
|
10
10
|
import {
|
|
11
11
|
EJECTED_CONFIG_HEADER
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-0xyedh7k.js";
|
|
13
13
|
import {
|
|
14
14
|
packageRoot,
|
|
15
15
|
logger
|
|
@@ -152,4 +152,4 @@ var refuseIfEjected = async (root, command) => {
|
|
|
152
152
|
export { publicFolder, trailingSlashAnswer, answerRequestsFirst, updatePackageScripts, isEjectedProject, refuseIfEjected };
|
|
153
153
|
|
|
154
154
|
//# debugId=CFEE49169891DC2F64756E2164756E21
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
155
|
+
//# sourceMappingURL=chunk-1ay3hzn0.js.map
|
|
@@ -12,11 +12,12 @@ import {
|
|
|
12
12
|
downlevelComponentNode,
|
|
13
13
|
downlevelComponents,
|
|
14
14
|
contentIndexable,
|
|
15
|
+
relativeLinkRewriter,
|
|
15
16
|
projectComponentSerializers,
|
|
16
17
|
applyAudienceVisibility,
|
|
17
18
|
agentMarkdown,
|
|
18
19
|
buildRawMarkdown
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-hwjspffr.js";
|
|
20
21
|
import {
|
|
21
22
|
normalizeBasePath
|
|
22
23
|
} from "./chunk-zccbjcj0.js";
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
RESERVED_META_KEYWORDS,
|
|
29
30
|
isForeignKeyword,
|
|
30
31
|
isLineRange
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-gc7knd2s.js";
|
|
32
33
|
|
|
33
34
|
// src/search/documents.ts
|
|
34
35
|
import { markdownToMdast, mdxToMdast } from "satteri";
|
|
@@ -226,14 +227,14 @@ var buildCrumbIndex = (sidebar) => {
|
|
|
226
227
|
}
|
|
227
228
|
return index;
|
|
228
229
|
};
|
|
229
|
-
var pageBody = async (project, page, options, components) => {
|
|
230
|
+
var pageBody = async (project, page, options, components, rewriteLinks) => {
|
|
230
231
|
if (!page) {
|
|
231
232
|
return "";
|
|
232
233
|
}
|
|
233
234
|
const parsed = frontmatter_default(await readExpandedEntryText(project, page));
|
|
234
235
|
const visible = applyAudienceVisibility(parsed.content, options?.audience ?? "web");
|
|
235
|
-
if (
|
|
236
|
-
return downlevelComponents(visible.trim(), components, parsed.data);
|
|
236
|
+
if (rewriteLinks) {
|
|
237
|
+
return downlevelComponents(rewriteLinks(visible, page).trim(), components, parsed.data);
|
|
237
238
|
}
|
|
238
239
|
return toPlainText(visible, page.format, {
|
|
239
240
|
downlevel: {
|
|
@@ -277,6 +278,7 @@ var buildSearchDocuments = async (project, options) => {
|
|
|
277
278
|
return page ? contentIndexable(page, config, graph) : false;
|
|
278
279
|
});
|
|
279
280
|
const components = projectComponentSerializers(project);
|
|
281
|
+
const rewriteLinks = options?.content === "markdown" ? relativeLinkRewriter(project, { assistant: true }) : undefined;
|
|
280
282
|
const { i18n } = project.config;
|
|
281
283
|
const docsSections = new Map;
|
|
282
284
|
const docsSection = (locale) => {
|
|
@@ -292,7 +294,7 @@ var buildSearchDocuments = async (project, options) => {
|
|
|
292
294
|
};
|
|
293
295
|
return await Promise.all(indexable.map(async (route) => {
|
|
294
296
|
const page = pageById.get(route.id);
|
|
295
|
-
const body = await pageBody(project, page, options, components);
|
|
297
|
+
const body = await pageBody(project, page, options, components, rewriteLinks);
|
|
296
298
|
const tags = page?.meta?.search?.tags;
|
|
297
299
|
const crumb = crumbs.get(route.path);
|
|
298
300
|
const facets = page ? pageFacets(page, project.config) : undefined;
|
|
@@ -396,5 +398,5 @@ var buildMcpData = async (project) => {
|
|
|
396
398
|
|
|
397
399
|
export { EXPANDABLE_VISIBLE_LINES, buildSearchDocuments, buildMcpData };
|
|
398
400
|
|
|
399
|
-
//# debugId=
|
|
400
|
-
//# sourceMappingURL=chunk-
|
|
401
|
+
//# debugId=0C8488DE9FAE851264756E2164756E21
|
|
402
|
+
//# sourceMappingURL=chunk-2f6btenb.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/search/documents.ts", "../src/markdown/code-title.ts", "../src/search/facets.ts", "../src/ai/mcp/data.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { Nodes } from \"mdast\";\nimport { markdownToMdast, mdxToMdast } from \"satteri\";\n\nimport {\n componentRegistry,\n downlevelComponentNode,\n downlevelComponents,\n} from \"../ai/component-markdown.ts\";\nimport type {\n ComponentMarkdown,\n DownlevelWalk,\n MdastNode as DownlevelNode,\n} from \"../ai/component-markdown.ts\";\nimport { relativeLinkRewriter } from \"../ai/relative-links.ts\";\nimport type { RelativeLinkRewriter } from \"../ai/relative-links.ts\";\nimport { projectComponentSerializers } from \"../ai/serializers.ts\";\nimport { applyAudienceVisibility } from \"../ai/visibility.ts\";\nimport type { VisibilityAudience } from \"../ai/visibility.ts\";\nimport matter from \"../core/frontmatter.ts\";\nimport { parseHeadingMarkers } from \"../core/heading-markers.ts\";\nimport { EN_UI, resolveUIStrings } from \"../core/i18n-ui.ts\";\nimport { contentIndexable } from \"../core/manifest.ts\";\nimport type { BlumeProject } from \"../core/project-graph.ts\";\nimport { HTML_COMMENT } from \"../core/sources/normalize.ts\";\nimport { readExpandedEntryText } from \"../core/sources/read.ts\";\nimport type { NavNode, PageRecord } from \"../core/types.ts\";\nimport { parseCodeTitle } from \"../markdown/code-title.ts\";\nimport { directiveSource } from \"../markdown/directives.ts\";\nimport type { DirectiveNode } from \"../markdown/directives.ts\";\nimport {\n MARKDOWN_BODY_FEATURES,\n MDX_BODY_FEATURES,\n} from \"../markdown/features.ts\";\nimport { normalizeFence } from \"../markdown/fence-language.ts\";\nimport { pageFacets } from \"./facets.ts\";\n\n/** A document indexed by the client-side search providers (Orama, FlexSearch). */\nexport interface SearchDocument {\n route: string;\n title: string;\n description: string;\n content: string;\n /** Ancestor section labels for the result breadcrumb, e.g. `[\"Guides\"]`. */\n breadcrumb: string[];\n /** Top-level section label, used by the search filter pills. */\n section: string;\n /** Locale code, so the dialog can filter results to the active language. */\n locale: string;\n /** Resolved page `type` (`doc`, `blog`, a custom `rfc`…), for type filters. */\n contentType: string;\n /** Docs version (`\"\"` for the current docs), so results scope to the viewed version. */\n version: string;\n /** Frontmatter `search.tags`, surfaced for hosted-provider faceting. */\n tags?: string[];\n /**\n * Declared facet values (`content.types.<type>.facets`), key → value.\n * Filterable through the MCP tools' `filters` input.\n */\n facets?: Record<string, string>;\n /** Frontmatter `search.boost`: the page's relevance multiplier, when set. */\n boost?: number;\n /** Frontmatter `search.keywords`: extra terms the page is found by. */\n keywords?: string[];\n}\n\n/**\n * A record uploaded to a hosted search backend (Algolia, Orama Cloud,\n * Typesense, Mixedbread). `_id` is the stable per-page key; each sync adapts it\n * to the backend's own id field (`objectID`, `id`, …).\n */\nexport interface SearchRecord {\n _id: string;\n url: string;\n title: string;\n description: string;\n content: string;\n /** Locale code, carried as a facet for per-language filtering. */\n locale: string;\n /**\n * Docs version, carried as a facet for per-version filtering. The current\n * docs upload as `\"current\"` — hosted backends treat an empty facet value\n * unreliably, so the sentinel stands in for the empty version id.\n */\n version: string;\n /** Single faceting tag (the first frontmatter tag, when present). */\n tag?: string;\n /**\n * The page's relevance multiplier, 1 unless `search.boost` sets it: a\n * ranking attribute every record carries, so the backend can sort by it.\n */\n boost: number;\n /** Extra terms the page is found by (`search.keywords`). */\n keywords?: string[];\n}\n\n// Tag-shaped only: a name (or closing slash/fragment) right after `<`, and no\n// newline inside. Applied *within* html/JSX nodes so their inner prose is\n// kept; the surrounding Markdown is walked as a tree, so a bare `<` in prose\n// (\"costs < 5 credits\") is ordinary text and never at risk.\nconst HTML_OR_JSX = /<\\/?[a-zA-Z][^\\n<>]*>|<\\/?>/gu;\nconst WHITESPACE = /\\s+/gu;\n\n// Parents whose children are inline: no separator is inserted after them, or\n// `re*ally*` would index as `re ally`. Every other parent is block-shaped and\n// ends with a space so adjacent paragraphs/headings/cells don't fuse.\nconst INLINE_PARENTS = new Set([\n \"delete\",\n \"emphasis\",\n \"footnoteReference\",\n \"link\",\n \"linkReference\",\n \"mdxJsxTextElement\",\n \"strong\",\n \"subscript\",\n \"superscript\",\n]);\n\n// Nodes that never render as prose: image alt text was never indexed, MDX\n// expressions (`{props.x}`) and ESM (`export const meta`) are code, and math\n// is LaTeX source rendered by KaTeX, not searchable words.\nconst NON_PROSE = new Set<Nodes[\"type\"]>([\n \"image\",\n \"imageReference\",\n \"inlineMath\",\n \"math\",\n \"mdxFlowExpression\",\n \"mdxTextExpression\",\n \"mdxjsEsm\",\n]);\n\ntype PageFormat = PageRecord[\"format\"];\n\n/** What the plain-text walk carries: the code-block policy and the downlevel context. */\ninterface Walk {\n includeCodeBlocks: boolean;\n downlevel: DownlevelWalk;\n}\n\n// Front matter is already off (core/frontmatter.ts) by the time a body gets\n// here, so a body that opens with a `---` divider must read as a thematic\n// break rather than a second front matter block — as the renderer reads it.\nconst MD_PARSE = { features: MARKDOWN_BODY_FEATURES };\nconst MDX_PARSE = { features: MDX_BODY_FEATURES };\n\nconst parseMdx = (markdown: string): Nodes | undefined => {\n try {\n return mdxToMdast(markdown, MDX_PARSE);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Parse a page body the way the renderer reads it. `.mdx` pages go through\n * the MDX grammar with the renderer's feature set, so components become\n * `mdxJsx*` nodes whose children — prose and fences, however they're indented\n * — walk like top-level content, and `:::` directives and `$$` math parse as\n * such; Markdown would instead fold a tight component into one html node and\n * read its indented children as an indented code block. A page the MDX\n * grammar rejects (an HTML comment, an unclosed tag) fails to render too, so\n * it has no body to index: reading it as Markdown instead would put its ESM,\n * expressions, and raw tags in the index as prose.\n */\nconst parseMarkdown = (\n markdown: string,\n format: PageFormat\n): Nodes | undefined =>\n format === \"mdx\" ? parseMdx(markdown) : markdownToMdast(markdown, MD_PARSE);\n\n// Fenced code is excluded from the plain index by default (ranking noise) —\n// the \"markdown\" extraction keeps it for assistant grounding. Code-heavy docs opt\n// in via `search.indexing.includeCodeBlocks`, which indexes the fence body and\n// its rendered title (```ts blume.config.ts) but never the fence markers,\n// language, or other meta keywords.\nconst collectCode = (\n node: Extract<Nodes, { type: \"code\" }>,\n out: string[],\n walk: Walk\n): void => {\n if (!walk.includeCodeBlocks) {\n return;\n }\n // The fence as the page renders it (`[file.ts]{2}` splits, `JSON`\n // lowercases), so the indexed title is the one the page shows.\n const fence = normalizeFence(node.lang, node.meta) ?? node;\n const title = parseCodeTitle(\n fence.meta ?? undefined,\n fence.lang ?? undefined\n );\n if (title) {\n out.push(title, \" \");\n }\n // The trailing space keeps the fence apart from what follows it.\n out.push(node.value, \" \");\n};\n\n/**\n * A text or leaf directive as the page shows it. Blume renders neither (see\n * `markdown/directives.ts`), and prose is full of text that parses as one —\n * `16:9`, `og:image` — so the page shows the source the author wrote, and the\n * index reads the same text rather than dropping the `:name` part.\n */\nconst directiveText = (\n node: Extract<Nodes, { type: \"leafDirective\" | \"textDirective\" }>,\n walk: Walk\n): string =>\n directiveSource(\n // SAFETY: DirectiveNode is a structural subset of Satteri's directive\n // nodes — a `name`, optional attributes and children, and a position.\n node as DirectiveNode,\n node.type === \"textDirective\" ? \":\" : \"::\",\n // The walked tree was parsed from this text, so its offsets index into it.\n walk.downlevel.source\n );\n\n// Block boundaries separate words; so does an empty inline element (`<br />`,\n// a self-closing icon), which otherwise fuses its neighbors.\nconst separatesWords = (node: Extract<Nodes, { children: unknown }>): boolean =>\n !INLINE_PARENTS.has(node.type) || node.children.length === 0;\n\n/** Fold one mdast node into the plain-text accumulator. */\nconst collectText = (node: Nodes, out: string[], walk: Walk): void => {\n if (NON_PROSE.has(node.type)) {\n return;\n }\n switch (node.type) {\n case \"code\": {\n collectCode(node, out, walk);\n return;\n }\n // A component with a serializer indexes as the text the page shows —\n // a Card's title and call to action, a TypeTable's descriptions — read\n // from the Markdown the serializer emits (its contract is Markdown, not\n // MDX). One without a serializer walks its children like any block.\n case \"mdxJsxFlowElement\": {\n // SAFETY: DownlevelNode is a structural subset of Satteri's mdast\n // output — the walk checks for offsets before reading them.\n const text = downlevelComponentNode(\n node as DownlevelNode,\n walk.downlevel\n );\n if (text !== null) {\n collectText(markdownToMdast(text, MD_PARSE), out, walk);\n return;\n }\n break;\n }\n // Inline code is kept verbatim — `Array<T>` is a type parameter, not a\n // tag, and its tokens must stay searchable.\n case \"inlineCode\": {\n out.push(node.value);\n return;\n }\n // A raw-HTML run. In a `.md` page (or an `.mdx` page MDX couldn't parse)\n // CommonMark folds a block-level `<Callout>` with no blank lines into ONE\n // html node holding all its inner prose, so the node can't just be\n // dropped — strip the tag-shaped runs and keep the text.\n case \"html\": {\n out.push(\n node.value.replaceAll(HTML_COMMENT, \" \").replaceAll(HTML_OR_JSX, \" \"),\n \" \"\n );\n return;\n }\n case \"break\": {\n out.push(\" \");\n return;\n }\n case \"textDirective\": {\n out.push(directiveText(node, walk));\n return;\n }\n case \"leafDirective\": {\n out.push(directiveText(node, walk), \" \");\n return;\n }\n case \"heading\": {\n // oxlint-disable-next-line no-use-before-define -- mutual recursion: a heading's children are walked like any others\n collectHeading(node, out, walk);\n return;\n }\n default: {\n break;\n }\n }\n if (\"value\" in node) {\n out.push(node.value);\n return;\n }\n if (\"children\" in node) {\n for (const child of node.children) {\n collectText(child, out, walk);\n }\n if (separatesWords(node)) {\n out.push(\" \");\n }\n }\n};\n\n/**\n * Fold a heading into the accumulator. Trailing heading markers\n * (`[#custom-id]`, `{#custom-id}`, `[!toc]`, `[toc]`) are anchor metadata,\n * not prose — strip them so they never pollute the index. Only a marker that\n * ends the heading's final plain-text child counts, mirroring the renderer: a\n * heading ending in inline code or an image keeps its bracketed text on the\n * page (so it stays searchable), and a heading that is nothing but markers\n * renders them literally.\n */\nconst collectHeading = (\n node: Extract<Nodes, { type: \"heading\" }>,\n out: string[],\n walk: Walk\n): void => {\n const last = node.children.at(-1);\n const trailing = last?.type === \"text\" ? last : undefined;\n const inner: string[] = [];\n const kept = trailing ? node.children.slice(0, -1) : node.children;\n for (const child of kept) {\n collectText(child, inner, walk);\n }\n if (trailing) {\n const stripped = parseHeadingMarkers(trailing.value).text;\n const literal = stripped === \"\" && node.children.length === 1;\n inner.push(literal ? trailing.value : stripped);\n }\n out.push(inner.join(\"\").trimEnd(), \" \");\n};\n\n/**\n * Reduce Markdown/MDX to plain, searchable text: parse (GFM included) and walk\n * the tree instead of regex-stripping the source, so reference-style links,\n * autolinks, setext headings, tables, and literal `*`/`~`/`>` in prose all\n * reduce correctly. This feeds the client index *and* every hosted-provider\n * record, so anything lost here is a permanent search-quality loss.\n */\nconst toPlainText = (\n markdown: string,\n format: PageFormat,\n walk: Walk\n): string => {\n const tree = parseMarkdown(markdown, format);\n if (!tree) {\n return \"\";\n }\n const out: string[] = [];\n collectText(tree, out, walk);\n return out.join(\"\").replaceAll(WHITESPACE, \" \").trim();\n};\n\ninterface Crumbs {\n breadcrumb: string[];\n section: string;\n}\n\n/**\n * Map each page route to its ancestor section labels by walking the nav sidebar\n * once. The nearest ancestor group — the sidebar section a page appears under —\n * becomes its `section`, the dimension the search filter pills group by, so the\n * pills mirror the visible sidebar (and honor folder-meta renames).\n */\nconst buildCrumbIndex = (sidebar: NavNode[]): Map<string, Crumbs> => {\n const index = new Map<string, Crumbs>();\n // A config-sidebar section's landing page (the group's `root`) lives on the\n // *group* node, not on any page leaf — record it under the group's own label\n // so the section's landing page carries the same facet as its children. A\n // real page leaf for the route (filesystem sidebars emit index pages as\n // leaves) wins, so group routes are merged in only where no leaf claimed one.\n const groupRoutes = new Map<string, Crumbs>();\n const walk = (nodes: NavNode[], trail: string[]): void => {\n for (const node of nodes) {\n if (node.kind === \"group\") {\n if (node.route && !groupRoutes.has(node.route)) {\n groupRoutes.set(node.route, {\n breadcrumb: [...trail, node.label],\n section: node.label,\n });\n }\n walk(node.children, [...trail, node.label]);\n } else if (node.route) {\n index.set(node.route, {\n breadcrumb: trail,\n section: trail.at(-1) ?? \"\",\n });\n }\n }\n };\n walk(sidebar, []);\n for (const [route, crumbs] of groupRoutes) {\n if (!index.has(route)) {\n index.set(route, crumbs);\n }\n }\n return index;\n};\n\ninterface BuildOptions {\n includeWhenDisabled?: boolean;\n content?: \"markdown\" | \"plain\";\n audience?: VisibilityAudience;\n}\n\n/**\n * Read a page's body and reduce it per the extraction options. The\n * `\"markdown\"` body, the one `rewriteLinks` comes with, is agent-facing: its\n * page links are rewritten, then its components downleveled in the source\n * with the serializers every agent surface uses (front matter in scope for\n * prop expressions), in the order llms-full.txt takes. The plain body is\n * parsed as written and walked, with the same serializers applied per\n * component on the way, so the index reads a `<Card>` or `<TypeTable>` as\n * the text it shows.\n */\nconst pageBody = async (\n project: BlumeProject,\n page: PageRecord | undefined,\n options: Pick<BuildOptions, \"audience\"> | undefined,\n components: Record<string, ComponentMarkdown>,\n rewriteLinks: RelativeLinkRewriter | undefined\n): Promise<string> => {\n if (!page) {\n return \"\";\n }\n const parsed = matter(await readExpandedEntryText(project, page));\n const visible = applyAudienceVisibility(\n parsed.content,\n options?.audience ?? \"web\"\n );\n if (rewriteLinks) {\n return downlevelComponents(\n rewriteLinks(visible, page).trim(),\n components,\n parsed.data\n );\n }\n return toPlainText(visible, page.format, {\n downlevel: {\n frontmatter: parsed.data,\n registry: componentRegistry(components),\n source: visible,\n },\n includeCodeBlocks: project.config.search.indexing.includeCodeBlocks,\n });\n};\n\n/** The ranking a page asks for: its `search.boost` and `search.keywords`. */\nconst rankingFields = (\n search: PageRecord[\"meta\"][\"search\"] | undefined\n): Pick<SearchDocument, \"boost\" | \"keywords\"> => {\n const { boost, keywords } = search ?? {};\n return {\n ...(boost !== undefined && boost !== 1 && { boost }),\n ...(keywords && keywords.length > 0 && { keywords }),\n };\n};\n\n/**\n * Build search documents from the content graph. Only indexable pages are\n * included (per the route manifest), and content comes from the source files,\n * so the index is identical in dev and build.\n *\n * Pass `includeWhenDisabled` to index pages on their content merits even when\n * the search provider is `none` — used by the MCP server, which is a separate\n * feature from on-page search.\n *\n * `content` selects the extraction: `\"plain\"` (default) strips Markdown to bare\n * searchable text; `\"markdown\"` keeps the body's Markdown — code blocks, lists,\n * headings — for assistant grounding, where fenced examples are often the answer\n * and stripping them makes the model unable to cite content the docs do contain.\n * The `\"markdown\"` body is agent-facing, so components are downleveled with the\n * same serializers the `.md` mirror, llms-full.txt and MCP `get_page` use: a\n * page whose body is a `<CardGroup>` of `<Card>`s is prose to a reader and bare\n * JSX to anything reading the source, and section landing pages are exactly\n * that shape. Its page links point at the pages they mean, as they do there\n * too, as the routes the assistant's snapshot keys those pages by (see\n * `relativeLinkRewriter`'s `assistant`): the model cites the links it reads.\n *\n * `audience` resolves `<Visibility>` blocks before extraction: `\"web\"`\n * (default) keeps web-only content and drops agents-only blocks — the site\n * search and hosted syncs must not surface content the page hides — while\n * `\"agents\"` mirrors llms-full.txt/MCP `get_page` (web removed, agents kept).\n *\n * Whether fenced code joins the plain extraction is site-wide policy, read\n * from `search.indexing.includeCodeBlocks` here rather than threaded by each\n * caller, so the client index, hosted syncs, eject, and the MCP `search_docs`\n * index can't drift apart.\n */\nexport const buildSearchDocuments = async (\n project: BlumeProject,\n options?: BuildOptions\n): Promise<SearchDocument[]> => {\n const pageById = new Map(project.graph.pages.map((page) => [page.id, page]));\n\n // Build the crumb index from every locale's sidebar (their nodes carry\n // locale-prefixed routes), so localized pages get the right section/breadcrumb.\n // Falls back to the single default-locale nav when i18n is off.\n const byLocale = Object.values(project.graph.navigationByLocale ?? {});\n // Archived versions' trees contribute too, so snapshot pages get their own\n // section/breadcrumb instead of falling through to the \"Docs\" default.\n const byVersion = Object.values(project.graph.navigationByVersion ?? {})\n .flatMap((locales) => Object.values(locales))\n .map((nav) => nav.sidebar);\n const sidebars = [\n ...(byLocale.length > 0\n ? byLocale.map((nav) => nav.sidebar)\n : [project.graph.navigation?.sidebar ?? []]),\n ...byVersion,\n ];\n const crumbs = new Map<string, Crumbs>();\n for (const sidebar of sidebars) {\n for (const [route, crumb] of buildCrumbIndex(sidebar)) {\n crumbs.set(route, crumb);\n }\n }\n\n const indexable = project.manifest.routes.filter((route) => {\n if (!options?.includeWhenDisabled) {\n return route.indexable;\n }\n // A fallback route renders the fallback locale's page at another locale's\n // URL, so indexing it would only repeat that page as a second hit — the\n // reason site search leaves it out too.\n if (route.fallback) {\n return false;\n }\n const page = pageById.get(route.id);\n const { config, graph } = project;\n return page ? contentIndexable(page, config, graph) : false;\n });\n\n // Built once — `downlevelComponents` rebuilds its registry per call\n // otherwise.\n const components = projectComponentSerializers(project);\n // The `\"markdown\"` body is the assistant's: the model cites the links it\n // reads, so a page link points at the page the snapshot holds.\n const rewriteLinks =\n options?.content === \"markdown\"\n ? relativeLinkRewriter(project, { assistant: true })\n : undefined;\n\n // A page in no sidebar group falls under the \"Docs\" section, in its own\n // language: the label is a UI string, resolved once per locale.\n const { i18n } = project.config;\n const docsSections = new Map<string, string>();\n const docsSection = (locale: string): string => {\n let label = docsSections.get(locale);\n if (label === undefined) {\n label = (\n i18n\n ? resolveUIStrings(locale, {\n defaultLocale: i18n.defaultLocale,\n overrides: i18n.ui,\n })\n : EN_UI\n ).search.docs;\n docsSections.set(locale, label);\n }\n return label;\n };\n\n return await Promise.all(\n indexable.map(async (route) => {\n const page = pageById.get(route.id);\n const body = await pageBody(\n project,\n page,\n options,\n components,\n rewriteLinks\n );\n const tags = page?.meta?.search?.tags;\n const crumb = crumbs.get(route.path);\n const facets = page ? pageFacets(page, project.config) : undefined;\n const document: SearchDocument = {\n breadcrumb: crumb?.breadcrumb ?? [],\n content: body,\n contentType: route.contentType,\n description: page?.description ?? \"\",\n locale: route.locale,\n route: route.path,\n section: crumb?.section || docsSection(route.locale),\n tags: tags && tags.length > 0 ? tags : undefined,\n title: route.title,\n version: route.version,\n };\n if (facets) {\n document.facets = facets;\n }\n return { ...document, ...rankingFields(page?.meta?.search) };\n })\n );\n};\n\n/**\n * Map per-page search documents to the flat record shape hosted backends\n * ingest. One record per page, keyed by route; the first tag becomes the\n * faceting `tag`, and every record carries a `boost` (1 by default).\n */\nexport const toSearchRecords = (documents: SearchDocument[]): SearchRecord[] =>\n documents.map((doc) => ({\n _id: doc.route,\n boost: doc.boost ?? 1,\n content: doc.content,\n description: doc.description,\n ...(doc.keywords && { keywords: doc.keywords }),\n locale: doc.locale,\n tag: doc.tags?.[0],\n title: doc.title,\n url: doc.route,\n version: doc.version || \"current\",\n }));\n",
|
|
6
|
+
"/**\n * Code-fence meta. A Shiki transformer reads the tokens after the language and\n * promotes them to attributes on the rendered `<pre>`:\n *\n * - a title — the bare words (```ts blume.config.ts, ```js Install the\n * client) or `title=\"...\"` — becomes `data-title`; the theme's code header\n * shows it, falling back to the language label.\n * - the `lineNumbers` keyword (```ts file.ts lineNumbers) becomes\n * `data-line-numbers`; the theme renders a counter-driven line-number gutter.\n * - the `wrap` keyword becomes `data-wrap`: this block's long lines wrap\n * instead of scrolling, as `markdown.code.wrap` does for every block.\n * - the `expandable` keyword becomes `data-expandable` on a block of\n * {@link EXPANDABLE_MIN_LINES} lines or more: the theme shows its first\n * {@link EXPANDABLE_VISIBLE_LINES} lines, and the page script adds a toggle\n * that shows the rest in full. A shorter block renders as it is.\n */\n\nimport {\n isForeignKeyword,\n isLineRange,\n metaTokens,\n QUOTED_ATTR,\n RESERVED_META_KEYWORDS,\n} from \"./fence-meta.ts\";\n\n/** The lines a collapsed `expandable` block shows. */\nexport const EXPANDABLE_VISIBLE_LINES = 10;\n\n/**\n * The lines a block needs before `expandable` collapses it: a few more than it\n * shows, so the toggle never hides a line or two behind a click.\n */\nexport const EXPANDABLE_MIN_LINES = 16;\n\n/** The slice of Shiki's transformer `this` context Blume reads. */\ninterface CodeMetaContext {\n options: { lang?: string; meta?: { __raw?: string } };\n /** The block's code, as highlighted. */\n source?: string;\n}\n\n/** The `<pre>` hast node a Shiki `pre` hook receives. */\ninterface PreNode {\n properties: Record<string, boolean | number | string | undefined>;\n}\n\n/** A Shiki-compatible transformer, typed structurally to avoid a Shiki dep. */\nexport interface CodeTitleTransformer {\n name: string;\n pre: (this: CodeMetaContext, node: PreNode) => void;\n}\n\nconst TITLE_ATTR = /(?:^|\\s)title=(?:\"(?<dq>[^\"]*)\"|'(?<sq>[^']*)')/u;\n\n// The bare words are the title (```ts blume.config.ts, ```js Install the\n// client): every token that isn't a Shiki line range (`{1,3-5}`), a\n// `key=value` attr, a reserved keyword, or another tool's keyword for a\n// fence in `lang` (```rust ignore).\nconst isTitleToken = (token: string, lang: string | undefined): boolean =>\n token.length > 0 &&\n !isLineRange(token) &&\n !token.includes(\"=\") &&\n !RESERVED_META_KEYWORDS.has(token) &&\n !isForeignKeyword(token, lang);\n\n// A title wrapped in one pair of brackets (```ts [file.ts], the Docus and\n// VitePress code-group spelling) shows without them.\nconst BRACKETED_TITLE = /^\\[(?<inner>[^\\]]+)\\]$/u;\n\n/**\n * The title a fence's meta string promotes to `data-title`, if any. `lang` is\n * the fence's language, which decides the other tools' keywords it drops.\n */\nexport const parseCodeTitle = (\n raw: string | undefined,\n lang?: string\n): string | undefined => {\n if (!raw) {\n return undefined;\n }\n // Blank every *other* quoted attr first, so a `title=\"…\"` embedded in\n // another attribute's value (`caption='set title=\"X\" here'`) can't be\n // promoted to the block title.\n const scrubbed = raw.replace(QUOTED_ATTR, (attr) =>\n attr.startsWith(\"title=\") ? attr : \" \"\n );\n const explicit = scrubbed.match(TITLE_ATTR);\n const attrTitle = explicit?.groups?.dq ?? explicit?.groups?.sq;\n if (attrTitle) {\n return attrTitle;\n }\n // The shared tokenizer keeps a quoted attr (rejected below by its `=`) and\n // a spaced line range (`{1, 3-5}`) whole, so neither can shed a fragment\n // that reads as a bare title.\n const title = metaTokens(raw)\n .filter((token) => isTitleToken(token, lang))\n .join(\" \");\n return BRACKETED_TITLE.exec(title)?.groups?.inner ?? (title || undefined);\n};\n\n// The shared tokenizer keeps a quoted attr whole, so a keyword inside a\n// quoted value (`title=\"enable lineNumbers later\"`) is never a token of its own.\nconst hasKeyword = (raw: string | undefined, keyword: string): boolean =>\n metaTokens(raw).includes(keyword);\n\n/** How many lines a block's code runs to, a trailing newline aside. */\nexport const lineCount = (source = \"\"): number =>\n source === \"\" ? 0 : source.replace(/\\r?\\n$/u, \"\").split(/\\r?\\n/u).length;\n\n/** Build the transformer. Runs after Shiki's built-in `data-language` hook. */\nexport const codeTitleTransformer = (): CodeTitleTransformer => ({\n name: \"blume:code-meta\",\n pre(node) {\n const raw = this.options.meta?.__raw;\n const title = parseCodeTitle(raw, this.options.lang);\n if (title) {\n node.properties.dataTitle = title;\n }\n if (hasKeyword(raw, \"lineNumbers\")) {\n node.properties.dataLineNumbers = true;\n }\n if (hasKeyword(raw, \"wrap\")) {\n node.properties.dataWrap = true;\n }\n if (\n hasKeyword(raw, \"expandable\") &&\n lineCount(this.source) >= EXPANDABLE_MIN_LINES\n ) {\n node.properties.dataExpandable = true;\n }\n },\n});\n",
|
|
7
|
+
"import type { ResolvedConfig } from \"../core/schema.ts\";\nimport type { PageRecord } from \"../core/types.ts\";\n\n/**\n * Resolve a page's facet values: the subset of its validated custom\n * frontmatter named by its content type's `facets` declaration. Strings facet\n * as-is; numbers and booleans are stringified so an enum-like `priority: 1`\n * or `enforced: true` still filters; any other shape (objects, arrays,\n * transformed dates) is not a facet value and is skipped. Returns `undefined`\n * when nothing facets, so the field stays absent from serialized documents\n * rather than shipping as `{}` on every page.\n */\n/** Whether a custom frontmatter value stringifies into a usable facet value. */\nconst isFacetValue = <T>(value: T): value is T & (string | number | boolean) =>\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\";\n\nexport const pageFacets = (\n page: Pick<PageRecord, \"contentType\" | \"custom\">,\n config: ResolvedConfig\n): Record<string, string> | undefined => {\n const declared = config.content.types[page.contentType]?.facets;\n if (!declared || declared.length === 0 || !page.custom) {\n return;\n }\n const facets: Record<string, string> = {};\n for (const key of declared) {\n const value = page.custom[key];\n if (isFacetValue(value)) {\n facets[key] = String(value);\n }\n }\n return Object.keys(facets).length > 0 ? facets : undefined;\n};\n",
|
|
8
|
+
"import { normalizeBasePath } from \"../../core/base-path.ts\";\nimport type { BlumeProject } from \"../../core/project-graph.ts\";\nimport type { Navigation } from \"../../core/types.ts\";\nimport { buildSearchDocuments } from \"../../search/documents.ts\";\nimport { pageFacets } from \"../../search/facets.ts\";\nimport type { OramaDoc } from \"../../search/orama-index.ts\";\nimport { agentMarkdown, buildRawMarkdown } from \"../markdown.ts\";\n\n/** A page entry surfaced by the `list_pages` MCP tool. */\nexport interface McpRoute {\n contentType: string;\n description?: string;\n /** Declared facet values (`content.types.<type>.facets`), key → value. */\n facets?: Record<string, string>;\n indexable: boolean;\n lastModified: string | null;\n /** Resolved locale code (the default locale when not under i18n). */\n locale: string;\n route: string;\n title: string;\n /** Docs version (`\"\"` for the current docs). */\n version: string;\n}\n\n/**\n * The self-contained snapshot the generated MCP endpoint serves. Bundles the\n * search documents, raw page Markdown, route list, and navigation so the server\n * works regardless of the configured search provider and needs no filesystem\n * access at request time. Serialized to `generated/mcp-data.json`.\n */\nexport interface McpData {\n /**\n * Normalized `deployment.base` (`\"\"` or `/seg`), layered onto routes when\n * emitting URLs — the site is base-less and routes are base-less manifest\n * paths, matching the sitemap/llms.txt convention.\n */\n base: string;\n /**\n * The site's `i18n.defaultLocale`, when i18n is configured. Selects a\n * word-segmenting Orama tokenizer for every non-Latin script, so\n * `search_docs` can match CJK, Cyrillic, Greek, Hebrew, or Devanagari\n * content.\n */\n defaultLocale?: string;\n /**\n * Archived docs version ids, in configured order. Present only on a\n * versioned site; its presence is what makes `search_docs`/`list_pages`\n * default to the current docs.\n */\n archivedVersions?: string[];\n documents: OramaDoc[];\n instructions?: string;\n name: string;\n navigation: Navigation;\n /** Per-locale trees for a locale-aware `get_navigation` (i18n sites only). */\n navigationByLocale?: Record<string, Navigation>;\n /** Per-archived-version trees, keyed by version id then locale code. */\n navigationByVersion?: Record<string, Record<string, Navigation>>;\n pages: Record<string, string>;\n routes: McpRoute[];\n site: string | null;\n version: string;\n}\n\n/** Build the MCP data snapshot from a resolved project. */\nexport const buildMcpData = async (project: BlumeProject): Promise<McpData> => {\n const { config, graph, manifest } = project;\n const [documents, rawMarkdown] = await Promise.all([\n // The MCP server is independent of on-page search, so index docs even when\n // the search provider is `none`. Documents are agent-facing, so\n // `<Visibility>` resolves like `get_page`/llms-full.txt (web-only content\n // removed, agents-only kept).\n buildSearchDocuments(project, {\n audience: \"agents\",\n includeWhenDisabled: true,\n }),\n buildRawMarkdown(project),\n ]);\n\n // `get_page` serves the agent variant: components downleveled to Markdown.\n const pages = Object.fromEntries(\n Object.entries(rawMarkdown).map(([route, entry]) => [\n route,\n agentMarkdown(entry),\n ])\n );\n\n const pageById = new Map(graph.pages.map((page) => [page.id, page]));\n\n const routes: McpRoute[] = [];\n // Fallback routes render the fallback locale's page at another locale's\n // URL: listing them would pass that page off as a translation, once per\n // locale. `get_page` still resolves them through `pages`, as llms.txt and\n // search leave them out.\n for (const route of manifest.routes) {\n if (route.hidden || route.fallback) {\n continue;\n }\n const page = pageById.get(route.id);\n const facets = page ? pageFacets(page, config) : undefined;\n const entry: McpRoute = {\n contentType: route.contentType,\n description: page?.description,\n indexable: route.indexable,\n lastModified: route.lastModified ?? null,\n locale: route.locale,\n route: route.path,\n title: route.title,\n version: route.version,\n };\n if (facets) {\n entry.facets = facets;\n }\n routes.push(entry);\n }\n\n const data: McpData = {\n base: normalizeBasePath(config.deployment.options.base),\n defaultLocale: config.i18n?.defaultLocale,\n documents: documents.map((doc) => {\n const document: OramaDoc = {\n content: doc.content,\n contentType: doc.contentType,\n description: doc.description,\n locale: doc.locale,\n route: doc.route,\n title: doc.title,\n version: doc.version,\n };\n if (doc.facets) {\n document.facets = doc.facets;\n }\n if (doc.boost !== undefined) {\n document.boost = doc.boost;\n }\n if (doc.keywords) {\n document.keywords = doc.keywords;\n }\n return document;\n }),\n instructions: config.agents.mcp.instructions,\n name: config.agents.mcp.name ?? config.title,\n navigation: graph.navigation,\n pages,\n routes,\n site: config.deployment.options.site ?? null,\n version: manifest.blumeVersion,\n };\n if (config.versions) {\n data.archivedVersions = config.versions.archived.map(\n (version) => version.id\n );\n data.navigationByVersion = graph.navigationByVersion;\n }\n if (config.i18n) {\n data.navigationByLocale = graph.navigationByLocale;\n }\n return data;\n};\n"
|
|
9
|
+
],
|
|
10
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;;ACyBO,IAAM,2BAA2B;AA0BxC,IAAM,aAAa;AAMnB,IAAM,eAAe,CAAC,OAAe,SACnC,MAAM,SAAS,KACf,CAAC,YAAY,KAAK,KAClB,CAAC,MAAM,SAAS,GAAG,KACnB,CAAC,uBAAuB,IAAI,KAAK,KACjC,CAAC,iBAAiB,OAAO,IAAI;AAI/B,IAAM,kBAAkB;AAMjB,IAAM,iB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,QAAQ,IAAI;AAAA,MACvB;AAAA,MACA,IAAI,IAAI,UAAU;AAAA,QAChB,SAAS,WAAW,IAAI;AAAA,MAC1B;AAAA,MACA,OAAO;AAAA,KACR;AAAA,IACD,cAAc,OAAO,OAAO,IAAI;AAAA,IAChC,MAAM,OAAO,OAAO,IAAI,QAAQ,OAAO;AAAA,IACvC,YAAY,MAAM;AAAA,IAClB;AAAA,IACA;AAAA,IACA,MAAM,OAAO,WAAW,QAAQ,QAAQ;AAAA,IACxC,SAAS,SAAS;AAAA,EACpB;AAAA,EACA,IAAI,OAAO,UAAU;AAAA,IACnB,KAAK,mBAAmB,OAAO,SAAS,SAAS,IAC/C,CAAC,YAAY,QAAQ,EACvB;AAAA,IACA,KAAK,sBAAsB,MAAM;AAAA,EACnC;AAAA,EACA,IAAI,OAAO,MAAM;AAAA,IACf,KAAK,qBAAqB,MAAM;AAAA,EAClC;AAAA,EACA,OAAO;AAAA;",
|
|
11
|
+
"debugId": "0C8488DE9FAE851264756E2164756E21",
|
|
12
|
+
"names": []
|
|
13
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
needsPlaygroundProxy,
|
|
4
4
|
resolveAskBackend
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-hwjspffr.js";
|
|
6
6
|
|
|
7
7
|
// src/core/server-features.ts
|
|
8
8
|
var serverFeatures = (config) => {
|
|
@@ -101,4 +101,4 @@ var checkRequiredSecrets = (config) => {
|
|
|
101
101
|
export { serverFeatures, checkRequiredSecrets };
|
|
102
102
|
|
|
103
103
|
//# debugId=D62D6223654FF46464756E2164756E21
|
|
104
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-426rytg6.js.map
|
|
@@ -3,12 +3,12 @@ import"./chunk-zccbjcj0.js";
|
|
|
3
3
|
import {
|
|
4
4
|
referenceSpecFiles,
|
|
5
5
|
resolveRuntimeDir
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-hwjspffr.js";
|
|
7
7
|
import {
|
|
8
8
|
refreshBlumeContent,
|
|
9
9
|
showBlumeErrorOverlay,
|
|
10
10
|
generateRuntime
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-pxp1y6yz.js";
|
|
12
12
|
import {
|
|
13
13
|
commandMeta,
|
|
14
14
|
normalizeHost,
|
|
@@ -18,34 +18,34 @@ import {
|
|
|
18
18
|
} from "./index.js";
|
|
19
19
|
import {
|
|
20
20
|
scanProject
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import"./chunk-
|
|
23
|
-
import"./chunk-
|
|
24
|
-
import"./chunk-
|
|
21
|
+
} from "./chunk-gc7knd2s.js";
|
|
22
|
+
import"./chunk-2f6btenb.js";
|
|
23
|
+
import"./chunk-8h2t2vyj.js";
|
|
24
|
+
import"./chunk-znwhf37a.js";
|
|
25
25
|
import"./chunk-jq5n4avg.js";
|
|
26
|
-
import"./chunk-
|
|
27
|
-
import"./chunk-
|
|
28
|
-
import"./chunk-
|
|
26
|
+
import"./chunk-88q28zav.js";
|
|
27
|
+
import"./chunk-0xyedh7k.js";
|
|
28
|
+
import"./chunk-5f96yq2c.js";
|
|
29
29
|
import {
|
|
30
30
|
refuseIfEjected
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-1ay3hzn0.js";
|
|
32
32
|
import {
|
|
33
33
|
parsePort
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-c0qddrxr.js";
|
|
35
35
|
import {
|
|
36
36
|
astroBuildDiagnostics
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-zgca0vxs.js";
|
|
38
38
|
import {
|
|
39
39
|
DevLockHeldError,
|
|
40
40
|
acquireDevLock,
|
|
41
41
|
updateDevLockPort,
|
|
42
42
|
describeDevLock
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-r5ajrw1g.js";
|
|
44
44
|
import {
|
|
45
45
|
prepareProject
|
|
46
|
-
} from "./chunk-
|
|
47
|
-
import"./chunk-
|
|
48
|
-
import"./chunk-
|
|
46
|
+
} from "./chunk-9emfspcp.js";
|
|
47
|
+
import"./chunk-426rytg6.js";
|
|
48
|
+
import"./chunk-rc2qk3qx.js";
|
|
49
49
|
|
|
50
50
|
// src/cli/commands/dev.ts
|
|
51
51
|
import { dev } from "astro";
|
|
@@ -200,4 +200,4 @@ export {
|
|
|
200
200
|
};
|
|
201
201
|
|
|
202
202
|
//# debugId=69D928DFB8AB7AAA64756E2164756E21
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
203
|
+
//# sourceMappingURL=chunk-5xq12jz7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
loadConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-hwjspffr.js";
|
|
5
5
|
import"./chunk-zccbjcj0.js";
|
|
6
6
|
import {
|
|
7
7
|
commandMeta,
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
reportDiagnostics
|
|
12
12
|
} from "./index.js";
|
|
13
13
|
import"./chunk-jq5n4avg.js";
|
|
14
|
-
import"./chunk-
|
|
14
|
+
import"./chunk-gc7knd2s.js";
|
|
15
15
|
import {
|
|
16
16
|
CutError,
|
|
17
17
|
cutVersion
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-b7n58hgj.js";
|
|
19
19
|
|
|
20
20
|
// src/cli/commands/version.ts
|
|
21
21
|
import { defineCommand } from "citty";
|
|
@@ -88,4 +88,4 @@ export {
|
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
//# debugId=86F69482E9E3E55264756E2164756E21
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-6xag1c83.js.map
|
|
@@ -30,10 +30,10 @@ import {
|
|
|
30
30
|
SIGNATURES_DIRECTORY_PATH,
|
|
31
31
|
buildSignaturesDirectory,
|
|
32
32
|
deployPlatform
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-hwjspffr.js";
|
|
34
34
|
import {
|
|
35
35
|
SKILL_MD_PATH
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-rc2qk3qx.js";
|
|
37
37
|
|
|
38
38
|
// src/deploy/generated-files.ts
|
|
39
39
|
import { join } from "pathe";
|
|
@@ -202,12 +202,29 @@ var canonicalElsewhere = (canonical, served) => {
|
|
|
202
202
|
return normalizePath(path) !== normalizePath(served);
|
|
203
203
|
};
|
|
204
204
|
var URLS_PER_FILE = 50000;
|
|
205
|
-
var renderUrlset = (urls) => `<?xml version="1.0" encoding="UTF-8"?>
|
|
206
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
205
|
+
var renderUrlset = (urls, alternatesEnabled) => `<?xml version="1.0" encoding="UTF-8"?>
|
|
206
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${alternatesEnabled ? ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' : ""}>
|
|
207
207
|
${urls.join(`
|
|
208
208
|
`)}
|
|
209
209
|
</urlset>
|
|
210
210
|
`;
|
|
211
|
+
var indexablePages = (project) => {
|
|
212
|
+
const deployBase = normalizeBasePath(project.config.deployment.options.base);
|
|
213
|
+
const noindexVersions = new Set((project.config.versions?.archived ?? []).flatMap((version) => version.noindex ? [version.id] : []));
|
|
214
|
+
return project.graph.pages.filter((page) => !page.meta.draft && !isHiddenPage(page, project.graph) && !page.meta.seo.noindex && !noindexVersions.has(page.version) && !ERROR_ROUTES.has(page.route) && !canonicalElsewhere(page.meta.seo.canonical, mountBasePath(deployBase, page.route)));
|
|
215
|
+
};
|
|
216
|
+
var listedPages = (project) => {
|
|
217
|
+
const latestVersions = new Set((project.config.versions?.archived ?? []).flatMap((version) => version.canonical === "latest" ? [version.id] : []));
|
|
218
|
+
const currentKeys = new Set(project.graph.pages.flatMap((page) => page.version === "" ? [`${page.versionKey}\x00${page.locale}`] : []));
|
|
219
|
+
return indexablePages(project).filter((page) => !(latestVersions.has(page.version) && !page.meta.seo.canonical && currentKeys.has(`${page.versionKey}\x00${page.locale}`)));
|
|
220
|
+
};
|
|
221
|
+
var hreflangAlternates = (project) => {
|
|
222
|
+
const indexable = new Set(indexablePages(project).map((page) => page.route));
|
|
223
|
+
return new Map(project.manifest.routes.map((route) => [
|
|
224
|
+
route.path,
|
|
225
|
+
route.fallback || indexable.has(route.path) ? route.alternates.filter((alternate) => indexable.has(alternate.path)) : []
|
|
226
|
+
]));
|
|
227
|
+
};
|
|
211
228
|
var buildSitemapFiles = (project) => {
|
|
212
229
|
const { site } = project.config.deployment.options;
|
|
213
230
|
if (!(site && project.config.seo.sitemap)) {
|
|
@@ -215,32 +232,29 @@ var buildSitemapFiles = (project) => {
|
|
|
215
232
|
}
|
|
216
233
|
const base = siteRoot(site);
|
|
217
234
|
const deployBase = normalizeBasePath(project.config.deployment.options.base);
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
if (
|
|
223
|
-
return
|
|
235
|
+
const alternatesEnabled = project.config.seo.sitemap !== true && project.config.seo.sitemap.alternates;
|
|
236
|
+
const hreflang = alternatesEnabled ? hreflangAlternates(project) : null;
|
|
237
|
+
const alternateTags = (route) => {
|
|
238
|
+
const alternates = hreflang?.get(route) ?? [];
|
|
239
|
+
if (alternates.length < 2) {
|
|
240
|
+
return "";
|
|
224
241
|
}
|
|
225
|
-
const
|
|
226
|
-
|
|
242
|
+
const defaultPage = alternates.find((entry) => entry.locale === project.config.i18n?.defaultLocale);
|
|
243
|
+
const links = defaultPage ? [...alternates, { ...defaultPage, locale: "x-default" }] : alternates;
|
|
244
|
+
return links.map((entry) => `<xhtml:link rel="alternate" hreflang="${escapeXml(entry.locale)}" href="${escapeXml(encodeURI(`${base}${mountBasePath(deployBase, entry.path)}`))}"/>`).join("");
|
|
227
245
|
};
|
|
228
246
|
const seen = new Set;
|
|
229
247
|
const urls = [];
|
|
230
|
-
const pushUrl = (route, lastModified) => {
|
|
248
|
+
const pushUrl = (route, lastModified, alternates = "") => {
|
|
231
249
|
const loc = escapeXml(encodeURI(`${base}${route}`));
|
|
232
250
|
if (seen.has(loc)) {
|
|
233
251
|
return;
|
|
234
252
|
}
|
|
235
253
|
seen.add(loc);
|
|
236
|
-
urls.push(` <url><loc>${loc}</loc>${lastmodTag(lastModified)}</url>`);
|
|
254
|
+
urls.push(` <url><loc>${loc}</loc>${lastmodTag(lastModified)}${alternates}</url>`);
|
|
237
255
|
};
|
|
238
|
-
for (const page of project
|
|
239
|
-
|
|
240
|
-
if (page.meta.draft || isHiddenPage(page, project.graph) || page.meta.seo.noindex || ERROR_ROUTES.has(page.route) || archivedExcluded(page) || canonicalElsewhere(page.meta.seo.canonical, served)) {
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
pushUrl(served, page.lastModified);
|
|
256
|
+
for (const page of listedPages(project)) {
|
|
257
|
+
pushUrl(mountBasePath(deployBase, page.route), page.lastModified, alternateTags(page.route));
|
|
244
258
|
}
|
|
245
259
|
const userPages = project.context.pagesRoot ? discoverPagesSync(project.context.pagesRoot) : [];
|
|
246
260
|
const extraRoutes = customStaticRoutes(userPages).filter((route) => !ERROR_ROUTES.has(route));
|
|
@@ -252,7 +266,9 @@ var buildSitemapFiles = (project) => {
|
|
|
252
266
|
}
|
|
253
267
|
urls.sort();
|
|
254
268
|
if (urls.length <= URLS_PER_FILE) {
|
|
255
|
-
return [
|
|
269
|
+
return [
|
|
270
|
+
{ name: "sitemap.xml", xml: renderUrlset(urls, alternatesEnabled) }
|
|
271
|
+
];
|
|
256
272
|
}
|
|
257
273
|
const chunks = [];
|
|
258
274
|
const references = [];
|
|
@@ -260,7 +276,7 @@ var buildSitemapFiles = (project) => {
|
|
|
260
276
|
const name = `sitemap-${chunks.length + 1}.xml`;
|
|
261
277
|
chunks.push({
|
|
262
278
|
name,
|
|
263
|
-
xml: renderUrlset(urls.slice(start, start + URLS_PER_FILE))
|
|
279
|
+
xml: renderUrlset(urls.slice(start, start + URLS_PER_FILE), alternatesEnabled)
|
|
264
280
|
});
|
|
265
281
|
const loc = escapeXml(encodeURI(`${base}${mountBasePath(deployBase, `/${name}`)}`));
|
|
266
282
|
references.push(` <sitemap><loc>${loc}</loc></sitemap>`);
|
|
@@ -323,7 +339,7 @@ var generatedFilePaths = (project) => {
|
|
|
323
339
|
};
|
|
324
340
|
var servedFiles = (project) => staticFileResolver(join(project.context.root, "public"), generatedFilePaths(project));
|
|
325
341
|
|
|
326
|
-
export { generatedFilePaths, servedFiles };
|
|
342
|
+
export { hreflangAlternates, generatedFilePaths, servedFiles };
|
|
327
343
|
|
|
328
|
-
//# debugId=
|
|
329
|
-
//# sourceMappingURL=chunk-
|
|
344
|
+
//# debugId=3DB9B0C9F36E00AB64756E2164756E21
|
|
345
|
+
//# sourceMappingURL=chunk-88q28zav.js.map
|