@takazudo/zudo-doc 11.0.0 → 12.0.1

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 (42) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/agent-docs/search.js +6 -3
  3. package/dist/config.js +5 -0
  4. package/dist/content-admonition/index.d.ts +2 -1
  5. package/dist/content-admonition/index.js +2 -1
  6. package/dist/doc-page-renderer/index.d.ts +4 -0
  7. package/dist/doc-page-renderer/index.js +5 -0
  8. package/dist/doc-page-shell/index.d.ts +9 -0
  9. package/dist/doc-page-shell/index.js +2 -0
  10. package/dist/head-with-defaults/index.d.ts +9 -0
  11. package/dist/head-with-defaults/index.js +10 -0
  12. package/dist/home-page/index.js +8 -0
  13. package/dist/mcp/handler.js +1 -7
  14. package/dist/md-utils/index.d.ts +6 -1
  15. package/dist/md-utils/index.js +3 -2
  16. package/dist/mdx-components/index.js +4 -7
  17. package/dist/mdx-components/vocabulary.d.ts +19 -0
  18. package/dist/mdx-components/vocabulary.js +32 -0
  19. package/dist/plugins/internal/agent-export/components.d.ts +27 -0
  20. package/dist/plugins/internal/agent-export/components.js +125 -0
  21. package/dist/plugins/internal/agent-export/index.d.ts +4 -0
  22. package/dist/plugins/internal/agent-export/index.js +29 -8
  23. package/dist/plugins/internal/agent-export/normalize.d.ts +18 -1
  24. package/dist/plugins/internal/agent-export/normalize.js +91 -5
  25. package/dist/plugins/internal/llms-txt/dev-middleware.d.ts +2 -0
  26. package/dist/plugins/internal/llms-txt/dev-middleware.js +1 -0
  27. package/dist/plugins/internal/llms-txt/emit.js +3 -0
  28. package/dist/plugins/internal/llms-txt/load.js +2 -2
  29. package/dist/plugins/internal/llms-txt/types.d.ts +4 -0
  30. package/dist/plugins/internal/search-index/collect.js +5 -4
  31. package/dist/plugins/internal/search-index/types.d.ts +2 -0
  32. package/dist/preset.d.ts +2 -0
  33. package/dist/preset.js +5 -1
  34. package/dist/route-enumerators/index.d.ts +63 -2
  35. package/dist/route-enumerators/index.js +124 -21
  36. package/dist/routes/_context.d.ts +1 -1
  37. package/dist/routes/_context.js +6 -0
  38. package/dist/routes/sitemap.xml.js +19 -9
  39. package/eject/content-admonition/index.tsx +4 -9
  40. package/package.json +3 -3
  41. package/routes-src/_context.ts +3 -0
  42. package/routes-src/sitemap.xml.tsx +36 -12
@@ -15,14 +15,9 @@
15
15
  // stays presentation-agnostic.
16
16
  import type { Child } from "@takazudo/zfb/zudo-react";
17
17
 
18
- export type AdmonitionVariant =
19
- | "note"
20
- | "tip"
21
- | "info"
22
- | "warning"
23
- | "danger"
24
- | "caution"
25
- | "important";
18
+ import { admonitionComponentName, type AdmonitionVariant } from "../mdx-components/vocabulary.js";
19
+
20
+ export type { AdmonitionVariant };
26
21
 
