create-zudo-doc 0.2.21 → 0.2.22

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 (71) hide show
  1. package/dist/features/image-enlarge.d.ts +10 -2
  2. package/dist/features/image-enlarge.js +10 -2
  3. package/dist/scaffold.js +20 -22
  4. package/dist/zfb-config-gen.d.ts +16 -10
  5. package/dist/zfb-config-gen.js +34 -239
  6. package/package.json +1 -1
  7. package/templates/base/pages/lib/_body-end-islands.tsx +6 -13
  8. package/templates/base/pages/lib/_category-nav.tsx +30 -115
  9. package/templates/base/pages/lib/_category-tree-nav.tsx +38 -65
  10. package/templates/base/pages/lib/_compose-meta-title.ts +2 -6
  11. package/templates/base/pages/lib/_doc-body-end.tsx +3 -35
  12. package/templates/base/pages/lib/_doc-content-header.tsx +10 -111
  13. package/templates/base/pages/lib/_doc-history-area.tsx +19 -211
  14. package/templates/base/pages/lib/_doc-metainfo-area.tsx +10 -113
  15. package/templates/base/pages/lib/_doc-page-renderer.tsx +22 -183
  16. package/templates/base/pages/lib/_doc-page-shell.tsx +17 -251
  17. package/templates/base/pages/lib/_doc-pager.tsx +4 -74
  18. package/templates/base/pages/lib/_doc-route-entries.ts +43 -177
  19. package/templates/base/pages/lib/_doc-route-paths.ts +16 -101
  20. package/templates/base/pages/lib/_doc-tags-area.tsx +14 -77
  21. package/templates/base/pages/lib/_footer-with-defaults.tsx +37 -225
  22. package/templates/base/pages/lib/_frontmatter-preview-data.ts +5 -31
  23. package/templates/base/pages/lib/_head-with-defaults.tsx +13 -138
  24. package/templates/base/pages/lib/_header-with-defaults.tsx +24 -324
  25. package/templates/base/pages/lib/_inline-version-switcher.tsx +16 -78
  26. package/templates/base/pages/lib/_nav-data-prep.ts +32 -51
  27. package/templates/base/pages/lib/_nav-source-cache.ts +12 -57
  28. package/templates/base/pages/lib/_nav-source-docs.ts +33 -233
  29. package/templates/base/pages/lib/_search-widget-script.ts +2 -470
  30. package/templates/base/pages/lib/_search-widget.tsx +9 -195
  31. package/templates/base/pages/lib/_sidebar-prepaint.tsx +6 -59
  32. package/templates/base/pages/lib/_sidebar-with-defaults.tsx +16 -118
  33. package/templates/base/pages/lib/_site-tree-nav.tsx +29 -80
  34. package/templates/base/pages/lib/doc-page-props.ts +26 -44
  35. package/templates/base/pages/lib/locale-merge.ts +32 -145
  36. package/templates/base/pages/lib/route-enumerators.ts +52 -286
  37. package/templates/base/pages/robots.txt.tsx +2 -26
  38. package/templates/base/src/components/ai-chat-modal.tsx +9 -8
  39. package/templates/base/src/components/doc-history.tsx +9 -8
  40. package/templates/base/src/components/image-enlarge.tsx +11 -8
  41. package/templates/base/src/components/sidebar-toggle.tsx +6 -170
  42. package/templates/base/src/components/sidebar-tree.tsx +6 -548
  43. package/templates/base/src/components/site-tree-nav.tsx +6 -220
  44. package/templates/base/src/config/color-scheme-utils.ts +34 -158
  45. package/templates/base/src/config/i18n.ts +9 -0
  46. package/templates/base/src/config/z-index-tokens.ts +5 -4
  47. package/templates/base/src/styles/global.css +5 -579
  48. package/templates/base/src/utils/base.ts +1 -1
  49. package/templates/base/src/utils/docs.ts +47 -16
  50. package/templates/base/src/utils/github.ts +12 -9
  51. package/templates/base/src/utils/nav-scope.ts +13 -42
  52. package/templates/base/src/utils/sidebar.ts +18 -86
  53. package/templates/base/src/utils/slug.ts +10 -53
  54. package/templates/base/src/utils/smart-break.tsx +12 -120
  55. package/templates/base/src/utils/tags.ts +25 -68
  56. package/templates/features/bodyFootUtil/files/src/utils/github.ts +12 -9
  57. package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +13 -39
  58. package/templates/features/docHistory/files/src/components/doc-history.tsx +8 -636
  59. package/templates/features/docHistory/files/src/types/doc-history.ts +7 -23
  60. package/templates/features/docTags/files/pages/lib/_tag-pages.tsx +35 -201
  61. package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +8 -269
  62. package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +6 -99
  63. package/templates/features/tagGovernance/files/scripts/tags-audit.ts +67 -515
  64. package/templates/features/versioning/files/pages/lib/_versions-page.tsx +21 -73
  65. package/templates/base/plugins/connect-adapter.mjs +0 -169
  66. package/templates/base/plugins/search-index-plugin.mjs +0 -66
  67. package/templates/base/scripts/gen-z-index.mjs +0 -157
  68. package/templates/base/src/components/mermaid-enlarge.tsx +0 -490
  69. package/templates/features/claudeResources/files/plugins/claude-resources-plugin.mjs +0 -47
  70. package/templates/features/docHistory/files/plugins/doc-history-plugin.mjs +0 -111
  71. package/templates/features/llmsTxt/files/plugins/llms-txt-plugin.mjs +0 -93
