@vite-hub/docs 0.4.1 → 0.5.0

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 (57) hide show
  1. package/README.md +164 -6
  2. package/dist/{assistant-pages-BN7hNsSZ.js → assistant-pages-CqNlHsx-.js} +1 -1
  3. package/dist/{assistant-shared-WzButktj.js → assistant-shared-DhiLHKSl.js} +2 -2
  4. package/dist/assistant-worker.js +1 -1
  5. package/dist/assistant.js +1 -1
  6. package/dist/{content-CPZGnn3S.js → content-BQVlMshL.js} +55 -15
  7. package/dist/{draft-BjWmaiLn.js → draft-CSsTYSeb.js} +2 -2
  8. package/dist/{error-diagnostics-B_ZOy7kF.js → error-diagnostics-CmgtG9xa.js} +64 -0
  9. package/dist/index.d.ts +7 -6
  10. package/dist/index.js +4 -4
  11. package/dist/link-checker-redirects.js +1 -1
  12. package/dist/{manifest-CMoxcwPm.d.ts → manifest-Drbdw1us.d.ts} +1 -1
  13. package/dist/{manifest-ZdxLrcvt.js → manifest-DvECmwX-.js} +62 -26
  14. package/dist/{markdown-DUWnEMPp.js → markdown-1M1FbjCw.js} +1 -1
  15. package/dist/{page-Dx2JD3y1.d.ts → markdown-BiKrT08O.d.ts} +2 -25
  16. package/dist/navigation.d.ts +9 -3
  17. package/dist/navigation.js +22 -8
  18. package/dist/{nuxt-CAGpKl_-.d.ts → nuxt-8O2OB_hI.d.ts} +80 -4
  19. package/dist/nuxt.d.ts +2 -2
  20. package/dist/nuxt.js +1269 -58
  21. package/dist/{page-GPt09oex.js → page-Bb0TfRKi.js} +19 -3
  22. package/dist/page-BryUCmYf.d.ts +26 -0
  23. package/dist/primitive-rail.d.ts +1 -4
  24. package/dist/primitive-rail.js +1 -4
  25. package/dist/{redirects-CmR1yu5A.js → redirects-BJj58IsY.js} +34 -21
  26. package/dist/runnable.d.ts +37 -0
  27. package/dist/runnable.js +105 -0
  28. package/dist/runtime/app/components/DocsAsideLeftBody.vue +2 -8
  29. package/dist/runtime/app/components/DocsLearn.vue +215 -0
  30. package/dist/runtime/app/components/DocsLearnCodePre.vue +98 -0
  31. package/dist/runtime/app/components/DocsLearnFile.vue +21 -0
  32. package/dist/runtime/app/components/DocsPage.vue +11 -5
  33. package/dist/runtime/app/components/DocsPlayground.vue +117 -0
  34. package/dist/runtime/app/components/content/Example.vue +18 -49
  35. package/dist/runtime/app/components/content/PageList.vue +1 -5
  36. package/dist/runtime/app/layouts/docs.vue +36 -8
  37. package/dist/runtime/app/middleware/docs-layout.ts +2 -2
  38. package/dist/runtime/app/utils/docs-learn.ts +31 -0
  39. package/dist/runtime/app/utils/docs-playground.ts +3 -0
  40. package/dist/runtime/server/llms.js +1 -1
  41. package/dist/runtime/server/markdown.d.ts +0 -5
  42. package/dist/runtime/server/markdown.js +10 -1
  43. package/dist/runtime/server/mcp.js +1 -1
  44. package/dist/runtime/server/page.d.ts +1 -1
  45. package/dist/runtime/server/page.js +3 -3
  46. package/dist/runtime/server/raw.js +2 -9
  47. package/dist/runtime/server/search.d.ts +1 -1
  48. package/dist/runtime/server/search.js +3 -2
  49. package/dist/runtime/server/sitemap.js +1 -1
  50. package/dist/{schema-DwpXW0VZ.js → schema-DcWZ3Q3M.js} +97 -5
  51. package/dist/server.d.ts +3 -2
  52. package/dist/server.js +3 -3
  53. package/dist/snapshot-worker.mjs +40 -0
  54. package/dist/steps-DBlkJwtD.d.ts +105 -0
  55. package/dist/steps-DF-11dJn.js +32 -0
  56. package/dist/{types-BhG6vGfG.d.ts → types-CHU_fy9l.d.ts} +69 -4
  57. package/package.json +17 -10
