@vite-hub/docs 0.0.0 → 0.3.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 (111) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +454 -0
  3. package/dist/agent-copy-BJp_Yf5d.js +33 -0
  4. package/dist/assistant-shared-CdtXowot.js +97 -0
  5. package/dist/assistant-shared-Dll_F_yy.d.ts +27 -0
  6. package/dist/assistant-worker.d.ts +11 -0
  7. package/dist/assistant-worker.js +16 -0
  8. package/dist/assistant.d.ts +14 -0
  9. package/dist/assistant.js +19 -0
  10. package/dist/content-9CINWiRf.js +171 -0
  11. package/dist/draft-DUBx--r9.js +45 -0
  12. package/dist/error-diagnostics-BoOsP6Y4.js +53 -0
  13. package/dist/index.d.ts +28 -0
  14. package/dist/index.js +27 -0
  15. package/dist/link-checker-redirects.d.ts +13 -0
  16. package/dist/link-checker-redirects.js +25 -0
  17. package/dist/manifest-D66AEF8F.js +420 -0
  18. package/dist/manifest-Dzp5-_AJ.d.ts +74 -0
  19. package/dist/markdown-Cn9-4oVG.js +378 -0
  20. package/dist/navigation.d.ts +284 -0
  21. package/dist/navigation.js +520 -0
  22. package/dist/nuxt-B5LrERKc.d.ts +240 -0
  23. package/dist/nuxt.d.ts +3 -0
  24. package/dist/nuxt.js +1485 -0
  25. package/dist/page-BbmSfZO8.js +81 -0
  26. package/dist/page-Dx2JD3y1.d.ts +74 -0
  27. package/dist/primitive-rail.d.ts +110 -0
  28. package/dist/primitive-rail.js +284 -0
  29. package/dist/raw-C03EUJKw.js +851 -0
  30. package/dist/redirects-BrbWFSzW.js +62 -0
  31. package/dist/runtime/app/app.vue +11 -0
  32. package/dist/runtime/app/assistant/DocsAssistant.vue +81 -0
  33. package/dist/runtime/app/assistant/DocsAssistantOff.vue +8 -0
  34. package/dist/runtime/app/assistant/DocsAssistantPanel.vue +322 -0
  35. package/dist/runtime/app/components/AppHeader.vue +368 -0
  36. package/dist/runtime/app/components/AppSearch.vue +68 -0
  37. package/dist/runtime/app/components/DocsAppShell.vue +62 -0
  38. package/dist/runtime/app/components/DocsArticle.vue +184 -0
  39. package/dist/runtime/app/components/DocsAsideFooter.vue +94 -0
  40. package/dist/runtime/app/components/DocsAsideLeftBody.vue +584 -0
  41. package/dist/runtime/app/components/DocsAsideLeftTop.vue +132 -0
  42. package/dist/runtime/app/components/DocsBrandMark.vue +52 -0
  43. package/dist/runtime/app/components/DocsCatalogFooter.vue +129 -0
  44. package/dist/runtime/app/components/DocsCodePanel.vue +388 -0
  45. package/dist/runtime/app/components/DocsCodePre.vue +120 -0
  46. package/dist/runtime/app/components/DocsHeaderActions.vue +4 -0
  47. package/dist/runtime/app/components/DocsLanding.vue +83 -0
  48. package/dist/runtime/app/components/DocsMarkdown.vue +64 -0
  49. package/dist/runtime/app/components/DocsPage.vue +149 -0
  50. package/dist/runtime/app/components/DocsPageCredits.vue +41 -0
  51. package/dist/runtime/app/components/DocsPageHeaderLinks.vue +120 -0
  52. package/dist/runtime/app/components/DocsRail.vue +239 -0
  53. package/dist/runtime/app/components/DocsSidebarStrip.vue +81 -0
  54. package/dist/runtime/app/components/DocsSidebars.vue +63 -0
  55. package/dist/runtime/app/components/OgImage/DocsPage.takumi.vue +33 -0
  56. package/dist/runtime/app/components/content/AgentOnly.vue +9 -0
  57. package/dist/runtime/app/components/content/CodeTree.vue +203 -0
  58. package/dist/runtime/app/components/content/ComarkHtml.vue +31 -0
  59. package/dist/runtime/app/components/content/Correct.vue +17 -0
  60. package/dist/runtime/app/components/content/Example.vue +260 -0
  61. package/dist/runtime/app/components/content/ExamplePreview.vue +6 -0
  62. package/dist/runtime/app/components/content/Examples.vue +71 -0
  63. package/dist/runtime/app/components/content/Incorrect.vue +17 -0
  64. package/dist/runtime/app/components/content/PageList.vue +206 -0
  65. package/dist/runtime/app/components/content/ProductFeatureItem.vue +43 -0
  66. package/dist/runtime/app/components/content/ProductFeatures.vue +17 -0
  67. package/dist/runtime/app/components/content/TutorialStep.vue +39 -0
  68. package/dist/runtime/app/composables/docs-assistant-problem.ts +59 -0
  69. package/dist/runtime/app/composables/docs-theme.ts +15 -0
  70. package/dist/runtime/app/composables/docs.ts +83 -0
  71. package/dist/runtime/app/composables/headerActions.ts +6 -0
  72. package/dist/runtime/app/composables/icons.ts +14 -0
  73. package/dist/runtime/app/composables/seo.ts +64 -0
  74. package/dist/runtime/app/composables/tutorial.ts +40 -0
  75. package/dist/runtime/app/composables/useDocsAssistant.ts +17 -0
  76. package/dist/runtime/app/error.vue +88 -0
  77. package/dist/runtime/app/layouts/default.vue +7 -0
  78. package/dist/runtime/app/layouts/docs.vue +104 -0
  79. package/dist/runtime/app/middleware/docs-layout.ts +23 -0
  80. package/dist/runtime/app/pages/docs-page.vue +3 -0
  81. package/dist/runtime/app/plugins/comark-css.ts +14 -0
  82. package/dist/runtime/app/plugins/icon-stroke.ts +12 -0
  83. package/dist/runtime/app/plugins/theme-color.ts +18 -0
  84. package/dist/runtime/app/utils/docs-theme.ts +43 -0
  85. package/dist/runtime/app/utils/file-tree.ts +40 -0
  86. package/dist/runtime/server/llms.d.ts +6 -0
  87. package/dist/runtime/server/llms.js +7 -0
  88. package/dist/runtime/server/markdown.d.ts +10 -0
  89. package/dist/runtime/server/markdown.js +11 -0
  90. package/dist/runtime/server/mcp.d.ts +6 -0
  91. package/dist/runtime/server/mcp.js +7 -0
  92. package/dist/runtime/server/page.d.ts +7 -0
  93. package/dist/runtime/server/page.js +27 -0
  94. package/dist/runtime/server/raw.d.ts +10 -0
  95. package/dist/runtime/server/raw.js +23 -0
  96. package/dist/runtime/server/search.d.ts +6 -0
  97. package/dist/runtime/server/search.js +32 -0
  98. package/dist/runtime/server/sitemap.d.ts +6 -0
  99. package/dist/runtime/server/sitemap.js +52 -0
  100. package/dist/runtime/server/trailing-slash.d.ts +10 -0
  101. package/dist/runtime/server/trailing-slash.js +28 -0
  102. package/dist/runtime/theme/design.css +464 -0
  103. package/dist/schema-DwpXW0VZ.js +98 -0
  104. package/dist/server.d.ts +15 -0
  105. package/dist/server.js +5 -0
  106. package/dist/theme-BXyu4uFL.d.ts +32 -0
  107. package/dist/theme-DzC8LtMH.js +237 -0
  108. package/dist/theme.d.ts +2 -0
  109. package/dist/theme.js +2 -0
  110. package/dist/types-BhG6vGfG.d.ts +212 -0
  111. package/package.json +144 -1
