@vite-hub/docs 0.3.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.
- package/README.md +179 -19
- package/dist/{agent-copy-BJp_Yf5d.js → agent-copy-xPaWye_g.js} +1 -1
- package/dist/assistant-pages-CqNlHsx-.js +37 -0
- package/dist/{assistant-shared-Dll_F_yy.d.ts → assistant-shared-CWIKRtBv.d.ts} +3 -2
- package/dist/{assistant-shared-CdtXowot.js → assistant-shared-DhiLHKSl.js} +23 -7
- package/dist/assistant-worker.d.ts +1 -1
- package/dist/assistant-worker.js +1 -1
- package/dist/assistant.d.ts +1 -1
- package/dist/assistant.js +1 -1
- package/dist/{content-9CINWiRf.js → content-BQVlMshL.js} +57 -47
- package/dist/{draft-DUBx--r9.js → draft-CSsTYSeb.js} +2 -2
- package/dist/error-diagnostics-CmgtG9xa.js +157 -0
- package/dist/files-UY4h1_36.js +38 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js +4 -4
- package/dist/link-checker-redirects.js +1 -1
- package/dist/{manifest-Dzp5-_AJ.d.ts → manifest-Drbdw1us.d.ts} +9 -3
- package/dist/{manifest-D66AEF8F.js → manifest-DvECmwX-.js} +101 -51
- package/dist/{markdown-Cn9-4oVG.js → markdown-1M1FbjCw.js} +1 -1
- package/dist/{page-Dx2JD3y1.d.ts → markdown-BiKrT08O.d.ts} +2 -25
- package/dist/navigation.d.ts +10 -5
- package/dist/navigation.js +23 -10
- package/dist/{nuxt-B5LrERKc.d.ts → nuxt-8O2OB_hI.d.ts} +84 -7
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +1699 -105
- package/dist/{page-BbmSfZO8.js → page-Bb0TfRKi.js} +21 -4
- package/dist/page-BryUCmYf.d.ts +26 -0
- package/dist/primitive-rail.d.ts +2 -5
- package/dist/primitive-rail.js +8 -6
- package/dist/{raw-C03EUJKw.js → raw-BChwipz_.js} +6 -0
- package/dist/redirects-BJj58IsY.js +87 -0
- package/dist/runnable.d.ts +37 -0
- package/dist/runnable.js +105 -0
- package/dist/runtime/app/components/DocsAsideLeftBody.vue +2 -8
- package/dist/runtime/app/components/DocsLearn.vue +215 -0
- package/dist/runtime/app/components/DocsLearnCodePre.vue +98 -0
- package/dist/runtime/app/components/DocsLearnFile.vue +21 -0
- package/dist/runtime/app/components/DocsPage.vue +11 -5
- package/dist/runtime/app/components/DocsPlayground.vue +117 -0
- package/dist/runtime/app/components/content/Example.vue +18 -49
- package/dist/runtime/app/components/content/McpClient.vue +170 -0
- package/dist/runtime/app/components/content/McpInstall.vue +238 -0
- package/dist/runtime/app/components/content/PageList.vue +1 -5
- package/dist/runtime/app/layouts/docs.vue +36 -8
- package/dist/runtime/app/middleware/docs-layout.ts +2 -2
- package/dist/runtime/app/utils/docs-learn.ts +31 -0
- package/dist/runtime/app/utils/docs-playground.ts +3 -0
- package/dist/runtime/server/llms.js +1 -1
- package/dist/runtime/server/markdown.d.ts +0 -5
- package/dist/runtime/server/markdown.js +10 -1
- package/dist/runtime/server/mcp.js +1 -1
- package/dist/runtime/server/page.d.ts +1 -1
- package/dist/runtime/server/page.js +3 -3
- package/dist/runtime/server/raw.js +2 -9
- package/dist/runtime/server/search.d.ts +1 -1
- package/dist/runtime/server/search.js +3 -2
- package/dist/runtime/server/sitemap.js +1 -1
- package/dist/{schema-DwpXW0VZ.js → schema-DcWZ3Q3M.js} +97 -5
- package/dist/server.d.ts +3 -2
- package/dist/server.js +4 -4
- package/dist/snapshot-worker.mjs +40 -0
- package/dist/steps-DBlkJwtD.d.ts +105 -0
- package/dist/steps-DF-11dJn.js +32 -0
- package/dist/{types-BhG6vGfG.d.ts → types-CHU_fy9l.d.ts} +69 -4
- package/package.json +18 -11
- package/dist/error-diagnostics-BoOsP6Y4.js +0 -53
- package/dist/redirects-BrbWFSzW.js +0 -62
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { docsManifestPages, docsPanelOf, docsPanelPages, isDocsPath } from "./navigation.js";
|
|
1
|
+
import { docsManifestPages, docsPanelOf, docsPanelPages, isDocsPath, isDocsWorkspaceLayout } from "./navigation.js";
|
|
2
2
|
//#region src/page.ts
|
|
3
3
|
/** Previous and next follow the sidebar order of the page's section, or of its panel for a page inside one. */
|
|
4
4
|
function docsPageResponse(manifest, found, document, credits = null) {
|
|
@@ -23,6 +23,7 @@ function docsPageResponse(manifest, found, document, credits = null) {
|
|
|
23
23
|
function docsPageOf(frontmatter, at) {
|
|
24
24
|
const navigation = frontmatter.navigation === false ? void 0 : frontmatter.navigation;
|
|
25
25
|
const layout = frontmatter.layout ?? "article";
|
|
26
|
+
const workspace = isDocsWorkspaceLayout(layout);
|
|
26
27
|
return {
|
|
27
28
|
id: at.id,
|
|
28
29
|
path: at.path || "/",
|
|
@@ -39,8 +40,9 @@ function docsPageOf(frontmatter, at) {
|
|
|
39
40
|
...frontmatter.tutorial ? { tutorial: frontmatter.tutorial } : {},
|
|
40
41
|
...frontmatter.codePanel ? { codePanel: true } : {},
|
|
41
42
|
...frontmatter.seo ? { seo: frontmatter.seo } : {},
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
...workspace ? { workspace: workspaceOf(frontmatter) } : {},
|
|
44
|
+
sidebar: frontmatter.sidebar ?? (workspace ? "collapsed" : true),
|
|
45
|
+
toc: frontmatter.toc ?? (layout !== "landing" && layout !== "home" && !workspace),
|
|
44
46
|
kind: navigation?.kind ?? null,
|
|
45
47
|
group: navigation?.group ?? null,
|
|
46
48
|
navigation: frontmatter.navigation !== false,
|
|
@@ -48,6 +50,20 @@ function docsPageOf(frontmatter, at) {
|
|
|
48
50
|
order: navigation?.order ?? Number.MAX_SAFE_INTEGER
|
|
49
51
|
};
|
|
50
52
|
}
|
|
53
|
+
function workspaceOf(frontmatter) {
|
|
54
|
+
const { examples, tabs, render, connect, port, fixture, guide, lesson, preview } = frontmatter;
|
|
55
|
+
return {
|
|
56
|
+
examples,
|
|
57
|
+
tabs,
|
|
58
|
+
render,
|
|
59
|
+
connect,
|
|
60
|
+
port,
|
|
61
|
+
fixture,
|
|
62
|
+
guide,
|
|
63
|
+
lesson,
|
|
64
|
+
preview
|
|
65
|
+
};
|
|
66
|
+
}
|
|
51
67
|
/**
|
|
52
68
|
* The URL of a page file, from its path below the content folder without `.md`: `docs/kv/index` is `/docs/kv`, `about`
|
|
53
69
|
* is `/about`, and `index` is `/`.
|
|
@@ -71,6 +87,7 @@ function replacesDocsPage(routes, mount) {
|
|
|
71
87
|
const prefix = mount === "/" ? "" : mount;
|
|
72
88
|
return routePaths(routes).some((path) => /^(.*?)\/:\w+\(\.\*\)\*?$/.exec(path)?.[1] === prefix);
|
|
73
89
|
}
|
|
90
|
+
/** Every route path of the app, with the paths of child routes joined to their parents. */
|
|
74
91
|
function routePaths(routes, parent = "") {
|
|
75
92
|
return routes.flatMap((route) => {
|
|
76
93
|
const path = route.path.startsWith("/") ? route.path : `${parent.replace(/\/+$/, "")}/${route.path}`;
|
|
@@ -78,4 +95,4 @@ function routePaths(routes, parent = "") {
|
|
|
78
95
|
});
|
|
79
96
|
}
|
|
80
97
|
//#endregion
|
|
81
|
-
export { replacesDocsPage as a, docsPageResponse as i, docsPageOf as n, docsPagePath as r, docsMount as t };
|
|
98
|
+
export { replacesDocsPage as a, docsPageResponse as i, docsPageOf as n, routePaths as o, docsPagePath as r, docsMount as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { n as DocsManifest, o as DocsSection, r as DocsPage } from "./types-CHU_fy9l.js";
|
|
2
|
+
import { t as DocsDocument } from "./markdown-BiKrT08O.js";
|
|
3
|
+
//#region src/page.d.ts
|
|
4
|
+
interface DocsPageLink {
|
|
5
|
+
path: string;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string | null;
|
|
8
|
+
}
|
|
9
|
+
/** What the page route returns for one URL. The client renders it as is. */
|
|
10
|
+
interface DocsPageResponse {
|
|
11
|
+
page: DocsPage;
|
|
12
|
+
/** Id of the section that owns the page, or `null` for the root page and pages outside the base. */
|
|
13
|
+
section: string | null;
|
|
14
|
+
document: DocsDocument;
|
|
15
|
+
/** The page's `credits`, parsed like its body, or `null` without them. */
|
|
16
|
+
credits: DocsDocument | null;
|
|
17
|
+
prev: DocsPageLink | null;
|
|
18
|
+
next: DocsPageLink | null;
|
|
19
|
+
}
|
|
20
|
+
/** Previous and next follow the sidebar order of the page's section, or of its panel for a page inside one. */
|
|
21
|
+
declare function docsPageResponse(manifest: DocsManifest, found: {
|
|
22
|
+
page: DocsPage;
|
|
23
|
+
section: DocsSection | null;
|
|
24
|
+
}, document: DocsDocument, credits?: DocsDocument | null): DocsPageResponse;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { DocsPageResponse as n, docsPageResponse as r, DocsPageLink as t };
|
package/dist/primitive-rail.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component, PropType, SlotsType, VNode } from "vue";
|
|
2
2
|
//#region ../icons/dist/index.d.ts
|
|
3
3
|
/** Name of an icon in the ViteHub set, such as `kv` for `i-vitehub-kv`. */
|
|
4
|
-
type ViteHubIconName = "agent" | "auth" | "blob" | "browser" | "bundle" | "cache" | "channels" | "cms" | "codemods" | "comments" | "compare" | "connections" | "
|
|
4
|
+
type ViteHubIconName = "agent" | "auth" | "blob" | "browser" | "bundle" | "cache" | "channels" | "choices" | "cli" | "cms" | "codemods" | "comments" | "compare" | "connections" | "console" | "content" | "database" | "development" | "device" | "docs" | "email" | "env" | "forge" | "forms" | "gateways" | "guides" | "hosts" | "i18n" | "kv" | "logs" | "markdown-template" | "mcp" | "presets" | "queue" | "rate-limit" | "realtime" | "reference" | "runtime" | "sandbox" | "schedule" | "shell" | "skills" | "source" | "start" | "sync" | "ui" | "usage" | "web-container" | "webhooks" | "workflow" | "workspace";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/components/primitive-icon.d.ts
|
|
7
7
|
/** Name of an icon in the `@vite-hub/icons` set: one for each Server Primitive, Console area, and docs area. */
|
|
@@ -10,10 +10,7 @@ export declare function isPrimitiveIconName(value: unknown): value is PrimitiveI
|
|
|
10
10
|
export declare const primitiveIconNames: readonly PrimitiveIconName[];
|
|
11
11
|
/** Returns the set icon that an Iconify name such as `i-vitehub-kv` or `vitehub:kv` names, or a bare name such as `kv`. */
|
|
12
12
|
export declare function resolvePrimitiveIconName(icon: string): PrimitiveIconName | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* Inline SVG of a `@vite-hub/icons` icon, so the part that each icon marks with `data-motion` can move when its rail item
|
|
15
|
-
* gets a pointer or keyboard focus. `styles.css` sets the motion of each icon. Strokes use currentColor.
|
|
16
|
-
*/
|
|
13
|
+
/** Inline SVG of a `@vite-hub/icons` icon. Strokes use currentColor. */
|
|
17
14
|
export declare const PrimitiveIcon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
18
15
|
name: {
|
|
19
16
|
required: true;
|
package/dist/primitive-rail.js
CHANGED
|
@@ -4,7 +4,7 @@ const icons = {
|
|
|
4
4
|
"prefix": "vitehub",
|
|
5
5
|
"info": {
|
|
6
6
|
"name": "ViteHub",
|
|
7
|
-
"total":
|
|
7
|
+
"total": 51,
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "ViteHub",
|
|
10
10
|
"url": "https://github.com/vite-hub/vitehub/tree/main/packages/icons"
|
|
@@ -26,14 +26,16 @@ const icons = {
|
|
|
26
26
|
"bundle": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m21 7.5-9-4.5-9 4.5v9l9 4.5 9-4.5zM3 7.5l9 4.5 9-4.5M12 12v9\"/><g data-motion=\"\"><path d=\"m7 5.5 9 4.5\"/></g></g>" },
|
|
27
27
|
"cache": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><g data-motion=\"\"><path d=\"M13 7.5 9 12.5h3.5l-1 4 4-5H12z\"/></g></g>" },
|
|
28
28
|
"channels": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 16.5V6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H6.5z\"/><g data-motion=\"\"><path d=\"M18 8h1a2 2 0 0 1 2 2v10.5L17.5 17H11a2 2 0 0 1-2-2v-.5\"/></g></g>" },
|
|
29
|
+
"choices": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 21v-9\"/><path d=\"M12 12 3 3M3 7.5V3h4.5M12 12l9-9\"/><g data-motion=\"\"><path d=\"M21 7.5V3h-4.5\"/></g></g>" },
|
|
30
|
+
"cli": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m4 6.5 6 5.5-6 5.5\"/><g data-motion=\"\"><path d=\"M12.5 18H20\"/></g></g>" },
|
|
29
31
|
"cms": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M19 10.5V5a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5\"/><path d=\"M9 7.5h6M9 11.5h3\"/><g data-motion=\"\"><path d=\"M17.5 13.5l2.5 2.5-5 5h-2.5v-2.5z\"/></g></g>" },
|
|
30
32
|
"codemods": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m7.5 7-4.5 5 4.5 5\"/><g data-motion=\"\"><path d=\"M11 12h10m-3.5-3.5L21 12l-3.5 3.5\"/></g></g>" },
|
|
31
33
|
"comments": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 20H4v-8a8 8 0 1 1 8 8z\"/><g data-motion=\"\"><path d=\"M8.5 10.5h7M8.5 14h4.5\"/></g></g>" },
|
|
32
34
|
"compare": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 8h16M16 4l4 4-4 4\"/><g data-motion=\"\"><path d=\"M20 16H4M8 12l-4 4 4 4\"/></g></g>" },
|
|
33
35
|
"connections": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 16.5V21\"/><g data-motion=\"\"><path d=\"M9 3v4M15 3v4M6.5 7h11v4a5.5 5.5 0 0 1-11 0z\"/></g></g>" },
|
|
36
|
+
"console": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4.5\" width=\"18\" height=\"15\" rx=\"2\"/><path d=\"M8.5 4.5v15\"/><g data-motion=\"\"><path d=\"M11.5 9H17M11.5 12h4M11.5 15H16\"/></g></g>" },
|
|
34
37
|
"content": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"5\" y=\"3\" width=\"14\" height=\"18\" rx=\"2\"/><path d=\"M9 7.5h6\"/><g data-motion=\"\"><path d=\"M9 11.5h6M9 15.5h4\"/></g></g>" },
|
|
35
38
|
"database": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 6v12c0 1.66 3.58 3 8 3s8-1.34 8-3V6\"/><path d=\"M4 12c0 1.66 3.58 3 8 3s8-1.34 8-3\"/><g data-motion=\"\"><path d=\"M4 6c0-1.66 3.58-3 8-3s8 1.34 8 3-3.58 3-8 3-8-1.34-8-3z\"/></g></g>" },
|
|
36
|
-
"decisions": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 21v-9\"/><path d=\"M12 12 3 3M3 7.5V3h4.5M12 12l9-9\"/><g data-motion=\"\"><path d=\"M21 7.5V3h-4.5\"/></g></g>" },
|
|
37
39
|
"development": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m8 7-5 5 5 5M16 7l5 5-5 5\"/><g data-motion=\"\"><path d=\"m13.5 5-3 14\"/></g></g>" },
|
|
38
40
|
"device": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"6.5\" y=\"3\" width=\"11\" height=\"18\" rx=\"2.5\"/><path d=\"M10.5 18h3\"/><g data-motion=\"\"><path d=\"M9.5 7.5h5M9.5 10.5h5M9.5 13.5h3\"/></g></g>" },
|
|
39
41
|
"docs": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 6.5C10.5 5 8 4.5 3 4.5v14c5 0 7.5.5 9 2\"/><g data-motion=\"\"><path d=\"M12 6.5c1.5-1.5 4-2 9-2v14c-5 0-7.5.5-9 2V6.5\"/></g></g>" },
|
|
@@ -47,11 +49,14 @@ const icons = {
|
|
|
47
49
|
"i18n": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3.5 6h9M8 3.5V6\"/><path d=\"M5 9.5l5 5M4 15l5-5 2-4\"/><g data-motion=\"\"><path d=\"M12.5 21l4-9 4 9M14 18h5\"/></g></g>" },
|
|
48
50
|
"kv": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M9 5v14M3 12h18\"/><g data-motion=\"\"><path d=\"M12.5 8.5h5M12.5 15.5h3.5\"/></g></g>" },
|
|
49
51
|
"logs": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 6h2M4 12h2M4 18h2\"/><g data-motion=\"\"><path d=\"M9.5 6H20M9.5 12h7.5M9.5 18H19\"/></g></g>" },
|
|
52
|
+
"markdown-template": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M6.5 15.5v-7l2.5 3 2.5-3v7\"/><g data-motion=\"\"><path d=\"M16.5 8.5v7M14.5 13.5l2 2 2-2\"/></g></g>" },
|
|
50
53
|
"mcp": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M12 15.5v1.5\"/><g data-motion=\"\"><path d=\"M9.5 8.5v3.5M14.5 8.5v3.5\"/></g></g>" },
|
|
54
|
+
"presets": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M17 3H5a2 2 0 0 0-2 2v12\"/><g data-motion=\"\"><rect x=\"7\" y=\"7\" width=\"14\" height=\"14\" rx=\"2\"/><path d=\"M12 12.5v2M16 12.5v2\"/></g></g>" },
|
|
51
55
|
"queue": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M16.5 12H21M18 9l3 3-3 3\"/><g data-motion=\"\"><rect x=\"3\" y=\"7\" width=\"5\" height=\"10\" rx=\"1.5\"/><rect x=\"9.5\" y=\"7\" width=\"5\" height=\"10\" rx=\"1.5\"/></g></g>" },
|
|
52
56
|
"rate-limit": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 16a9 9 0 0 1 18 0M6 20h12\"/><path d=\"M12 16h.01\"/><g data-motion=\"\"><path d=\"m12 16 4-5\"/></g></g>" },
|
|
53
57
|
"realtime": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><circle cx=\"12\" cy=\"12\" r=\"1.5\"/><path d=\"M8.5 8.5a5 5 0 0 0 0 7M15.5 8.5a5 5 0 0 1 0 7\"/><g data-motion=\"\"><path d=\"M5.5 5.5a9.2 9.2 0 0 0 0 13M18.5 5.5a9.2 9.2 0 0 1 0 13\"/></g></g>" },
|
|
54
58
|
"reference": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M8 3.5H7a2 2 0 0 0-2 2V10a2 2 0 0 1-2 2 2 2 0 0 1 2 2v4.5a2 2 0 0 0 2 2h1\"/><g data-motion=\"\"><path d=\"M16 3.5h1a2 2 0 0 1 2 2V10a2 2 0 0 0 2 2 2 2 0 0 0-2 2v4.5a2 2 0 0 1-2 2h-1\"/></g></g>" },
|
|
59
|
+
"runtime": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\"/><path d=\"M9.5 3v3M14.5 3v3M9.5 18v3M14.5 18v3M3 9.5h3M3 14.5h3M18 9.5h3M18 14.5h3\"/><g data-motion=\"\"><rect x=\"9.5\" y=\"9.5\" width=\"5\" height=\"5\" rx=\"1\"/></g></g>" },
|
|
55
60
|
"sandbox": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 8V5a2 2 0 0 1 2-2h3M16 3h3a2 2 0 0 1 2 2v3M21 16v3a2 2 0 0 1-2 2h-3M8 21H5a2 2 0 0 1-2-2v-3\"/><g data-motion=\"\"><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1.5\"/></g></g>" },
|
|
56
61
|
"schedule": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M3 10h18M8 3v4M16 3v4\"/><g data-motion=\"\"><rect x=\"7\" y=\"13.5\" width=\"3.5\" height=\"3.5\" rx=\"1\"/></g></g>" },
|
|
57
62
|
"shell": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"m7 9.5 3 2.5-3 2.5\"/><g data-motion=\"\"><path d=\"M12.5 15h4.5\"/></g></g>" },
|
|
@@ -80,10 +85,7 @@ function resolvePrimitiveIconName(icon) {
|
|
|
80
85
|
const name = icon.replace(/^(?:i-vitehub-|vitehub:)/, "");
|
|
81
86
|
return isPrimitiveIconName(name) ? name : void 0;
|
|
82
87
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Inline SVG of a `@vite-hub/icons` icon, so the part that each icon marks with `data-motion` can move when its rail item
|
|
85
|
-
* gets a pointer or keyboard focus. `styles.css` sets the motion of each icon. Strokes use currentColor.
|
|
86
|
-
*/
|
|
88
|
+
/** Inline SVG of a `@vite-hub/icons` icon. Strokes use currentColor. */
|
|
87
89
|
const PrimitiveIcon = defineComponent({
|
|
88
90
|
name: "PrimitiveIcon",
|
|
89
91
|
props: { name: {
|
|
@@ -671,6 +671,8 @@ const presentationDirectives = /* @__PURE__ */ new Set([
|
|
|
671
671
|
"example",
|
|
672
672
|
"examples",
|
|
673
673
|
"incorrect",
|
|
674
|
+
"mcp-client",
|
|
675
|
+
"mcp-install",
|
|
674
676
|
"page-list",
|
|
675
677
|
"important",
|
|
676
678
|
"note",
|
|
@@ -717,6 +719,10 @@ function directiveLabel(name, attributes) {
|
|
|
717
719
|
"warning",
|
|
718
720
|
"important"
|
|
719
721
|
].includes(name)) return `> **${name[0].toUpperCase()}${name.slice(1)}**`;
|
|
722
|
+
if (name === "mcp-client") {
|
|
723
|
+
const label = attributes?.match(/\blabel=(?:"([^"]+)"|'([^']+)')/)?.slice(1).find(Boolean);
|
|
724
|
+
return label ? `### ${label}` : "";
|
|
725
|
+
}
|
|
720
726
|
if (name === "tabs-item") {
|
|
721
727
|
const label = attributes?.match(/\blabel=(?:"([^"]+)"|'([^']+)')/)?.slice(1).find(Boolean);
|
|
722
728
|
return label ? `### ${label}` : "";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { docsManifestPages, docsRawPath, docsSectionForPath, isDocsPath, normalizeDocsPath } from "./navigation.js";
|
|
2
|
+
import { t as docsErrorDiagnostics } from "./error-diagnostics-CmgtG9xa.js";
|
|
3
|
+
import { addRoute, createRouter, findRoute } from "rou3";
|
|
4
|
+
//#region src/redirects.ts
|
|
5
|
+
/**
|
|
6
|
+
* The redirect route rules from an exact app path. Keep external targets so a chain can end at another site.
|
|
7
|
+
* A wildcard rule, such as `/docs/old/**`, has no single target page, so it is left out.
|
|
8
|
+
*/
|
|
9
|
+
function docsRedirects(routeRules) {
|
|
10
|
+
return Object.entries(routeRules).flatMap(([from, rule]) => {
|
|
11
|
+
const to = typeof rule?.redirect === "string" ? rule.redirect : rule?.redirect ? rule.redirect.to : void 0;
|
|
12
|
+
if (!to || from.includes("*") || !from.startsWith("/")) return [];
|
|
13
|
+
return [{
|
|
14
|
+
from,
|
|
15
|
+
to
|
|
16
|
+
}];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function docsPaths(manifest) {
|
|
20
|
+
return new Set(docsManifestPages(manifest).flatMap((page) => [page.path, docsRawPath(page.path)]));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The server routes that answer a browser navigation, a `GET`. A catch-all at the root, such as the page renderer or
|
|
24
|
+
* `server/routes/[...slug].ts`, answers every path, and the docs' own handlers below `docsRuntime` serve the docs
|
|
25
|
+
* pages, so they are left out.
|
|
26
|
+
*/
|
|
27
|
+
function docsServerRoutes(routes, docsRuntime) {
|
|
28
|
+
return routes.filter(({ route, method, handler }) => (!method || method.toUpperCase() === "GET") && !/^\/(?:\*\*(?::\w+)?|:\w+\(\.\*\))$/.test(route) && !handler.startsWith(docsRuntime));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Redirects that break a link. A redirect from a docs page hides the page, as nobody can open it. A redirect into a
|
|
32
|
+
* section, the docs base, or `/raw/` must open a docs page or its Markdown copy, another redirect, or one of
|
|
33
|
+
* `serverRoutes`, from `docsServerRoutes()`. Other targets belong to the app, so they are not checked here. Each
|
|
34
|
+
* problem is one sentence that names the fix.
|
|
35
|
+
*/
|
|
36
|
+
function docsRedirectProblems(manifest, redirects, serverRoutes = []) {
|
|
37
|
+
const pages = docsPaths(manifest);
|
|
38
|
+
const routes = createRouter();
|
|
39
|
+
for (const { route, method } of serverRoutes) addRoute(routes, method, route, true);
|
|
40
|
+
const next = new Map(redirects.filter((redirect) => !isTrailingSlashRedirect(redirect)).map((redirect) => [routeRulePath(redirect.from), redirect.to]));
|
|
41
|
+
const problems = [];
|
|
42
|
+
for (const redirect of redirects) {
|
|
43
|
+
const { from, to } = redirect;
|
|
44
|
+
const source = routeRulePath(from);
|
|
45
|
+
const trailingSlashRedirect = isTrailingSlashRedirect(redirect);
|
|
46
|
+
const page = trailingSlashRedirect ? void 0 : docsManifestPages(manifest).find((candidate) => candidate.path === source || docsRawPath(candidate.path) === source);
|
|
47
|
+
if (page) problems.push(`The redirect from ${from} hides the page ${page.file}. Remove the route rule, or move the page.`);
|
|
48
|
+
const seen = new Set(trailingSlashRedirect ? [] : [source]);
|
|
49
|
+
let end = to;
|
|
50
|
+
let path = localTargetPath(end);
|
|
51
|
+
while (path !== void 0) {
|
|
52
|
+
const target = normalizeDocsPath(path);
|
|
53
|
+
const rulePath = routeRulePath(path);
|
|
54
|
+
const key = !next.has(rulePath) && path.endsWith("/") && pages.has(target) ? target : rulePath;
|
|
55
|
+
const redirectTarget = next.get(key);
|
|
56
|
+
if (seen.has(key)) {
|
|
57
|
+
problems.push(`The redirect from ${from} comes back to ${key} and never reaches a page. Point one of its route rules to a page.`);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
if (redirectTarget === void 0) {
|
|
61
|
+
if ((target.startsWith("/raw/") || docsSectionForPath(manifest, target) !== null || manifest.base !== "/" && isDocsPath(target, manifest.base)) && !pages.has(target) && !findRoute(routes, "GET", path)) problems.push(`The redirect from ${from} goes to ${end}, which is not a docs page. Point it to a page, or remove the route rule.`);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
seen.add(key);
|
|
65
|
+
end = redirectTarget;
|
|
66
|
+
path = localTargetPath(end);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return problems;
|
|
70
|
+
}
|
|
71
|
+
function routeRulePath(path) {
|
|
72
|
+
return path.replace(/\/$/, "") || "/";
|
|
73
|
+
}
|
|
74
|
+
function isTrailingSlashRedirect({ from, to }) {
|
|
75
|
+
const target = localTargetPath(to);
|
|
76
|
+
return target !== void 0 && target !== from && target === routeRulePath(from);
|
|
77
|
+
}
|
|
78
|
+
function localTargetPath(to) {
|
|
79
|
+
if (!to.startsWith("/") || to.startsWith("//")) return void 0;
|
|
80
|
+
return to.replace(/[?#].*$/, "");
|
|
81
|
+
}
|
|
82
|
+
/** `DOCS_REDIRECTS_BROKEN`, with the list of problems in `problems`. */
|
|
83
|
+
function docsRedirectError(problems) {
|
|
84
|
+
return Object.assign(docsErrorDiagnostics.DOCS_REDIRECTS_BROKEN({ problems }), { problems });
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { docsServerRoutes as i, docsRedirectProblems as n, docsRedirects as r, docsRedirectError as t };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { t as DocsDocument } from "./markdown-BiKrT08O.js";
|
|
2
|
+
import { a as DocsWorkspaceData, c as RunnableTutorialData, d as dependencyKey, f as restartsDevServer, i as DocsRenderFunction, l as RunnableTutorialStep, m as tutorialWorkspaceFiles, n as DocsPlaygroundData, o as DocsWorkspaceTab, p as tutorialStepFiles, r as DocsPlaygroundExampleData, s as PlaygroundTemplate, t as DocsLearnData, u as TutorialFiles } from "./steps-DBlkJwtD.js";
|
|
3
|
+
//#region src/runnable/document.d.ts
|
|
4
|
+
type DocsNode = DocsDocument["nodes"][number];
|
|
5
|
+
/**
|
|
6
|
+
* The nodes as a reader of one framework sees them: each `::tabs{sync="framework"}` block becomes the content of that
|
|
7
|
+
* framework's tab. A runnable lesson runs a Vite workspace, so its guide shows the Vite tab, whatever the reader picked.
|
|
8
|
+
*/
|
|
9
|
+
export declare function frameworkNodes(nodes: readonly DocsNode[], framework: string): DocsNode[];
|
|
10
|
+
/** Splits a lesson page into the prose before the first step, one node per `::tutorial-step`, and the prose after the last. */
|
|
11
|
+
export declare function splitTutorialDocument(nodes: readonly DocsNode[]): {
|
|
12
|
+
intro: DocsNode[];
|
|
13
|
+
steps: DocsNode[];
|
|
14
|
+
outro: DocsNode[];
|
|
15
|
+
};
|
|
16
|
+
/** A request of a lesson command, which the workspace sends from inside the WebContainer. */
|
|
17
|
+
interface TutorialRequest {
|
|
18
|
+
method: string;
|
|
19
|
+
url: string;
|
|
20
|
+
headers: Record<string, string>;
|
|
21
|
+
body?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Reads the `curl` command of a lesson, such as `curl -X POST http://localhost:3000/api/greet -d '{}'`. Other commands return `undefined`. */
|
|
24
|
+
export declare function parseCurl(command: string): TutorialRequest | undefined;
|
|
25
|
+
/** A Node script that sends the request from inside the workspace and prints the status and the body, like `curl`. */
|
|
26
|
+
export declare function requestScript(request: TutorialRequest): string;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/runnable/learn.d.ts
|
|
29
|
+
/** What the Learn page shows about one tutorial page, read from its Markdown. */
|
|
30
|
+
interface LearnPageFacts {
|
|
31
|
+
/** The `::tutorial-step` blocks. */
|
|
32
|
+
steps: number;
|
|
33
|
+
/** About how long the tutorial takes, in minutes. */
|
|
34
|
+
minutes: number;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { type DocsLearnData, type DocsPlaygroundData, type DocsPlaygroundExampleData, type DocsRenderFunction, type DocsWorkspaceData, type DocsWorkspaceTab, type LearnPageFacts, type PlaygroundTemplate, type RunnableTutorialData, type RunnableTutorialStep, type TutorialFiles, type TutorialRequest, dependencyKey, restartsDevServer, tutorialStepFiles, tutorialWorkspaceFiles };
|
package/dist/runnable.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { i as tutorialWorkspaceFiles, n as restartsDevServer, r as tutorialStepFiles, t as dependencyKey } from "./steps-DF-11dJn.js";
|
|
2
|
+
//#region src/runnable/document.ts
|
|
3
|
+
/**
|
|
4
|
+
* The nodes as a reader of one framework sees them: each `::tabs{sync="framework"}` block becomes the content of that
|
|
5
|
+
* framework's tab. A runnable lesson runs a Vite workspace, so its guide shows the Vite tab, whatever the reader picked.
|
|
6
|
+
*/
|
|
7
|
+
function frameworkNodes(nodes, framework) {
|
|
8
|
+
return nodes.flatMap((node) => {
|
|
9
|
+
if (!Array.isArray(node) || node[0] === null) return [node];
|
|
10
|
+
const [tag, props, ...children] = node;
|
|
11
|
+
if (tag === "tabs" && props?.sync === "framework") {
|
|
12
|
+
const item = children.find((child) => Array.isArray(child) && child[0] === "tabs-item" && child[1]?.label === framework);
|
|
13
|
+
if (!Array.isArray(item)) return [];
|
|
14
|
+
const [, , ...content] = item;
|
|
15
|
+
return frameworkNodes(content, framework);
|
|
16
|
+
}
|
|
17
|
+
return [[
|
|
18
|
+
tag,
|
|
19
|
+
props,
|
|
20
|
+
...frameworkNodes(children, framework)
|
|
21
|
+
]];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function isStep(node) {
|
|
25
|
+
return Array.isArray(node) && node[0] === "tutorial-step";
|
|
26
|
+
}
|
|
27
|
+
/** Splits a lesson page into the prose before the first step, one node per `::tutorial-step`, and the prose after the last. */
|
|
28
|
+
function splitTutorialDocument(nodes) {
|
|
29
|
+
const first = nodes.findIndex(isStep);
|
|
30
|
+
const last = nodes.findLastIndex(isStep);
|
|
31
|
+
if (first === -1) return {
|
|
32
|
+
intro: [...nodes],
|
|
33
|
+
steps: [],
|
|
34
|
+
outro: []
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
intro: nodes.slice(0, first),
|
|
38
|
+
steps: nodes.slice(first, last + 1).filter(isStep),
|
|
39
|
+
outro: nodes.slice(last + 1)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function tokenize(command) {
|
|
43
|
+
const tokens = [];
|
|
44
|
+
let current = "";
|
|
45
|
+
let quote;
|
|
46
|
+
let started = false;
|
|
47
|
+
const source = command.replace(/\\\n/g, " ");
|
|
48
|
+
for (let index = 0; index < source.length; index++) {
|
|
49
|
+
const char = source[index];
|
|
50
|
+
if (quote) {
|
|
51
|
+
if (char === quote) quote = void 0;
|
|
52
|
+
else if (char === "\\" && quote === "\"" && index + 1 < source.length) current += source[++index];
|
|
53
|
+
else current += char;
|
|
54
|
+
} else if (char === "'" || char === "\"") {
|
|
55
|
+
quote = char;
|
|
56
|
+
started = true;
|
|
57
|
+
} else if (/\s/.test(char)) {
|
|
58
|
+
if (started || current) tokens.push(current);
|
|
59
|
+
current = "";
|
|
60
|
+
started = false;
|
|
61
|
+
} else current += char;
|
|
62
|
+
}
|
|
63
|
+
if (started || current) tokens.push(current);
|
|
64
|
+
return tokens;
|
|
65
|
+
}
|
|
66
|
+
/** Reads the `curl` command of a lesson, such as `curl -X POST http://localhost:3000/api/greet -d '{}'`. Other commands return `undefined`. */
|
|
67
|
+
function parseCurl(command) {
|
|
68
|
+
const tokens = tokenize(command.trim());
|
|
69
|
+
if (tokens[0] !== "curl") return void 0;
|
|
70
|
+
const request = {
|
|
71
|
+
method: "",
|
|
72
|
+
url: "",
|
|
73
|
+
headers: {}
|
|
74
|
+
};
|
|
75
|
+
for (let index = 1; index < tokens.length; index++) {
|
|
76
|
+
const token = tokens[index];
|
|
77
|
+
const value = () => tokens[++index] ?? "";
|
|
78
|
+
if (token === "-X" || token === "--request") request.method = value().toUpperCase();
|
|
79
|
+
else if (token === "-H" || token === "--header") {
|
|
80
|
+
const header = value();
|
|
81
|
+
const colon = header.indexOf(":");
|
|
82
|
+
if (colon > 0) request.headers[header.slice(0, colon).trim()] = header.slice(colon + 1).trim();
|
|
83
|
+
} else if (token === "-d" || token === "--data" || token === "--data-raw") request.body = value();
|
|
84
|
+
else if (token.startsWith("-")) return void 0;
|
|
85
|
+
else request.url = token;
|
|
86
|
+
}
|
|
87
|
+
if (!/^https?:\/\/localhost(?::\d+)?\//.test(request.url)) return void 0;
|
|
88
|
+
request.method ||= request.body === void 0 ? "GET" : "POST";
|
|
89
|
+
return request;
|
|
90
|
+
}
|
|
91
|
+
/** A Node script that sends the request from inside the workspace and prints the status and the body, like `curl`. */
|
|
92
|
+
function requestScript(request) {
|
|
93
|
+
const init = {
|
|
94
|
+
method: request.method,
|
|
95
|
+
headers: request.headers,
|
|
96
|
+
body: request.body
|
|
97
|
+
};
|
|
98
|
+
return [
|
|
99
|
+
`const response = await fetch(${JSON.stringify(request.url)}, ${JSON.stringify(init)})`,
|
|
100
|
+
`console.log(response.status + " " + response.statusText)`,
|
|
101
|
+
`console.log(await response.text())`
|
|
102
|
+
].join("\n");
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { dependencyKey, frameworkNodes, parseCurl, requestScript, restartsDevServer, splitTutorialDocument, tutorialStepFiles, tutorialWorkspaceFiles };
|
|
@@ -478,7 +478,8 @@ function toggleGroup(pageGroup: DocsSidebarGroup<DocsAppPage>, event: Event) {
|
|
|
478
478
|
cursor: pointer;
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
/* A folded group: the summary is its heading, and its chevron points right while the group is shut.
|
|
481
|
+
/* A folded group: the summary is its heading, and its chevron points right while the group is shut. The disclosure effect
|
|
482
|
+
of the motion layer turns the chevron when the group opens or closes. */
|
|
482
483
|
.vh-docs-sidebar-fold > summary {
|
|
483
484
|
cursor: pointer;
|
|
484
485
|
list-style: none;
|
|
@@ -490,7 +491,6 @@ function toggleGroup(pageGroup: DocsSidebarGroup<DocsAppPage>, event: Event) {
|
|
|
490
491
|
|
|
491
492
|
.vh-docs-sidebar-fold-icon {
|
|
492
493
|
color: var(--ui-text-dimmed);
|
|
493
|
-
transition: transform 150ms ease;
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
.vh-docs-sidebar-fold:not([open]) .vh-docs-sidebar-fold-icon {
|
|
@@ -507,12 +507,6 @@ function toggleGroup(pageGroup: DocsSidebarGroup<DocsAppPage>, event: Event) {
|
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
@media (prefers-reduced-motion: reduce) {
|
|
511
|
-
.vh-docs-sidebar-fold-icon {
|
|
512
|
-
transition: none;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
510
|
/* A section without a listed home page has a title row that opens nothing. */
|
|
517
511
|
.vh-docs-sidebar-section-title {
|
|
518
512
|
display: flex;
|