@@ -1,7 +1,7 @@
1
- import { docsManifestPages, docsPanelOf, docsPanelPages, normalizeDocsBase } from "./navigation.js";
2
- import { a as docsSectionSchema, i as docsPageSchema, t as docsFrontmatter } from "./schema-DwpXW0VZ.js";
3
- import { n as docsPageOf, r as docsPagePath } from "./page-GPt09oex.js";
4
- import { t as docsErrorDiagnostics } from "./error-diagnostics-B_ZOy7kF.js";
1
+ import { docsManifestPages, normalizeDocsBase } from "./navigation.js";
2
+ import { a as docsSectionSchema, i as docsPageSchema, t as docsFrontmatter } from "./schema-DcWZ3Q3M.js";
3
+ import { n as docsPageOf, r as docsPagePath } from "./page-Bb0TfRKi.js";
4
+ import { t as docsErrorDiagnostics } from "./error-diagnostics-CmgtG9xa.js";
5
5
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
6
6
  import { join, matchesGlob, posix, relative, resolve, sep } from "node:path";
7
7
  import { ELEMENT_NODE, parse as parse$1, walkSync } from "ultrahtml";
@@ -36,6 +36,10 @@ function docsLinkExclusion(patterns) {
36
36
  const excluded = matcher(patterns);
37
37
  return (url, href) => excluded(href) || excluded(url.pathname) || excluded(url.pathname + url.hash);
38
38
  }
39
+ /**
40
+ * The output file that answers `pathname`. A path with a trailing slash matches only `<path>/index.html`: hosts such
41
+ * as Cloudflare redirect `/guide/` to `/guide` when the output has `guide.html`.
42
+ */
39
43
  function docsOutputFile(dir, base = "/") {
40
44
  const root = resolve(dir);
41
45
  const appBase = `/${base.replace(/^\/+|\/+$/g, "")}`.replace(/\/$/, "");
@@ -47,12 +51,11 @@ function docsOutputFile(dir, base = "/") {
47
51
  } catch {
48
52
  return;
49
53
  }
50
- const page = path.replace(/\/$/, "");
51
- return [
54
+ return (path.endsWith("/") ? [`${path}index.html`] : [
52
55
  path,
53
- `${page}.html`,
54
- `${page}/index.html`
55
- ].map((candidate) => resolve(root, `.${candidate.startsWith("/") ? candidate : `/${candidate}`}`)).find((file) => file.startsWith(`${root}${sep}`) && existsSync(file) && statSync(file).isFile());
56
+ `${path}.html`,
57
+ `${path}/index.html`
58
+ ]).map((candidate) => resolve(root, `.${candidate.startsWith("/") ? candidate : `/${candidate}`}`)).find((file) => file.startsWith(`${root}${sep}`) && existsSync(file) && statSync(file).isFile());
56
59
  };
57
60
  }
58
61
  /** Check built HTML against the files and fragment ids in the same output, without fetching remote URLs. */
@@ -82,7 +85,15 @@ function checkDocsLinks(options) {
82
85
  cache.set(file, result);
83
86
  return result;
84
87
  };