27
22
  export interface AdmonitionProps {
28
23
  /** Custom title; falls back to the capitalized variant name (e.g. "Note"). */
@@ -36,7 +31,7 @@ export interface AdmonitionProps {
36
31
  * no `title` — matching the Astro reference where every callout shows a title.
37
32
  */
38
33
  export function makeAdmonition(variant: AdmonitionVariant) {
39
- const defaultTitle = variant.charAt(0).toUpperCase() + variant.slice(1);
34
+ const defaultTitle = admonitionComponentName(variant);
40
35
  return function Admonition({ title, children }: AdmonitionProps): Child {
41
36
  const heading = title && title.length > 0 ? title : defaultTitle;
42
37
  return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takazudo/zudo-doc",
3
- "version": "11.0.0",
3
+ "version": "12.0.1",
4
4
  "type": "module",
5
5
  "description": "zudo-doc framework primitives layer that sits on top of zfb's engine — sidebar, theme, TOC, breadcrumb, layouts, head injection, View Transitions, SSR-skip wrappers (per ADR-003).",
6
6
  "license": "MIT",
@@ -768,7 +768,7 @@
768
768
  "@takazudo/zfb": "^6.0.1",
769
769
  "@takazudo/zfb-md-wasm": "^6.0.1",
770
770
  "@takazudo/zfb-runtime": "^6.0.1",
771
- "@takazudo/zudo-doc-history-server": "^11.0.0",
771
+ "@takazudo/zudo-doc-history-server": "^12.0.0",
772
772
  "diff": "^8.0.0 || ^9.0.0",
773
773
  "katex": "^0.18.2 || ^0.19.0",
774
774
  "zod": "^4.3.6"
@@ -823,7 +823,7 @@
823
823
  "typescript": "^7.0.2",
824
824
  "vitest": "5.1.0",
825
825
  "zod": "^4.6.7",
826
- "@takazudo/zudo-doc-history-server": "11.0.0"
826
+ "@takazudo/zudo-doc-history-server": "12.0.1"
827
827
  },
828
828
  "scripts": {
829
829
  "gen:search-widget-script": "node scripts/gen-search-widget-script.mjs",
@@ -81,6 +81,9 @@ export const {
81
81
  enumerateTagsRoutes,
82
82
  enumerateVersionedRoutes,
83
83
  enumerateAllRoutes,
84
+ enumerateSitemapEntries,
85
+ getDocLocaleAlternates,
86
+ getHomeLocaleAlternates,
84
87
  buildNavTree,
85
88
  groupSatelliteNodes,
86
89
  findNode,
@@ -1,12 +1,17 @@
1
1
  // Package route entrypoint: /sitemap.xml — package-owned equivalent of
2
2
  // pages/sitemap.xml.tsx (epic Package-First Finale #2356, A1 #2361).
3
3
  //
4
- // URL enumeration is delegated to `enumerateAllRoutes` (reconstructed in
4
+ // URL enumeration is delegated to `enumerateSitemapEntries` (reconstructed in
5
5
  // `_context` from `@takazudo/zudo-doc/route-enumerators`) so the sitemap cannot
6
6
  // drift from the actual routes the page entrypoints build. Dormant unless
7
7
  // `settings.packageOwnedRoutes` is on (Decision 6 precedence still applies).
8
+ //
9
+ // `lastmod` comes from the same doc-history manifest the visible "Updated"
10
+ // label reads (`chromeBindings.docHistoryMeta`, #4784); a route with no known
11
+ // date omits `<lastmod>` rather than claiming the build date.
8
12
 
9
- import { settings, enumerateAllRoutes } from "./_context.js";
13
+ import { chromeBindings } from "virtual:zudo-doc-chrome-bindings";
14
+ import { settings, enumerateSitemapEntries } from "./_context.js";
10
15
 
11
16
  export const frontmatter = { title: "Sitemap" };
12
17
  export const contentType = "application/xml";
@@ -38,21 +43,40 @@ export default function Sitemap(): string {
38
43
  </urlset>`;
39
44
  }
40
45
 
41
- const routeMap = enumerateAllRoutes();
46
+ const entries = enumerateSitemapEntries({
47
+ docHistoryMeta: settings.docHistory ? chromeBindings.docHistoryMeta : undefined,
48
+ });
42
49
  const siteUrlBase = (settings.siteUrl ?? "").replace(/\/$/, "");
43
50
 
44
- const urlEntries = [...routeMap.entries()]
45
- .sort(([a], [b]) => a.localeCompare(b))
46
- .map(
47
- ([url, lastmod]) => ` <url>
48
- <loc>${escapeXml(siteUrlBase + url)}</loc>
49
- <lastmod>${lastmod}</lastmod>
50
- </url>`,
51
- )
51
+ // hreflang alternates need absolute URLs, so they require siteUrl. The
52
+ // xhtml namespace is declared only when some entry carries one, keeping
53
+ // single-locale output byte-identical (#4787).
54
+ const withAlternates = siteUrlBase !== "" && entries.some((e) => e.alternates);
55
+
56
+ const urlEntries = entries
57
+ .sort((a, b) => a.url.localeCompare(b.url))
58
+ .map(({ url, lastmod, alternates }) => {
59
+ const lastmodLine = lastmod ? `\n <lastmod>${lastmod}</lastmod>` : "";
60
+ const alternateLines = withAlternates && alternates
61
+ ? alternates
62
+ .map(
63
+ (a) =>
64
+ `\n <xhtml:link rel="alternate" hreflang="${escapeXml(a.hreflang)}" href="${escapeXml(siteUrlBase + a.url)}"/>`,
65
+ )
66
+ .join("")
67
+ : "";
68
+ return ` <url>
69
+ <loc>${escapeXml(siteUrlBase + url)}</loc>${lastmodLine}${alternateLines}
70
+ </url>`;
71
+ })
52
72
  .join("\n");
53
73
 
74
+ const urlsetOpen = withAlternates
75
+ ? '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">'
76
+ : '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
77
+
54
78
  return `<?xml version="1.0" encoding="UTF-8"?>
55
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
79
+ ${urlsetOpen}
56
80
  ${urlEntries}
57
81
  </urlset>
58
82
  `;