@@ -0,0 +1,16 @@
1
+ import { a as docsPageFromBody, i as docsPageContextKey, n as docsAssistantModel, o as docsRateLimit, r as docsInstructions, t as defineDocsAssistant } from "./assistant-shared-CdtXowot.js";
2
+ import { workspaceShell } from "@vite-hub/agent/capabilities";
3
+ import { chatgpt } from "@vite-hub/gateways";
4
+ //#region src/assistant-worker.ts
5
+ /**
6
+ * The docs assistant in a Worker build: the `docsAssistant` of Node.js with a model-backed Driver on the same ChatGPT
7
+ * plan, because a Worker cannot start Codex. The model reads the pages with the read-only Workspace shell, which
8
+ * Codex does not need: it has its own.
9
+ */
10
+ const docsAssistant = defineDocsAssistant({
11
+ model: docsAssistantModel,
12
+ gateway: chatgpt(),
13
+ instructions: docsInstructions
14
+ }, [workspaceShell()]);
15
+ //#endregion
16
+ export { docsAssistant, docsPageContextKey, docsPageFromBody, docsRateLimit };
@@ -0,0 +1,14 @@
1
+ import { i as docsRateLimit, n as docsPageContextKey, r as docsPageFromBody, t as DocsRateLimitOptions } from "./assistant-shared-Dll_F_yy.js";
2
+ import { WorkspaceAgentDefinition } from "@vite-hub/agent";
3
+ //#region src/assistant.d.ts
4
+ /**
5
+ * The docs assistant: a ViteHub Agent that answers from the site's Markdown pages, on the site owner's ChatGPT plan
6
+ * through the `chatgpt` Connection, so no API key is needed.
7
+ *
8
+ * On Node.js it runs Codex, which reads the pages with shell commands. A Worker build gets the same Agent with a
9
+ * model-backed Driver on the same plan, because a Worker cannot start Codex. Extend it with
10
+ * `defineAgent({ extends: docsAssistant, ... })` to change any part.
11
+ */
12
+ export declare const docsAssistant: WorkspaceAgentDefinition;
13
+ //#endregion
14
+ export { type DocsRateLimitOptions, docsPageContextKey, docsPageFromBody, docsRateLimit };
@@ -0,0 +1,19 @@
1
+ import { a as docsPageFromBody, i as docsPageContextKey, o as docsRateLimit, r as docsInstructions, t as defineDocsAssistant } from "./assistant-shared-CdtXowot.js";
2
+ import { chatgpt } from "@vite-hub/gateways";
3
+ import { codexDriver } from "@vite-hub/agent";
4
+ //#region src/assistant.ts
5
+ /**
6
+ * The docs assistant: a ViteHub Agent that answers from the site's Markdown pages, on the site owner's ChatGPT plan
7
+ * through the `chatgpt` Connection, so no API key is needed.
8
+ *
9
+ * On Node.js it runs Codex, which reads the pages with shell commands. A Worker build gets the same Agent with a
10
+ * model-backed Driver on the same plan, because a Worker cannot start Codex. Extend it with
11
+ * `defineAgent({ extends: docsAssistant, ... })` to change any part.
12
+ */
13
+ const docsAssistant = defineDocsAssistant(codexDriver({
14
+ gateway: chatgpt(),
15
+ permissions: "allow-edits-unattended",
16
+ instructions: docsInstructions
17
+ }));
18
+ //#endregion
19
+ export { docsAssistant, docsPageContextKey, docsPageFromBody, docsRateLimit };
@@ -0,0 +1,171 @@
1
+ import { docsManifestPages, docsRawPath, findDocsPage } from "./navigation.js";
2
+ import { n as docsAgentPages, r as docsContentSource, t as docsAgentCopy } from "./agent-copy-BJp_Yf5d.js";
3
+ import { i as docsMarkdown, n as docsDocumentOf, r as docsImageSizes, t as createDocsParser } from "./markdown-Cn9-4oVG.js";
4
+ import "node:module";
5
+ import { defu } from "defu";
6
+ import { contentSource, defineContent } from "@vite-hub/content";
7
+ import agent from "#docs/agent";
8
+ import manifest from "#docs/manifest";
9
+ import { useRuntimeConfig } from "nitro/runtime-config";
10
+ import examples from "#docs/example-sources";
11
+ import imageSizes from "#docs/image-sizes";
12
+ import parser, { githubRepo } from "#docs/parser";
13
+ import files from "#docs/files";
14
+ //#region \0rolldown/runtime.js
15
+ var __defProp = Object.defineProperty;
16
+ var __exportAll = (all, no_symbols) => {
17
+ let target = {};
18
+ for (var name in all) __defProp(target, name, {
19
+ get: all[name],
20
+ enumerable: true
21
+ });
22
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
23
+ return target;
24
+ };
25
+ //#endregion
26
+ //#region src/runtime/documents.ts
27
+ const references = githubRepo ? { github: { references: { repo: githubRepo } } } : {};
28
+ /**
29
+ * The one parser configuration of the site. The runtime Content of the page route and search, drafts, and credits parse
30
+ * with it. The images of the app's `public/` folder get their size after the site's own plugins.
31
+ */
32
+ const docsParserOptions = {
33
+ exampleSources: examples,
34
+ ...parser,
35
+ comarkUi: defu(parser.comarkUi, references),
36
+ plugins: [...parser.plugins ?? [], docsImageSizes(imageSizes)]
37
+ };
38
+ const parseDocsDocument = createDocsParser(docsParserOptions);
39
+ //#endregion
40
+ //#region src/runtime/files.ts
41
+ const decoder = new TextDecoder();
42
+ let unpacked;
43
+ async function unpack(base64) {
44
+ const zlib = globalThis.process?.getBuiltinModule?.("node:zlib");
45
+ const buffer = globalThis.process?.getBuiltinModule?.("node:buffer");
46
+ if (zlib && buffer) {
47
+ const bytes = zlib.gunzipSync(buffer.Buffer.from(base64, "base64"));
48
+ return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
49
+ }
50
+ const binary = atob(base64);
51
+ const gzip = new Uint8Array(binary.length);
52
+ for (let index = 0; index < binary.length; index++) gzip[index] = binary.charCodeAt(index);
53
+ return new Uint8Array(await new Response(new Response(gzip).body.pipeThrough(new DecompressionStream("gzip"))).arrayBuffer());
54
+ }
55
+ /**
56
+ * A Markdown file of a docs store: a content folder (`docs`, `docs-1`, ...) or the raw copies (`docs-raw`), or null.
57
+ * A production build packs every file into one module. Nitro server assets would add one module per file, and
58
+ * Cloudflare rejects a Worker upload with more than 5,000 modules. Development loads each file through Vite.
59
+ * Nitro gives no build warning for that limit (https://github.com/nitrojs/nitro/issues/5149).
60
+ */
61
+ async function readDocsFile(store, file) {
62
+ if ("read" in files) return await files.read(store, file);
63
+ const ranges = Object.hasOwn(files.index, store) ? files.index[store] : void 0;
64
+ const range = ranges && Object.hasOwn(ranges, file) ? ranges[file] : void 0;
65
+ if (!range) return null;
66
+ const bytes = await (unpacked ??= unpack(files.packed));
67
+ return decoder.decode(bytes.subarray(range[0], range[1]));
68
+ }
69
+ //#endregion
70
+ //#region src/runtime/content.ts
71
+ var content_exports = /* @__PURE__ */ __exportAll({
72
+ docsContent: () => docsContent,
73
+ readDocsPage: () => readDocsPage,
74
+ readDocsRawCopy: () => readDocsRawCopy
75
+ });
76
+ /** One docs folder as a Content Source, from the production bundle or development server assets. */
77
+ function bundledPages(base) {
78
+ const read = (key) => readDocsFile(base, key);
79
+ return {
80
+ keys: async () => docsManifestPages(manifest).filter((page) => (page.source ?? "docs") === base).map((page) => page.file),
81
+ getItem: async (key) => await read(key) ?? "",
82
+ getItemRaw: read
83
+ };
84
+ }
85
+ let content;
86
+ /** The agent copy of a page from its file. The `rawMarkdown` option runs at build time, and the build keeps each page that it changed. */
87
+ async function docsPageCopy(page, text, siteUrl) {
88
+ const rewritten = await readDocsFile("docs-agent", `${docsContentSource(page)}/${page.file}`);
89
+ return docsAgentCopy(manifest, page, rewritten === null ? text : String(rewritten), siteUrl);
90
+ }
91
+ /**
92
+ * The agent copy at a raw path such as `/raw/docs/kv.md`, or null. Content finds a Source page by its URL only after it lists every file,
93
+ * which costs a cold Worker about 250 ms on a large site. The manifest knows the file of each URL, so this reads the
94
+ * one file and renders it with the copy that Content serves in `llms-full.txt` and the MCP server.
95
+ */
96
+ async function readDocsRawCopy(rawPath) {
97
+ const path = rawPath.replace(/^\/raw/, "").replace(/\.md$/, "");
98
+ const found = findDocsPage(manifest, path === "/index" ? "/" : path);
99
+ if (!found || docsRawPath(found.page.path) !== rawPath) return null;
100
+ const config = useRuntimeConfig().public.docs;
101
+ const text = await readDocsFile(found.page.source ?? "docs", found.page.file);
102
+ if (text === null) return null;
103
+ const copy = await docsPageCopy(found.page, String(text), `${config.site.url}${config.appBase.replace(/\/+$/, "")}`);
104
+ return `${copy.markdown}${copy.footer}`;
105
+ }
106
+ /**
107
+ * The docs pages as Content, parsed with the site's parser. The first read creates it. Each page has its URL from the
108
+ * manifest, so Content serves the agent files: the `/raw/<page>.md` copies, `llms.txt`, `llms-full.txt`, `sitemap.md`,
109
+ * the sitemap pages, and the MCP server.
110
+ */
111
+ function docsContent() {
112
+ const config = useRuntimeConfig().public.docs;
113
+ const siteUrl = `${config.site.url}${config.appBase.replace(/\/+$/, "")}`;
114
+ if (content?.siteUrl === siteUrl) return content.runtime;
115
+ const pages = docsAgentPages(manifest);
116
+ const assets = new Map(docsManifestPages(manifest).map((page) => [docsContentSource(page), page.source ?? "docs"]));
117
+ const sources = Object.fromEntries([...assets].map(([name, base]) => {
118
+ const byKey = pages.get(name) ?? /* @__PURE__ */ new Map();
119
+ return [name, contentSource(bundledPages(base), {
120
+ url: ({ key }) => key === void 0 ? null : byKey.get(key)?.path ?? null,
121
+ label: "Docs",
122
+ seo: ({ key }) => {
123
+ const page = key === void 0 ? void 0 : byKey.get(key);
124
+ return page && {
125
+ title: page.sourceTitle,
126
+ ...page.description ? { description: page.description } : {},
127
+ ...page.seo?.index === false ? { noindex: true } : {}
128
+ };
129
+ },
130
+ markdown: async ({ key, text }) => {
131
+ const page = byKey.get(key);
132
+ return page ? await docsPageCopy(page, text, siteUrl) : null;
133
+ }
134
+ })];
135
+ }));
136
+ const runtime = defineContent({
137
+ route: false,
138
+ live: false,
139
+ markdown: docsMarkdown(docsParserOptions),
140
+ sources,
141
+ seo: {
142
+ ...config.site.url ? { site: siteUrl } : {},
143
+ sitemap: true,
144
+ markdown: {
145
+ prefix: "/raw",
146
+ pages: config.markdownPages
147
+ },
148
+ llms: {
149
+ title: config.site.name,
150
+ ...config.site.description ? { description: config.site.description } : {},
151
+ ...agent.llms
152
+ },
153
+ mcp: config.mcp ? { name: config.mcp.name } : false
154
+ }
155
+ });
156
+ content = {
157
+ runtime,
158
+ siteUrl
159
+ };
160
+ return runtime;
161
+ }
162
+ /**
163
+ * The parsed body of a page through `content.get()`, or null when its file is gone. The page route and search both read
164
+ * here, so a page parses once per server. Development parses on each read.
165
+ */
166
+ async function readDocsPage(page) {
167
+ const document = await docsContent().get(`${docsContentSource(page)}/${page.file}`, { fresh: import.meta.dev });
168
+ return document ? docsDocumentOf(document) : null;
169
+ }
170
+ //#endregion
171
+ export { parseDocsDocument as a, readDocsRawCopy as i, docsContent as n, readDocsPage as r, content_exports as t };
@@ -0,0 +1,45 @@
1
+ import { docsSectionForPath, findDocsPage, normalizeDocsPath } from "./navigation.js";
2
+ import { i as docsPageSchema, t as docsFrontmatter } from "./schema-DwpXW0VZ.js";
3
+ import { i as docsPageResponse, n as docsPageOf } from "./page-BbmSfZO8.js";
4
+ //#region src/draft.ts
5
+ /**
6
+ * The draft of the page at `path`, parsed like a published page, or null when the request shows the published file.
7
+ * A preview frame shows the draft of its one document, also before the page is published. A preview cookie shows the
8
+ * draft that Content resolves for the URL.
9
+ */
10
+ async function docsDraftResponse(content, manifest, path, parse) {
11
+ const normalized = normalizeDocsPath(path);
12
+ const draft = await readDraft(content, normalized);
13
+ if (!draft) return null;
14
+ const published = findDocsPage(manifest, normalized);
15
+ const section = published?.section ?? (normalized === manifest.root?.path ? null : docsSectionForPath(manifest, normalized));
16
+ const result = docsPageSchema.safeParse(docsFrontmatter(draft.data));
17
+ const at = {
18
+ id: published?.page.id ?? pageId(manifest, normalized, section?.path),
19
+ path: normalized,
20
+ file: `${draft.id}.md`
21
+ };
22
+ const page = result.success ? docsPageOf(result.data, at) : published?.page;
23
+ if (!page) return null;
24
+ return docsPageResponse(manifest, {
25
+ page,
26
+ section
27
+ }, await parse(draft.body ?? ""), page.credits ? await parse(page.credits) : null);
28
+ }
29
+ async function readDraft(content, path) {
30
+ const frame = content.preview.frame();
31
+ if (frame) {
32
+ const document = await content.collection(frame.collection).get(frame.id);
33
+ return typeof document?.url === "string" && normalizeDocsPath(document.url) === path ? document : null;
34
+ }
35
+ const found = await content.resolve(path);
36
+ return found ? await content.collection(found.collection).get(found.id) : null;
37
+ }
38
+ /** The id that the manifest gives a page at `path`: its path inside its section, `index` for an overview or the root. */
39
+ function pageId(manifest, path, section) {
40
+ if (path === manifest.root?.path) return "index";
41
+ if (!section) return "";
42
+ return path === section ? "index" : path.slice(section.length + 1);
43
+ }
44
+ //#endregion
45
+ export { docsDraftResponse };
@@ -0,0 +1,53 @@
1
+ import { defineDiagnostics } from "nostics";
2
+ //#region src/error-diagnostics.ts
3
+ const docsErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
4
+ docsBase: "https://vitehub.dev/docs/docs-site/diagnostics",
5
+ codes: {
6
+ DOCS_ASSISTANT_AGENTS_MISSING: {
7
+ why: ({ agent }) => `[@vite-hub/docs] docs.assistant needs ViteHub Agents to answer from the "${agent}" Agent.`,
8
+ fix: "Add `vite-hub/nuxt` to modules and set `vitehub: { agent: true, connections: true }` in nuxt.config.ts, or set `docs: { assistant: false }`."
9
+ },
10
+ DOCS_COMMENTS_DATABASE_OFF: {
11
+ why: "[@vite-hub/docs] Docs sites on vite-hub/nuxt have Comments on, which keeps threads in the Database, but vitehub sets database: false.",
12
+ fix: "Remove `database: false` from the `vitehub` options in nuxt.config.ts, or set `docs: { comments: false }`."
13
+ },
14
+ DOCS_COMMENTS_PACKAGE_MISSING: {
15
+ why: "[@vite-hub/docs] Docs sites on vite-hub/nuxt have Comments on, which needs @vite-hub/comments.",
16
+ fix: "Run `pnpm add @vite-hub/comments`, or set `docs: { comments: false }` in nuxt.config.ts."
17
+ },
18
+ DOCS_COMMENTS_VITEHUB_MISSING: {
19
+ why: "[@vite-hub/docs] docs.comments needs vite-hub/nuxt, which keeps the threads in a ViteHub Database.",
20
+ fix: "Add `vite-hub/nuxt` to modules in nuxt.config.ts, or set `docs: { comments: false }`."
21
+ },
22
+ DOCS_CONTENT_INVALID: {
23
+ why: ({ details, file }) => `Invalid docs frontmatter in ${file}: ${details}`,
24
+ fix: "Fix the field that the message names in the page frontmatter or the `.navigation.yml` file. The schemas are `docsPageSchema` and `docsSectionSchema` from `@vite-hub/docs`."
25
+ },
26
+ DOCS_EXAMPLE_MISSING: {
27
+ why: ({ name }) => `::example names "${name}", but the examples folder has no ${name}.vue.`,
28
+ fix: "Add the component that the message names to the examples folder of the docs, or correct the `name` of the `::example` block."
29
+ },
30
+ DOCS_LINKS_BROKEN: {
31
+ why: ({ problems }) => `Broken docs links:\n${problems.map((problem) => `- ${problem}`).join("\n")}`,
32
+ fix: "Fix each link that the message lists in the page that it names, or add the target to `checkDocsLinks({ excludeLinks })` when it is served outside the docs output."
33
+ },
34
+ DOCS_OUTPUT_MISSING: {
35
+ why: ({ root }) => `Docs output does not exist: ${root}`,
36
+ fix: "Build the docs site first, or pass `checkDocsLinks({ dir })` the folder that the build writes."
37
+ },
38
+ DOCS_REDIRECTS_BROKEN: {
39
+ why: ({ problems }) => `Docs redirects break links:\n${problems.map((problem) => `- ${problem}`).join("\n")}`,
40
+ fix: "Point each redirect route rule that the message lists to a docs page, or remove the rule when the page that it hides still exists."
41
+ },
42
+ DOCS_SEO_FAILED: {
43
+ why: ({ problems }) => `Docs pages fail the search checks:\n${problems.map((problem) => `- ${problem}`).join("\n")}`,
44
+ fix: "Fix each page that the message lists, or set `docs: { seoAudit: \"warn\" }` to log the problems without stopping the build."
45
+ },
46
+ DOCS_SOURCE_MOUNT_INVALID: {
47
+ why: ({ mount }) => `Invalid docs source mount: ${mount}`,
48
+ fix: "Set the `mount` of the docs source to a URL path such as `/guide`, without `.`, `..`, `?`, `#`, or backslash segments."
49
+ }
50
+ }
51
+ });
52
+ //#endregion
53
+ export { docsErrorDiagnostics as t };
@@ -0,0 +1,28 @@
1
+ import { a as DocsSection, c as DocsPageFile, d as DocsSectionFile, f as docsLayouts, g as expandDottedKeys, h as docsSectionSchema, i as DocsSearchSection, l as DocsPageFrontmatter, m as docsPageSchema, n as DocsManifest, o as DocsTocLink, p as docsPageFields, r as DocsPage, s as DocsLayout, t as DocsAppPage, u as DocsPageNavigation } from "./types-BhG6vGfG.js";
2
+ import { i as DocsDocument, n as DocsPageResponse, t as DocsPageLink } from "./page-Dx2JD3y1.js";
3
+ import { a as DocsPublicConfig, n as DocsLogo, o as DocsSiteOptions, r as DocsModuleOptions, s as DocsStartOptions } from "./nuxt-B5LrERKc.js";
4
+ import { i as DocsSourceInput, r as DocsSource, t as DocsContentSource } from "./manifest-Dzp5-_AJ.js";
5
+ import { DocsCatalogGroup, DocsGroup, DocsIcons, DocsLink, DocsMarkdownLinks, DocsPanelLoaders, DocsRailEntry, DocsSidebarGroup, DocsSidebarSection, DocsSidebarSectionBlock, docsCatalog, docsManifestPages, docsMarkdownLinks, docsMcpInstallLinks, docsPageIcon, docsRailEntries, docsRailEntry, docsRailGroups, docsRailIcon, docsRawPath, docsRelatedSections, docsSectionForPath, docsSectionGroup, docsSectionIcon, docsSidebarCollapses, docsSidebarGroups, docsSidebarSections, docsTutorialNavigationCookie, findDocsPage, normalizeDocsBase, normalizeDocsPath } from "./navigation.js";
6
+ import { ContentLabel, DocumentsDefinition } from "@vite-hub/content";
7
+ //#region src/collection.d.ts
8
+ interface DocsCollectionOptions {
9
+ /**
10
+ * Glob of the Markdown pages in the Content Workspace, such as `content/**\/*.md`. The folder before the first
11
+ * wildcard must be the content folder of the docs module, so that page URLs match the site. Defaults to
12
+ * `content/**\/*.md`, the module's default `dir`.
13
+ */
14
+ path?: string;
15
+ /** Name of the collection in the Console. Defaults to `{ singular: "Page", plural: "Docs" }`. */
16
+ label?: string | ContentLabel;
17
+ }
18
+ /**
19
+ * A Content collection over the docs Markdown pages, so the Console edits, previews, and publishes them. Its fields are
20
+ * the page frontmatter, and each document's URL is the page URL: `content/docs/kv/index.md` is `/docs/kv`.
21
+ *
22
+ * @example
23
+ * // server/content.ts
24
+ * export default defineContent({ extends: cms, collections: { docs: docsCollection() } })
25
+ */
26
+ export declare function docsCollection(options?: DocsCollectionOptions): DocumentsDefinition<typeof docsPageFields>;
27
+ //#endregion
28
+ export { type DocsAppPage, type DocsCatalogGroup, type DocsCollectionOptions, type DocsContentSource, type DocsDocument, type DocsGroup, type DocsIcons, type DocsLayout, type DocsLink, type DocsLogo, type DocsManifest, type DocsMarkdownLinks, type DocsModuleOptions, type DocsPage, type DocsPageFile, type DocsPageFrontmatter, type DocsPageLink, type DocsPageNavigation, type DocsPageResponse, type DocsPanelLoaders, type DocsPublicConfig, type DocsRailEntry, type DocsSearchSection, type DocsSection, type DocsSectionFile, type DocsSidebarGroup, type DocsSidebarSection, type DocsSidebarSectionBlock, type DocsSiteOptions, type DocsSource, type DocsSourceInput, type DocsStartOptions, type DocsTocLink, docsCatalog, docsLayouts, docsManifestPages, docsMarkdownLinks, docsMcpInstallLinks, docsPageFields, docsPageIcon, docsPageSchema, docsRailEntries, docsRailEntry, docsRailGroups, docsRailIcon, docsRawPath, docsRelatedSections, docsSectionForPath, docsSectionGroup, docsSectionIcon, docsSectionSchema, docsSidebarCollapses, docsSidebarGroups, docsSidebarSections, docsTutorialNavigationCookie, expandDottedKeys, findDocsPage, normalizeDocsBase, normalizeDocsPath };
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ import { docsCatalog, docsManifestPages, docsMarkdownLinks, docsMcpInstallLinks, docsPageIcon, docsRailEntries, docsRailEntry, docsRailGroups, docsRailIcon, docsRawPath, docsRelatedSections, docsSectionForPath, docsSectionGroup, docsSectionIcon, docsSidebarCollapses, docsSidebarGroups, docsSidebarSections, docsTutorialNavigationCookie, findDocsPage, normalizeDocsBase, normalizeDocsPath } from "./navigation.js";
2
+ import { a as docsSectionSchema, i as docsPageSchema, n as docsLayouts, o as expandDottedKeys, r as docsPageFields } from "./schema-DwpXW0VZ.js";
3
+ import { r as docsPagePath } from "./page-BbmSfZO8.js";
4
+ import { documents } from "@vite-hub/content/collections";
5
+ //#region src/collection.ts
6
+ /**
7
+ * A Content collection over the docs Markdown pages, so the Console edits, previews, and publishes them. Its fields are
8
+ * the page frontmatter, and each document's URL is the page URL: `content/docs/kv/index.md` is `/docs/kv`.
9
+ *
10
+ * @example
11
+ * // server/content.ts
12
+ * export default defineContent({ extends: cms, collections: { docs: docsCollection() } })
13
+ */
14
+ function docsCollection(options = {}) {
15
+ return documents({
16
+ path: options.path ?? "content/**/*.md",
17
+ fields: docsPageFields,
18
+ label: options.label ?? {
19
+ singular: "Page",
20
+ plural: "Docs"
21
+ },
22
+ titleField: "title",
23
+ url: ({ id }) => docsPagePath(id)
24
+ });
25
+ }
26
+ //#endregion
27
+ export { docsCatalog, docsCollection, docsLayouts, docsManifestPages, docsMarkdownLinks, docsMcpInstallLinks, docsPageFields, docsPageIcon, docsPageSchema, docsRailEntries, docsRailEntry, docsRailGroups, docsRailIcon, docsRawPath, docsRelatedSections, docsSectionForPath, docsSectionGroup, docsSectionIcon, docsSectionSchema, docsSidebarCollapses, docsSidebarGroups, docsSidebarSections, docsTutorialNavigationCookie, expandDottedKeys, findDocsPage, normalizeDocsBase, normalizeDocsPath };
@@ -0,0 +1,13 @@
1
+ //#region src/link-checker-redirects.d.ts
2
+ /**
3
+ * The link checker reads its options once, when Nuxt installs it, and reports every link to a redirect. The docs module
4
+ * installs this module just before it, after the app's modules have added their route rules, so a link to a redirect
5
+ * route rule passes. The docs module checks where each redirect goes instead.
6
+ * Upstream: the late `excludeLinks` (https://github.com/harlan-zw/nuxt-link-checker/issues/143) and the unchecked
7
+ * redirect target (https://github.com/harlan-zw/nuxt-link-checker/pull/142).
8
+ */
9
+ declare const linkCheckerRedirects: {
10
+ (inlineOptions: Record<string, never>, nuxt: never): unknown;
11
+ };
12
+ //#endregion
13
+ export { linkCheckerRedirects as default };
@@ -0,0 +1,25 @@
1
+ import { docsAppPath } from "./navigation.js";
2
+ import { r as docsRedirects } from "./redirects-BrbWFSzW.js";
3
+ import { defineNuxtModule } from "@nuxt/kit";
4
+ //#region src/link-checker-redirects.ts
5
+ /**
6
+ * The link checker reads its options once, when Nuxt installs it, and reports every link to a redirect. The docs module
7
+ * installs this module just before it, after the app's modules have added their route rules, so a link to a redirect
8
+ * route rule passes. The docs module checks where each redirect goes instead.
9
+ * Upstream: the late `excludeLinks` (https://github.com/harlan-zw/nuxt-link-checker/issues/143) and the unchecked
10
+ * redirect target (https://github.com/harlan-zw/nuxt-link-checker/pull/142).
11
+ */
12
+ const linkCheckerRedirects = defineNuxtModule({
13
+ meta: { name: "@vite-hub/docs/link-checker-redirects" },
14
+ setup(_options, nuxt) {
15
+ const options = nuxt.options;
16
+ const linkChecker = options.linkChecker ??= {};
17
+ const redirects = docsRedirects({
18
+ ...options.nitro.routeRules,
19
+ ...options.routeRules
20
+ }).filter((redirect) => redirect.to.startsWith("/") && !redirect.to.startsWith("//"));
21
+ linkChecker.excludeLinks = [...linkChecker.excludeLinks ?? [], ...redirects.map((redirect) => docsAppPath(redirect.from, options.app.baseURL))];
22
+ }
23
+ });
24
+ //#endregion
25
+ export { linkCheckerRedirects as default };