create-zudo-doc 0.2.20 → 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.
- package/dist/features/image-enlarge.d.ts +10 -2
- package/dist/features/image-enlarge.js +10 -2
- package/dist/scaffold.js +22 -22
- package/dist/zfb-config-gen.d.ts +16 -10
- package/dist/zfb-config-gen.js +34 -239
- package/package.json +1 -1
- package/templates/base/pages/lib/_body-end-islands.tsx +6 -13
- package/templates/base/pages/lib/_category-nav.tsx +30 -115
- package/templates/base/pages/lib/_category-tree-nav.tsx +38 -65
- package/templates/base/pages/lib/_compose-meta-title.ts +2 -6
- package/templates/base/pages/lib/_doc-body-end.tsx +3 -35
- package/templates/base/pages/lib/_doc-content-header.tsx +10 -111
- package/templates/base/pages/lib/_doc-history-area.tsx +19 -211
- package/templates/base/pages/lib/_doc-metainfo-area.tsx +10 -113
- package/templates/base/pages/lib/_doc-page-renderer.tsx +22 -183
- package/templates/base/pages/lib/_doc-page-shell.tsx +17 -251
- package/templates/base/pages/lib/_doc-pager.tsx +4 -74
- package/templates/base/pages/lib/_doc-route-entries.ts +43 -177
- package/templates/base/pages/lib/_doc-route-paths.ts +16 -101
- package/templates/base/pages/lib/_doc-tags-area.tsx +14 -77
- package/templates/base/pages/lib/_footer-with-defaults.tsx +37 -225
- package/templates/base/pages/lib/_frontmatter-preview-data.ts +5 -31
- package/templates/base/pages/lib/_head-with-defaults.tsx +13 -138
- package/templates/base/pages/lib/_header-with-defaults.tsx +24 -324
- package/templates/base/pages/lib/_inline-version-switcher.tsx +16 -78
- package/templates/base/pages/lib/_nav-data-prep.ts +32 -51
- package/templates/base/pages/lib/_nav-source-cache.ts +12 -57
- package/templates/base/pages/lib/_nav-source-docs.ts +33 -233
- package/templates/base/pages/lib/_search-widget-script.ts +2 -470
- package/templates/base/pages/lib/_search-widget.tsx +9 -195
- package/templates/base/pages/lib/_sidebar-prepaint.tsx +6 -47
- package/templates/base/pages/lib/_sidebar-with-defaults.tsx +16 -118
- package/templates/base/pages/lib/_site-tree-nav.tsx +29 -80
- package/templates/base/pages/lib/doc-page-props.ts +26 -44
- package/templates/base/pages/lib/locale-merge.ts +32 -145
- package/templates/base/pages/lib/route-enumerators.ts +52 -286
- package/templates/base/pages/robots.txt.tsx +2 -26
- package/templates/base/src/components/ai-chat-modal.tsx +9 -8
- package/templates/base/src/components/doc-history.tsx +9 -8
- package/templates/base/src/components/image-enlarge.tsx +11 -8
- package/templates/base/src/components/sidebar-toggle.tsx +6 -170
- package/templates/base/src/components/sidebar-tree.tsx +6 -548
- package/templates/base/src/components/site-tree-nav.tsx +6 -220
- package/templates/base/src/config/color-scheme-utils.ts +34 -158
- package/templates/base/src/config/i18n.ts +9 -0
- package/templates/base/src/config/z-index-tokens.ts +5 -4
- package/templates/base/src/styles/global.css +5 -579
- package/templates/base/src/utils/base.ts +1 -1
- package/templates/base/src/utils/docs.ts +47 -16
- package/templates/base/src/utils/github.ts +12 -9
- package/templates/base/src/utils/nav-scope.ts +13 -42
- package/templates/base/src/utils/sidebar.ts +18 -86
- package/templates/base/src/utils/slug.ts +10 -53
- package/templates/base/src/utils/smart-break.tsx +12 -120
- package/templates/base/src/utils/tags.ts +25 -68
- package/templates/features/bodyFootUtil/files/src/utils/github.ts +12 -9
- package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +13 -39
- package/templates/features/docHistory/files/src/components/doc-history.tsx +8 -636
- package/templates/features/docHistory/files/src/types/doc-history.ts +7 -23
- package/templates/features/docTags/files/pages/lib/_tag-pages.tsx +35 -201
- package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +8 -269
- package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +6 -99
- package/templates/features/tagGovernance/files/scripts/tags-audit.ts +67 -515
- package/templates/features/tauri/files/src-tauri/capabilities/default.json +1 -4
- package/templates/features/tauri/files/src-tauri/tauri.conf.json +1 -1
- package/templates/features/tauriDev/files/src-tauri-dev/capabilities/default.json +1 -1
- package/templates/features/versioning/files/pages/lib/_versions-page.tsx +21 -73
- package/templates/base/plugins/connect-adapter.mjs +0 -169
- package/templates/base/plugins/search-index-plugin.mjs +0 -66
- package/templates/base/scripts/gen-z-index.mjs +0 -157
- package/templates/base/src/components/mermaid-enlarge.tsx +0 -490
- package/templates/features/claudeResources/files/plugins/claude-resources-plugin.mjs +0 -47
- package/templates/features/docHistory/files/plugins/doc-history-plugin.mjs +0 -111
- 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
|
-
}
|