85
- const fileOf = docsOutputFile(root, appBase);
88
+ const outputFile = docsOutputFile(root, appBase);
89
+ const targets = /* @__PURE__ */ new Map();
90
+ function fileOf(path) {
91
+ const known = targets.get(path);
92
+ if (known !== void 0) return known;
93
+ const target = outputFile(path) ?? null;
94
+ targets.set(path, target);
95
+ return target;
96
+ }
86
97
  const files = readdirSync(root, {
87
98
  recursive: true,
88
99
  withFileTypes: true
@@ -113,7 +124,9 @@ function checkDocsLinks(options) {
113
124
  const target = fileOf(url.pathname);
114
125
  if (!target) {
115
126
  if (options.isRuntimePath?.(url.pathname)) continue;
116
- problems.add(`${path} links to ${url.pathname}, which has no page or file`);
127
+ const page = url.pathname.replace(/\/+$/, "");
128
+ if (page !== url.pathname && fileOf(page)) problems.add(`${path} links to ${url.pathname}, but the page is ${page}, without the trailing slash`);
129
+ else problems.add(`${path} links to ${url.pathname}, which has no page or file`);
117
130
  continue;
118
131
  }
119
132
  if (url.hash.length <= 1 || !target.endsWith(".html") || ignoredFragment(url.pathname)) continue;
@@ -277,9 +290,23 @@ function docsManifestOf(options, listed) {
277
290
  };
278
291
  const prefix = base === "/" ? "" : `${base.slice(1)}/`;
279
292
  const rootFile = `${prefix}index.md`;
280
- const sections = [...new Set([...files.keys()].filter((file) => file.startsWith(prefix) && file.slice(prefix.length).includes("/")).map((file) => file.slice(prefix.length).split("/")[0]))].map((id, index) => {
293
+ const sectionFiles = /* @__PURE__ */ new Map();
294
+ const standaloneFiles = [];
295
+ for (const file of files.keys()) {
296
+ if (file === rootFile) continue;
297
+ const slash = file.startsWith(prefix) ? file.indexOf("/", prefix.length) : -1;
298
+ if (slash === -1) {
299
+ standaloneFiles.push(file);
300
+ continue;
301
+ }
302
+ const id = file.slice(prefix.length, slash);
303
+ const group = sectionFiles.get(id);
304
+ if (group) group.push(file);
305
+ else sectionFiles.set(id, [file]);
306
+ }
307
+ const sections = [...sectionFiles].map(([id, entries], index) => {
281
308
  const sectionPrefix = `${prefix}${id}/`;
282
- const pages = [...files.keys()].filter((file) => file.startsWith(sectionPrefix)).map((file) => {
309
+ const pages = entries.map((file) => {
283
310
  const pageId = idOf(file.slice(sectionPrefix.length));
284
311
  return read(file, pageId, pageId === "index" ? joinPath(base, id) : joinPath(base, id, pageId));
285
312
  }).sort((left, right) => left.id === "index" ? -1 : right.id === "index" ? 1 : left.order - right.order || left.id.localeCompare(right.id));
@@ -307,7 +334,7 @@ function docsManifestOf(options, listed) {
307
334
  pages
308
335
  };
309
336
  }).sort((left, right) => left.order - right.order || left.title.localeCompare(right.title));
310
- const pages = [...files.keys()].filter((file) => !file.startsWith(prefix) || !file.slice(prefix.length).includes("/") && file !== rootFile).map((file) => read(file, "", docsPagePath(file))).sort((left, right) => left.path.localeCompare(right.path));
337
+ const pages = standaloneFiles.map((file) => read(file, "", docsPagePath(file))).sort((left, right) => left.path.localeCompare(right.path));
311
338
  const manifest = {
312
339
  base,
313
340
  root: files.has(rootFile) ? read(rootFile, "index", base) : null,
@@ -364,24 +391,33 @@ function appPage(full) {
364
391
  function docsAppManifest(manifest, options) {
365
392
  const panels = [];
366
393
  const sections = manifest.sections.map((section) => {
367
- const overviews = section.pages.filter((page) => page.panel);
368
- const nested = overviews.some((panel) => overviews.some((outer) => panel.id.startsWith(`${outer.id}/`)));
369
- if (!options.panels || !overviews.length || nested) return {
394
+ const children = /* @__PURE__ */ new Map();
395
+ if (options.panels) {
396
+ for (const page of section.pages) if (page.panel) children.set(page.id, []);
397
+ }
398
+ function parentPanelPages(id) {
399
+ for (let slash = id.lastIndexOf("/"); slash >= 0; slash = id.lastIndexOf("/")) {
400
+ id = id.slice(0, slash);
401
+ const pages = children.get(id);
402
+ if (pages) return pages;
403
+ }
404
+ }
405
+ if (!children.size || [...children.keys()].some((id) => parentPanelPages(id))) return {
370
406
  ...section,
371
407
  pages: section.pages.map(appPage)
372
408
  };
373
- for (const panel of overviews) {
374
- const pages = docsPanelPages(section, panel).filter((page) => page.id !== panel.id);
375
- if (pages.length) panels.push({
376
- path: panel.path,
409
+ const pages = [];
410
+ for (const page of section.pages) (parentPanelPages(page.id) ?? pages).push(appPage(page));
411
+ for (const page of pages) {
412
+ const entries = children.get(page.id);
413
+ if (!entries) continue;
414
+ page.panelSize = entries.filter((entry) => entry.navigation).length;
415
+ if (entries.length) panels.push({
416
+ path: page.path,
377
417
  section: section.id,
378
- pages: pages.map(appPage)
418
+ pages: entries
379
419
  });
380
420
  }
381
- const pages = section.pages.filter((page) => page.panel || !docsPanelOf(section, page)).map((page) => page.panel ? {
382
- ...appPage(page),
383
- panelSize: docsPanelPages(section, page).filter((candidate) => candidate.navigation && candidate.id !== page.id).length
384
- } : appPage(page));
385
421
  return {
386
422
  ...section,
387
423
  pages
@@ -1,4 +1,4 @@
1
- import { t as docsErrorDiagnostics } from "./error-diagnostics-B_ZOy7kF.js";
1
+ import { t as docsErrorDiagnostics } from "./error-diagnostics-CmgtG9xa.js";
2
2
  import { defu } from "defu";
3
3
  import { ELEMENT_NODE, parse, walkSync } from "ultrahtml";
4
4
  import { contentSearchSections } from "@vite-hub/content";
@@ -1,4 +1,4 @@
1
- import { a as DocsSection, i as DocsSearchSection, n as DocsManifest, o as DocsTocLink, r as DocsPage } from "./types-BhG6vGfG.js";
1
+ import { a as DocsSearchSection, s as DocsTocLink } from "./types-CHU_fy9l.js";
2
2
  import { PresetOptions } from "comark-ui/vue";
3
3
  import { Node, ParserOptions } from "comark";
4
4
  //#region src/markdown.d.ts
@@ -48,27 +48,4 @@ declare function createDocsParser(options?: DocsParserOptions): (markdown: strin
48
48
  /** Split a page into one search entry per h2 and h3, like Nuxt UI's content search expects. */
49
49
  declare function docsSearchSections(path: string, title: string, nodes: Node[]): DocsSearchSection[];
50
50
  //#endregion
51
- //#region src/page.d.ts
52
- interface DocsPageLink {
53
- path: string;
54
- title: string;
55
- description: string | null;
56
- }
57
- /** What the page route returns for one URL. The client renders it as is. */
58
- interface DocsPageResponse {
59
- page: DocsPage;
60
- /** Id of the section that owns the page, or `null` for the root page and pages outside the base. */
61
- section: string | null;
62
- document: DocsDocument;
63
- /** The page's `credits`, parsed like its body, or `null` without them. */
64
- credits: DocsDocument | null;
65
- prev: DocsPageLink | null;
66
- next: DocsPageLink | null;
67
- }
68
- /** Previous and next follow the sidebar order of the page's section, or of its panel for a page inside one. */
69
- declare function docsPageResponse(manifest: DocsManifest, found: {
70
- page: DocsPage;
71
- section: DocsSection | null;
72
- }, document: DocsDocument, credits?: DocsDocument | null): DocsPageResponse;
73
- //#endregion
74
- export { DocsParserOptions as a, docsSearchSections as c, DocsDocument as i, DocsPageResponse as n, createDocsParser as o, docsPageResponse as r, docsMarkdown as s, DocsPageLink as t };
51
+ export { docsSearchSections as a, docsMarkdown as i, DocsParserOptions as n, createDocsParser as r, DocsDocument as t };
@@ -1,4 +1,4 @@
1
- import { a as DocsSection, i as DocsSearchSection, n as DocsManifest, r as DocsPage, t as DocsAppPage } from "./types-BhG6vGfG.js";
1
+ import { a as DocsSearchSection, l as DocsLayout, n as DocsManifest, o as DocsSection, r as DocsPage, t as DocsAppPage } from "./types-CHU_fy9l.js";
2
2
  //#region src/navigation.d.ts
3
3
  /** A link that the site options add to the shell, such as a tutorials page or a community chat. */
4
4
  export interface DocsLink {
@@ -117,8 +117,9 @@ export type DocsStart = {
117
117
  links?: Pick<DocsLink, "to">[];
118
118
  } | "";
119
119
  /**
120
- * The first start link that opens a docs page outside the docs base, such as an Introduction outside every section.
121
- * It leads the start section, so the links that open it begin there. `null` when no start link is a docs page.
120
+ * The first start link that opens a docs page to read outside the docs base, such as an Introduction outside every
121
+ * section. It leads the start section, so the links that open it begin there. A `home`, `playground` or `learn` page is
122
+ * not a page to read first. `null` when no start link is such a page.
122
123
  */
123
124
  export declare function docsStartPage(manifest: DocsManifest<DocsAppPage>, start?: DocsStart): string | null;
124
125
  /**
@@ -249,6 +250,11 @@ export declare function docsRawSectionLinks(manifest: DocsManifest, path: string
249
250
  * that serves prerendered HTML reads it.
250
251
  */
251
252
  export declare const docsTutorialNavigationCookie = "vh-tutorial-navigation";
253
+ /**
254
+ * Whether a layout fills the page with a workspace: `playground` and `learn`. Such a page renders in the docs shell
255
+ * wherever it lives, and fills the viewport under the header.
256
+ */
257
+ export declare function isDocsWorkspaceLayout(layout: DocsLayout | undefined): layout is "playground" | "learn";
252
258
  /** Whether a docs page starts with its sidebar collapsed: `sidebar: "collapsed"`, or a code panel tutorial that keeps it. */
253
259
  export declare function docsSidebarCollapses(page: Pick<DocsPage, "sidebar" | "codePanel">): boolean;
254
260
  /** Links of the page actions: the Markdown twin and chat tools that read it. */
@@ -9,7 +9,7 @@ function docsManifestPages(manifest) {
9
9
  }
10
10
  /** A URL path without a trailing slash or `/index`, as the manifest stores it. */
11
11
  function normalizeDocsPath(path) {
12
- return path.replace(/\/index$/, "").replace(/(.)\/+$/, "$1") || "/";
12
+ return path.replace(/\/+(?:index\/*)?$/, "") || "/";
13
13
  }
14
14
  /** A browser URL for an app-relative route or asset. Router links keep their app-relative paths. */
15
15
  function docsAppPath(path, appBase = "/") {
@@ -76,12 +76,14 @@ function docsSectionHome(section) {
76
76
  return (section.pages.find((page) => page.path === section.path) ?? section.pages.find((page) => page.navigation) ?? section.pages[0])?.path ?? section.path;
77
77
  }
78
78
  /**
79
- * The first start link that opens a docs page outside the docs base, such as an Introduction outside every section.
80
- * It leads the start section, so the links that open it begin there. `null` when no start link is a docs page.
79
+ * The first start link that opens a docs page to read outside the docs base, such as an Introduction outside every
80
+ * section. It leads the start section, so the links that open it begin there. A `home`, `playground` or `learn` page is
81
+ * not a page to read first. `null` when no start link is such a page.
81
82
  */
82
83
  function docsStartPage(manifest, start) {
83
- const pages = new Set(docsManifestPages(manifest).filter((page) => page !== manifest.root && page.layout !== "home").map((page) => page.path));
84
- const link = start ? start.links?.find((candidate) => pages.has(normalizeDocsPath(candidate.to))) : void 0;
84
+ if (!start || !start.links?.length) return null;
85
+ const pages = new Set(docsManifestPages(manifest).filter((page) => page !== manifest.root && page.layout !== "home" && !isDocsWorkspaceLayout(page.layout)).map((page) => page.path));
86
+ const link = start.links.find((candidate) => pages.has(normalizeDocsPath(candidate.to)));
85
87
  return link ? normalizeDocsPath(link.to) : null;
86
88
  }
87
89
  /**
@@ -162,7 +164,10 @@ function docsRailEntries(manifest, options) {
162
164
  const members = /* @__PURE__ */ new Map();
163
165
  for (const section of manifest.sections) {
164
166
  const title = docsSectionGroup(section, options.groups);
165
- if (title !== null) members.set(title, [...members.get(title) ?? [], section]);
167
+ if (title === null) continue;
168
+ const group = members.get(title);
169
+ if (group) group.push(section);
170
+ else members.set(title, [section]);
166
171
  }
167
172
  const placed = /* @__PURE__ */ new Set();
168
173
  return railGroups.map((sections) => sections.flatMap((section) => {
@@ -246,7 +251,9 @@ function sidebarGroups(pages, fold) {
246
251
  for (const page of pages) {
247
252
  if (!page.navigation) continue;
248
253
  const label = page.group?.trim() || null;
249
- groups.set(label, [...groups.get(label) ?? [], page]);
254
+ const group = groups.get(label);
255
+ if (group) group.push(page);
256
+ else groups.set(label, [page]);
250
257
  }
251
258
  return [...groups].map(([label, groupPages]) => {
252
259
  const heading = groupPages.length > 1 ? label : null;
@@ -389,6 +396,13 @@ function docsRawSectionLinks(manifest, path, siteUrl) {
389
396
  * that serves prerendered HTML reads it.
390
397
  */
391
398
  const docsTutorialNavigationCookie = "vh-tutorial-navigation";
399
+ /**
400
+ * Whether a layout fills the page with a workspace: `playground` and `learn`. Such a page renders in the docs shell
401
+ * wherever it lives, and fills the viewport under the header.
402
+ */
403
+ function isDocsWorkspaceLayout(layout) {
404
+ return layout === "playground" || layout === "learn";
405
+ }
392
406
  /** Whether a docs page starts with its sidebar collapsed: `sidebar: "collapsed"`, or a code panel tutorial that keeps it. */
393
407
  function docsSidebarCollapses(page) {
394
408
  return page.sidebar === "collapsed" || page.codePanel === true && page.sidebar !== false;
@@ -516,4 +530,4 @@ function createDocsSearch(records) {
516
530
  };
517
531
  }
518
532
  //#endregion
519
- export { createDocsSearch, docsAppPath, docsCanonicalUrl, docsCatalog, docsHasRail, docsHomePath, docsIconStroke, docsIndexedPages, docsManifestPages, docsMarkdownLinks, docsMcpInstallLinks, docsPageIcon, docsPageIndexed, docsPanelGroupWindow, docsPanelOf, docsPanelPages, docsPanelSidebarGroups, docsPanelWindow, docsRailEntries, docsRailEntry, docsRailGroups, docsRailIcon, docsRailTarget, docsRawFile, docsRawPath, docsRawSectionLinks, docsRawSectionLinksMarker, docsRelatedSections, docsSectionForPath, docsSectionGroup, docsSectionHome, docsSectionIcon, docsSectionPanels, docsSidebarCollapses, docsSidebarGroup, docsSidebarGroups, docsSidebarSections, docsStartPage, docsTutorialNavigationCookie, docsUnindexedSearchSections, findDocsPage, isDocsPath, loadDocsPanels, normalizeDocsBase, normalizeDocsPath };
533
+ export { createDocsSearch, docsAppPath, docsCanonicalUrl, docsCatalog, docsHasRail, docsHomePath, docsIconStroke, docsIndexedPages, docsManifestPages, docsMarkdownLinks, docsMcpInstallLinks, docsPageIcon, docsPageIndexed, docsPanelGroupWindow, docsPanelOf, docsPanelPages, docsPanelSidebarGroups, docsPanelWindow, docsRailEntries, docsRailEntry, docsRailGroups, docsRailIcon, docsRailTarget, docsRawFile, docsRawPath, docsRawSectionLinks, docsRawSectionLinksMarker, docsRelatedSections, docsSectionForPath, docsSectionGroup, docsSectionHome, docsSectionIcon, docsSectionPanels, docsSidebarCollapses, docsSidebarGroup, docsSidebarGroups, docsSidebarSections, docsStartPage, docsTutorialNavigationCookie, docsUnindexedSearchSections, findDocsPage, isDocsPath, isDocsWorkspaceLayout, loadDocsPanels, normalizeDocsBase, normalizeDocsPath };
@@ -1,5 +1,6 @@
1
- import { d as DocsSectionFile, r as DocsPage } from "./types-BhG6vGfG.js";
2
- import { i as DocsSourceInput, s as DocsLinkCheckOptions } from "./manifest-CMoxcwPm.js";
1
+ import { h as DocsSectionFile, r as DocsPage } from "./types-CHU_fy9l.js";
2
+ import "./steps-DBlkJwtD.js";
3
+ import { i as DocsSourceInput, s as DocsLinkCheckOptions } from "./manifest-Drbdw1us.js";
3
4
  import { DocsGroup, DocsIcons, DocsLink } from "./navigation.js";
4
5
  import { ContentLlmsSection } from "@vite-hub/content";
5
6
  import { PublicRuntimeConfig } from "nuxt/schema";
@@ -14,6 +15,72 @@ interface DocsCommentsOptions {
14
15
  overlay?: false;
15
16
  }
16
17
  //#endregion
18
+ //#region src/runnable/build.d.ts
19
+ /** A lesson that runs in the reader's browser. */
20
+ interface RunnableTutorialSource {
21
+ /** The id of the lesson and of its snapshot, such as `first-agent`. */
22
+ slug: string;
23
+ /** The URL of the docs page, such as `/docs/getting-started/first-agent`. */
24
+ page: string;
25
+ /** The folder of the app after the last step, in the fixtures folder. */
26
+ fixture: string;
27
+ }
28
+ //#endregion
29
+ //#region src/runnable/playground.d.ts
30
+ /** A starting app of the playground. */
31
+ interface PlaygroundTemplateSource {
32
+ /** The `?template=` value and the id in share links. */
33
+ id: string;
34
+ label: string;
35
+ description?: string;
36
+ /** The heading of the example in the examples menu. */
37
+ group?: string;
38
+ /**
39
+ * The folder in the fixtures folder, so an example and a lesson can share one copy of the code. An absolute path,
40
+ * such as the `dir` of a `layout: playground` example, works too.
41
+ */
42
+ fixture: string;
43
+ /** The file that the editor opens first. */
44
+ open?: string;
45
+ /** The path that the preview opens when the dev server is ready. */
46
+ preview?: string;
47
+ /** The paths of the files that the editor does not let the reader change. */
48
+ readonly?: string[];
49
+ }
50
+ //#endregion
51
+ //#region src/runnable/nuxt.d.ts
52
+ type DocsRunnableLesson = RunnableTutorialSource;
53
+ type DocsRunnableExample = PlaygroundTemplateSource;
54
+ /** `runnable` of the docs module options. */
55
+ interface DocsRunnableOptions {
56
+ /**
57
+ * The folder of the apps that lessons and examples run, relative to the app root. Defaults to `fixtures`. Each app
58
+ * is a folder in it. The npm lockfile that pins its snapshot sits beside it as `<folder>.package-lock.json`.
59
+ */
60
+ fixtures?: string;
61
+ /**
62
+ * @deprecated Give each lesson a page with `layout: learn` instead, which sets its `fixture` in the frontmatter. This
63
+ * list is for an app page that renders the workspace itself and imports `#build/runnable-tutorials.mjs`.
64
+ */
65
+ lessons?: DocsRunnableLesson[];
66
+ /**
67
+ * @deprecated List the examples in the frontmatter of a page with `layout: playground` instead. This list is for an
68
+ * app page that renders the workspace itself and imports `#build/playground-templates.mjs`.
69
+ */
70
+ examples?: DocsRunnableExample[];
71
+ /**
72
+ * A docs page, such as `/docs/getting-started/installation`, whose code blocks give the version of a file before the
73
+ * lesson step that writes it. Without it, a file that a step writes does not exist before that step.
74
+ */
75
+ start?: string;
76
+ /**
77
+ * The folder of `pnpm-workspace.yaml`, relative to the app root, when fixtures use `catalog:` or `workspace:`
78
+ * specifiers. The workspace packages that a fixture uses are built and packed into its snapshot. Without it, fixtures
79
+ * install from npm only.
80
+ */
81
+ pnpmWorkspace?: string;
82
+ }
83
+ //#endregion
17
84
  //#region src/nuxt.d.ts
18
85
  interface DocsSiteOptions {
19
86
  /** Name in titles, the rail, and llms.txt. */
@@ -59,7 +126,9 @@ interface DocsModuleOptions {
59
126
  components?: string;
60
127
  /**
61
128
  * URL prefix whose folders are sections in the rail. Defaults to `/docs` when the content folder has a `docs/` folder,
62
- * and to `/` when it has none, so the docs are the whole site. Mapped sources default to `/docs`.
129
+ * and to `/` when it has none, so the docs are the whole site. With `sources`, the default is always `/docs`.
130
+ * If the site has pages but none are at or below the default base, setup warns with `DOCS_BASE_EMPTY`.
131
+ * Set `base: '/docs'` to keep those pages standalone without the warning.
63
132
  */
64
133
  base?: string;
65
134
  site?: DocsSiteOptions;
@@ -161,6 +230,13 @@ interface DocsModuleOptions {
161
230
  * `examples`, so `::example{name="ButtonExample"}` renders `app/examples/ButtonExample.vue` beside its source.
162
231
  */
163
232
  examples?: string;
233
+ /**
234
+ * Lessons and playground examples that run in the reader's browser, in a WebContainer. Each one runs an app from the
235
+ * fixtures folder. The build writes `#build/runnable-tutorials.mjs`, `#build/playground-templates.mjs`,
236
+ * `#build/learn-facts.mjs`, and a `node_modules` snapshot of each app at `/_tutorials/snapshots/` under the app base.
237
+ * Each lesson names its page by URL, so the page can come from `dir` or from `sources`.
238
+ */
239
+ runnable?: DocsRunnableOptions;
164
240
  }
165
241
  /** `llms` of the docs module options. */
166
242
  interface DocsLlmsOptions {
@@ -238,4 +314,4 @@ interface DocsNuxtModule {
238
314
  }
239
315
  declare const docsNuxtModule: DocsNuxtModule;
240
316
  //#endregion
241
- export { DocsPublicConfig as a, docsNuxtModule as c, DocsNuxtModule as i, DocsCommentsOptions as l, DocsLogo as n, DocsSiteOptions as o, DocsModuleOptions as r, DocsStartOptions as s, DocsLlmsOptions as t };
317
+ export { DocsPublicConfig as a, docsNuxtModule as c, DocsRunnableOptions as d, DocsCommentsOptions as f, DocsNuxtModule as i, DocsRunnableExample as l, DocsLogo as n, DocsSiteOptions as o, DocsModuleOptions as r, DocsStartOptions as s, DocsLlmsOptions as t, DocsRunnableLesson as u };
package/dist/nuxt.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as DocsPublicConfig, c as docsNuxtModule, i as DocsNuxtModule, l as DocsCommentsOptions, n as DocsLogo, o as DocsSiteOptions, r as DocsModuleOptions, s as DocsStartOptions, t as DocsLlmsOptions } from "./nuxt-CAGpKl_-.js";
1
+ import { a as DocsPublicConfig, c as docsNuxtModule, d as DocsRunnableOptions, f as DocsCommentsOptions, i as DocsNuxtModule, l as DocsRunnableExample, n as DocsLogo, o as DocsSiteOptions, r as DocsModuleOptions, s as DocsStartOptions, t as DocsLlmsOptions, u as DocsRunnableLesson } from "./nuxt-8O2OB_hI.js";
2
2
  import { a as DocsThemeScope } from "./theme-BXyu4uFL.js";
3
- export { type DocsCommentsOptions, DocsLlmsOptions, DocsLogo, DocsModuleOptions, DocsNuxtModule, DocsPublicConfig, DocsSiteOptions, DocsStartOptions, type DocsThemeScope, docsNuxtModule as default };
3
+ export { type DocsCommentsOptions, DocsLlmsOptions, DocsLogo, DocsModuleOptions, DocsNuxtModule, DocsPublicConfig, type DocsRunnableExample, type DocsRunnableLesson, type DocsRunnableOptions, DocsSiteOptions, DocsStartOptions, type DocsThemeScope, docsNuxtModule as default };