@slidev/cli 52.16.0 → 52.17.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.
- package/README.md +1 -1
- package/dist/{build-BtXN8hyb.mjs → build-CsQUCdtJ.mjs} +4 -4
- package/dist/cli.mjs +18 -9
- package/dist/{export-BHxAO7pf.mjs → export-_6QaMWg2.mjs} +35 -29
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +1 -1
- package/dist/{resolver-CZx9LFrt.mjs → resolver-BBT539iz.mjs} +4 -2
- package/dist/{serve-bnzg299W.mjs → serve-bAegrEOc.mjs} +752 -267
- package/dist/stdio-CjXw2-ks.mjs +24 -0
- package/package.json +26 -23
- package/skills/slidev/SKILL.md +1 -0
- package/skills/slidev/references/core-cli.md +8 -0
- package/skills/slidev/references/tool-mcp.md +48 -0
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Presentation <b>slide</b>s for <b>dev</b>elopers 🧑💻👩💻👨
|
|
|
19
19
|
</p>
|
|
20
20
|
|
|
21
21
|
<p align="center">
|
|
22
|
-
<a href="https://
|
|
22
|
+
<a href="https://x.com/antfu7/status/1389604687502995457">Video Preview</a> | <a href="https://sli.dev">Documentation</a>
|
|
23
23
|
</p>
|
|
24
24
|
|
|
25
25
|
<div align="center">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as resolveViteConfigs } from "./serve-
|
|
1
|
+
import { n as resolveViteConfigs } from "./serve-bAegrEOc.mjs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { build as build$1 } from "vite";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
@@ -51,7 +51,7 @@ async function build(options, viteConfig = {}, args) {
|
|
|
51
51
|
dev: true
|
|
52
52
|
}));
|
|
53
53
|
server.listen(port);
|
|
54
|
-
const { exportSlides } = await import("./export-
|
|
54
|
+
const { exportSlides } = await import("./export-_6QaMWg2.mjs");
|
|
55
55
|
const tempDir = resolve(outDir, "temp");
|
|
56
56
|
await fs$1.mkdir(tempDir, { recursive: true });
|
|
57
57
|
await exportSlides({
|
|
@@ -64,7 +64,7 @@ async function build(options, viteConfig = {}, args) {
|
|
|
64
64
|
range: "1",
|
|
65
65
|
width: options.data.config.canvasWidth,
|
|
66
66
|
height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
|
|
67
|
-
routerMode: options.data.config.routerMode,
|
|
67
|
+
routerMode: options.data.config.routerMode === "memory" ? "history" : options.data.config.routerMode,
|
|
68
68
|
waitUntil: "networkidle",
|
|
69
69
|
timeout: args.timeout || 3e4,
|
|
70
70
|
perSlide: true,
|
|
@@ -92,7 +92,7 @@ async function build(options, viteConfig = {}, args) {
|
|
|
92
92
|
"true",
|
|
93
93
|
"auto"
|
|
94
94
|
].includes(options.data.config.download)) {
|
|
95
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
95
|
+
const { exportSlides, getExportOptions } = await import("./export-_6QaMWg2.mjs");
|
|
96
96
|
const port = 12445;
|
|
97
97
|
const app = connect();
|
|
98
98
|
const server = http.createServer(app);
|
package/dist/cli.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { i as resolveEntry, r as isInstalledGlobally } from "./resolver-
|
|
2
|
-
import {
|
|
1
|
+
import { i as resolveEntry, r as isInstalledGlobally } from "./resolver-BBT539iz.mjs";
|
|
2
|
+
import { c as getThemeMeta, d as loadSetups, f as updateFrontmatterPatch, l as resolveTheme, o as resolveOptions, s as parser, t as createServer, u as version } from "./serve-bAegrEOc.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import { blue, bold, cyan, cyanBright, dim, gray, green, underline, yellow } from "ansis";
|
|
7
7
|
import { injectPreparserExtensionLoader } from "@slidev/parser/fs";
|
|
8
8
|
import equal from "fast-deep-equal";
|
|
9
|
-
import {
|
|
9
|
+
import { execFile } from "node:child_process";
|
|
10
10
|
import os from "node:os";
|
|
11
11
|
import * as readline from "node:readline";
|
|
12
12
|
import { verifyConfig } from "@slidev/parser";
|
|
@@ -202,7 +202,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
|
|
|
202
202
|
name: "e",
|
|
203
203
|
fullname: "edit",
|
|
204
204
|
action() {
|
|
205
|
-
|
|
205
|
+
execFile(process.env.EDITOR || "code", [entry]);
|
|
206
206
|
}
|
|
207
207
|
},
|
|
208
208
|
{
|
|
@@ -288,15 +288,19 @@ cli.command("build [entry..]", "Build hostable SPA", (args) => exportOptions(com
|
|
|
288
288
|
describe: "exclude speaker notes from the built output"
|
|
289
289
|
}).option("router-mode", {
|
|
290
290
|
type: "string",
|
|
291
|
-
choices: [
|
|
292
|
-
|
|
291
|
+
choices: [
|
|
292
|
+
"hash",
|
|
293
|
+
"history",
|
|
294
|
+
"memory"
|
|
295
|
+
],
|
|
296
|
+
describe: "override routerMode in the built output (hash for subdirectory deploys like GitHub Pages; memory keeps the slide number out of the URL, for kiosk/follower decks)"
|
|
293
297
|
}).option("inspect", {
|
|
294
298
|
default: false,
|
|
295
299
|
type: "boolean",
|
|
296
300
|
describe: "enable the inspect plugin for debugging"
|
|
297
301
|
}).strict().help(), async (args) => {
|
|
298
302
|
const { entry, theme, base, download, out, inspect, "without-notes": withoutNotes, "router-mode": routerMode } = args;
|
|
299
|
-
const { build } = await import("./build-
|
|
303
|
+
const { build } = await import("./build-CsQUCdtJ.mjs");
|
|
300
304
|
for (const entryFile of entry) {
|
|
301
305
|
const options = await resolveOptions({
|
|
302
306
|
entry: entryFile,
|
|
@@ -324,6 +328,10 @@ cli.command("format [entry..]", "Format the markdown file", (args) => commonOpti
|
|
|
324
328
|
await parser.save(md);
|
|
325
329
|
}
|
|
326
330
|
});
|
|
331
|
+
cli.command("mcp [entry]", "Start an MCP (Model Context Protocol) server over stdio for AI agents to inspect and edit the slides", (args) => commonOptions(args).strict().help(), async ({ entry }) => {
|
|
332
|
+
const { startMcpStdioServer } = await import("./stdio-CjXw2-ks.mjs");
|
|
333
|
+
await startMcpStdioServer(await resolveEntry(entry));
|
|
334
|
+
});
|
|
327
335
|
cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
328
336
|
return command.command("eject", "Eject current theme into local file system", (args) => commonOptions(args).option("dir", {
|
|
329
337
|
type: "string",
|
|
@@ -361,7 +369,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
|
|
|
361
369
|
});
|
|
362
370
|
cli.command("export [entry..]", "Export slides to PDF", (args) => exportOptions(commonOptions(args)).strict().help(), async (args) => {
|
|
363
371
|
const { entry, theme } = args;
|
|
364
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
372
|
+
const { exportSlides, getExportOptions } = await import("./export-_6QaMWg2.mjs");
|
|
365
373
|
const candidatePort = await getPort(12445);
|
|
366
374
|
let warned = false;
|
|
367
375
|
for (const entryFile of entry) {
|
|
@@ -413,7 +421,7 @@ cli.command("export-notes [entry..]", "Export slide notes to PDF", (args) => arg
|
|
|
413
421
|
type: "number",
|
|
414
422
|
describe: "wait for the specified ms before exporting"
|
|
415
423
|
}).strict().help(), async ({ entry, output, timeout, wait }) => {
|
|
416
|
-
const { exportNotes } = await import("./export-
|
|
424
|
+
const { exportNotes } = await import("./export-_6QaMWg2.mjs");
|
|
417
425
|
const candidatePort = await getPort(12445);
|
|
418
426
|
for (const entryFile of entry) {
|
|
419
427
|
const options = await resolveOptions({ entry: entryFile }, "export");
|
|
@@ -539,6 +547,7 @@ function printInfo(options, port, base, remote, tunnelUrl, publicIp) {
|
|
|
539
547
|
if (options.utils.define.__SLIDEV_FEATURE_PRESENTER__) console.log(`${dim(" presenter mode ")} > ${blue(`${baseUrl}${presenterPath}`)}`);
|
|
540
548
|
console.log(`${dim(" slides overview ")} > ${blue(`${baseUrl}${overviewPath}`)}`);
|
|
541
549
|
if (options.utils.define.__SLIDEV_FEATURE_BROWSER_EXPORTER__) console.log(`${dim(" export slides")} > ${blue(`${baseUrl}/export/`)}`);
|
|
550
|
+
if (options.mode === "dev" && options.data.config.mcp !== false) console.log(`${dim(" mcp server (ai)")} > ${blue(`http://localhost:${bold(port)}/__mcp`)}`);
|
|
542
551
|
if (options.inspect) console.log(`${dim(" vite inspector")} > ${yellow(`${baseUrl}/__inspect/`)}`);
|
|
543
552
|
let lastRemoteUrl = "";
|
|
544
553
|
if (remote !== void 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getRoots } from "./resolver-
|
|
1
|
+
import { n as getRoots } from "./resolver-BBT539iz.mjs";
|
|
2
2
|
import path, { dirname, relative } from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
@@ -78,26 +78,29 @@ async function exportNotes({ port = 18724, base = "/", output = "notes", timeout
|
|
|
78
78
|
const progress = createSlidevProgress(true);
|
|
79
79
|
progress.start(1);
|
|
80
80
|
if (!output.endsWith(".pdf")) output = `${output}.pdf`;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
try {
|
|
82
|
+
await page.goto(`http://localhost:${port}${base}presenter/print`, {
|
|
83
|
+
waitUntil: "networkidle",
|
|
84
|
+
timeout
|
|
85
|
+
});
|
|
86
|
+
await page.waitForLoadState("networkidle");
|
|
87
|
+
await page.emulateMedia({ media: "screen" });
|
|
88
|
+
if (wait) await page.waitForTimeout(wait);
|
|
89
|
+
await page.pdf({
|
|
90
|
+
path: output,
|
|
91
|
+
margin: {
|
|
92
|
+
left: 0,
|
|
93
|
+
top: 0,
|
|
94
|
+
right: 0,
|
|
95
|
+
bottom: 0
|
|
96
|
+
},
|
|
97
|
+
printBackground: true,
|
|
98
|
+
preferCSSPageSize: true
|
|
99
|
+
});
|
|
100
|
+
} finally {
|
|
101
|
+
progress.stop();
|
|
102
|
+
await browser.close();
|
|
103
|
+
}
|
|
101
104
|
return output;
|
|
102
105
|
}
|
|
103
106
|
async function exportSlides({ port = 18724, total = 0, range, format = "pdf", output = "slides", slides, base = "/", timeout = 3e4, wait = 0, dark = false, routerMode = "history", width = 1920, height = 1080, withClicks = false, executablePath = void 0, withToc = false, perSlide = false, scale = 1, waitUntil, omitBackground = false }) {
|
|
@@ -113,13 +116,16 @@ async function exportSlides({ port = 18724, total = 0, range, format = "pdf", ou
|
|
|
113
116
|
})).newPage();
|
|
114
117
|
const progress = createSlidevProgress(!perSlide);
|
|
115
118
|
progress.start(pages.length);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
try {
|
|
120
|
+
if (format === "pdf") await genPagePdf();
|
|
121
|
+
else if (format === "png") await genPagePng(output);
|
|
122
|
+
else if (format === "md") await genPageMd();
|
|
123
|
+
else if (format === "pptx") await genPagePptx(await genPagePng(false));
|
|
124
|
+
else throw new Error(`[slidev] Unsupported exporting format "${format}"`);
|
|
125
|
+
} finally {
|
|
126
|
+
progress.stop();
|
|
127
|
+
await browser.close();
|
|
128
|
+
}
|
|
123
129
|
const relativeOutput = slash(relative(".", output));
|
|
124
130
|
return relativeOutput.startsWith(".") ? relativeOutput : `./${relativeOutput}`;
|
|
125
131
|
async function go(no, clicks) {
|
|
@@ -387,7 +393,7 @@ function getExportOptions(args, options, outFilename) {
|
|
|
387
393
|
wait: wait ?? 0,
|
|
388
394
|
waitUntil: waitUntil === "none" ? void 0 : waitUntil ?? "networkidle",
|
|
389
395
|
dark: dark || options.data.config.colorSchema === "dark",
|
|
390
|
-
routerMode: options.data.config.routerMode,
|
|
396
|
+
routerMode: options.data.config.routerMode === "memory" ? "history" : options.data.config.routerMode,
|
|
391
397
|
width: options.data.config.canvasWidth,
|
|
392
398
|
height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
|
|
393
399
|
withClicks: withClicks ?? format === "pptx",
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { InlineConfig, PluginOption } from "vite";
|
|
2
2
|
import * as parser from "@slidev/parser/fs";
|
|
3
3
|
import { ResolvedSlidevOptions, ResolvedSlidevUtils, SlidevEntryOptions, SlidevPluginOptions, SlidevServerOptions } from "@slidev/types";
|
|
4
|
-
|
|
5
4
|
//#region node/commands/serve.d.ts
|
|
6
5
|
declare function createServer(options: ResolvedSlidevOptions, viteConfig?: InlineConfig, serverOptions?: SlidevServerOptions): Promise<import("vite").ViteDevServer>;
|
|
7
6
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as createDataUtils, o as resolveOptions, r as ViteSlidevPlugin, s as parser, t as createServer } from "./serve-bAegrEOc.mjs";
|
|
2
2
|
export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };
|
|
@@ -229,12 +229,14 @@ async function getRoots(entry) {
|
|
|
229
229
|
isInstalledGlobally.value = slash(relative(userRoot, process.argv[1])).includes("/.pnpm/") || invocationNodeModules != null && slash(relative(userRoot, invocationNodeModules)).startsWith("..") || (await import("is-installed-globally")).default;
|
|
230
230
|
const clientRoot = await findPkgRoot("@slidev/client", cliRoot, true);
|
|
231
231
|
const closestPkgRoot = dirname(await findClosestPkgJsonPath(userRoot) || userRoot);
|
|
232
|
+
const userPkgJson = await getUserPkgJson(closestPkgRoot);
|
|
233
|
+
const userWorkspaceRoot = await searchForWorkspaceRoot(closestPkgRoot);
|
|
232
234
|
rootsInfo = {
|
|
233
235
|
cliRoot,
|
|
234
236
|
clientRoot,
|
|
235
237
|
userRoot,
|
|
236
|
-
userPkgJson
|
|
237
|
-
userWorkspaceRoot
|
|
238
|
+
userPkgJson,
|
|
239
|
+
userWorkspaceRoot
|
|
238
240
|
};
|
|
239
241
|
return rootsInfo;
|
|
240
242
|
}
|