@@ -1,93 +0,0 @@
1
- // @ts-check
2
- // zfb plugin module: llms-txt.
3
- //
4
- // Wires two lifecycle hooks for the llms-txt integration:
5
- //
6
- // postBuild — invokes `emitLlmsTxt` to write `dist/llms.txt`,
7
- // `dist/llms-full.txt`, and the per-locale variants.
8
- // `siteUrl` is normalised to `undefined` when falsy because
9
- // the runner switches between absolute and root-relative URLs
10
- // based on its presence (matches legacy Astro behaviour).
11
- //
12
- // devMiddleware — serves `/llms.txt`, `/llms-full.txt`, and the per-locale
13
- // `/<code>/llms.txt` / `/<code>/llms-full.txt` variants from
14
- // the on-the-fly `generateLlmsTxt` generator so dev output
15
- // stays in lockstep with the production `emitLlmsTxt`
16
- // byte-for-byte.
17
- //
18
- // `options` carries `{ siteName, siteDescription, base, siteUrl,
19
- // defaultLocaleDir, locales }` from the matching entry in `zfb.config.ts`.
20
- //
21
- // Inline functions are not supported by zfb's plugin runtime; see the
22
- // sibling `doc-history-plugin.mjs` for the rationale.
23
-
24
- /** @import { ZfbBuildHookContext, ZfbDevMiddlewareContext, ZfbPlugin } from "@takazudo/zfb/plugins" */
25
- /** @import { LlmsTxtEmitOptions, LlmsTxtDevMiddlewareOptions } from "@takazudo/zudo-doc/integrations/llms-txt" */
26
-
27
- import { emitLlmsTxt, createLlmsTxtDevMiddleware } from "@takazudo/zudo-doc/integrations/llms-txt";
28
- import { connectToZfbHandler } from "./connect-adapter.mjs";
29
-
30
- /** @type {ZfbPlugin} */
31
- export default {
32
- name: "llms-txt",
33
-
34
- /** @param {ZfbBuildHookContext} ctx */
35
- async postBuild(ctx) {
36
- await emitLlmsTxt(/** @type {LlmsTxtEmitOptions} */ (/** @type {unknown} */ ({
37
- ...ctx.options,
38
- outDir: ctx.outDir,
39
- // siteUrl is normalised to undefined when falsy because the runner
40
- // switches between absolute and root-relative URLs based on its
41
- // presence (matches legacy Astro behaviour).
42
- siteUrl: ctx.options["siteUrl"] || undefined,
43
- logger: ctx.logger,
44
- })));
45
- },
46
-
47
- /** @param {ZfbDevMiddlewareContext} ctx */
48
- devMiddleware(ctx) {
49
- const middleware = createLlmsTxtDevMiddleware(
50
- /** @type {LlmsTxtDevMiddlewareOptions} */ (/** @type {unknown} */ (ctx.options)),
51
- ctx.logger,
52
- );
53
- const handler = connectToZfbHandler(middleware);
54
-
55
- // zfb's `register(path, handler)` matches against the FULL request
56
- // URL (no base-stripping). For a non-root base (e.g. "/my-docs/"),
57
- // requests arrive as `/my-docs/llms.txt` (etc.), so we register
58
- // every route with the base prefix. For base="/", the prefix is
59
- // empty and routes are `/llms.txt` etc. as expected. The middleware
60
- // accepts base-prefixed URLs via the matcher (see `matchLlmsRoute`
61
- // in `dev-middleware.ts`).
62
- const basePrefix = stripTrailingSlash(
63
- typeof ctx.options["base"] === "string" ? ctx.options["base"] : "",
64
- );
65
- ctx.register(`${basePrefix}/llms.txt`, handler);
66
- ctx.register(`${basePrefix}/llms-full.txt`, handler);
67
- const locales = ctx.options["locales"];
68
- if (Array.isArray(locales)) {
69
- for (const locale of locales) {
70
- if (locale && typeof locale === "object" && typeof locale.code === "string") {
71
- ctx.register(`${basePrefix}/${locale.code}/llms.txt`, handler);
72
- ctx.register(`${basePrefix}/${locale.code}/llms-full.txt`, handler);
73
- } else {
74
- const repr = JSON.stringify(locale);
75
- if (ctx.logger?.warn) {
76
- ctx.logger.warn(`[llms-txt] skipping malformed locale entry (expected { code: string }): ${repr}`);
77
- } else {
78
- console.warn(`[llms-txt] skipping malformed locale entry (expected { code: string }): ${repr}`);
79
- }
80
- }
81
- }
82
- }
83
- },
84
- };
85
-
86
- /**
87
- * @param {string} s
88
- * @returns {string}
89
- */
90
- function stripTrailingSlash(s) {
91
- if (typeof s !== "string" || s.length === 0) return "";
92
- return s.endsWith("/") ? s.slice(0, -1) : s;
93
- }