@slidev/cli 52.18.0 → 52.19.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.
@@ -1,4 +1,4 @@
1
- import { n as resolveViteConfigs } from "./serve-1daxO8VB.mjs";
1
+ import { n as resolveViteConfigs } from "./serve-CY7V3bOt.mjs";
2
2
  import { join, resolve } from "pathe";
3
3
  import { build as build$1 } from "vite";
4
4
  import { existsSync } from "node:fs";
@@ -10,7 +10,7 @@ import sirv from "sirv";
10
10
  async function build(options, viteConfig = {}, args) {
11
11
  const indexHtmlId = resolve(options.userRoot, "index.html");
12
12
  let config = void 0;
13
- await build$1(await resolveViteConfigs(options, {
13
+ const inlineConfig = await resolveViteConfigs(options, {
14
14
  plugins: [{
15
15
  name: "slidev:build",
16
16
  configResolved(_config) {
@@ -34,7 +34,8 @@ async function build(options, viteConfig = {}, args) {
34
34
  chunkSizeWarningLimit: 2e3,
35
35
  rollupOptions: { input: { index: indexHtmlId } }
36
36
  }
37
- }, viteConfig, "build"));
37
+ }, viteConfig, "build");
38
+ await build$1(inlineConfig);
38
39
  const outDir = resolve(options.userRoot, config.build.outDir);
39
40
  if (options.data.config.seoMeta?.ogImage === "auto" || options.data.config.seoMeta?.ogImage?.startsWith(".")) {
40
41
  const filename = options.data.config.seoMeta?.ogImage === "auto" ? "og-image.png" : options.data.config.seoMeta.ogImage;
package/dist/cli.d.mts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as isInstalledGlobally, o as resolveEntry } from "./resolver-BIhhHpe7.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-1daxO8VB.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-CY7V3bOt.mjs";
3
3
  import process from "node:process";
4
4
  import path from "pathe";
5
5
  import fs from "node:fs/promises";
@@ -126,7 +126,8 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
126
126
  port,
127
127
  strictPort: true,
128
128
  host,
129
- force
129
+ force,
130
+ ...tunnel && remote != null ? { allowedHosts: [".trycloudflare.com"] } : {}
130
131
  },
131
132
  optimizeDeps: { force },
132
133
  logLevel: log,
@@ -202,7 +203,8 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
202
203
  name: "e",
203
204
  fullname: "edit",
204
205
  action() {
205
- execFile(process.env.EDITOR || "code", [entry]);
206
+ const editor = process.env.EDITOR || "code";
207
+ execFile(editor, [entry]);
206
208
  }
207
209
  },
208
210
  {
@@ -300,7 +302,7 @@ cli.command("build [entry..]", "Build hostable SPA", (args) => exportOptions(com
300
302
  describe: "enable the inspect plugin for debugging"
301
303
  }).strict().help(), async (args) => {
302
304
  const { entry, theme, base, download, out, inspect, "without-notes": withoutNotes, "router-mode": routerMode } = args;
303
- const { build } = await import("./build-DJdJOe3Q.mjs");
305
+ const { build } = await import("./build-rtQk8gSn.mjs");
304
306
  for (const entryFile of entry) {
305
307
  const options = await resolveOptions({
306
308
  entry: entryFile,
@@ -329,7 +331,7 @@ cli.command("format [entry..]", "Format the markdown file", (args) => commonOpti
329
331
  }
330
332
  });
331
333
  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-BPU_DuqN.mjs");
334
+ const { startMcpStdioServer } = await import("./stdio-TyXSpxhg.mjs");
333
335
  await startMcpStdioServer(await resolveEntry(entry));
334
336
  });
335
337
  cli.command("theme [subcommand]", "Theme related operations", (command) => {
@@ -551,7 +553,7 @@ function printInfo(options, port, base, remote, tunnelUrl, publicIp) {
551
553
  if (options.inspect) console.log(`${dim(" vite inspector")} > ${yellow(`${baseUrl}/__inspect/`)}`);
552
554
  let lastRemoteUrl = "";
553
555
  if (remote !== void 0) {
554
- Object.values(os.networkInterfaces()).forEach((v) => (v || []).filter((details) => String(details.family).slice(-1) === "4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
556
+ Object.values(os.networkInterfaces()).forEach((v) => (v || []).filter((details) => String(details.family).endsWith("4") && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
555
557
  lastRemoteUrl = `http://${address}:${portAndBase}${entryPath}`;
556
558
  console.log(`${dim(" remote control ")} > ${blue(lastRemoteUrl)}`);
557
559
  }));
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as createDataUtils, o as resolveOptions, r as ViteSlidevPlugin, s as parser, t as createServer } from "./serve-1daxO8VB.mjs";
1
+ import { a as createDataUtils, o as resolveOptions, r as ViteSlidevPlugin, s as parser, t as createServer } from "./serve-CY7V3bOt.mjs";
2
2
  export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };
@@ -40,8 +40,8 @@ import lz from "lz-string";
40
40
  import { encode } from "plantuml-encoder";
41
41
  import { SourceMapConsumer } from "source-map-js";
42
42
  import { fromAsyncCodeToHtml } from "@shikijs/markdown-it/async";
43
- import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
44
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
43
+ import { NodeStreamableHTTPServerTransport } from "@modelcontextprotocol/node";
44
+ import { McpServer } from "@modelcontextprotocol/server";
45
45
  import { z } from "zod";
46
46
  import ServerRef from "vite-plugin-vue-server-ref";
47
47
  import UnoCSS from "unocss/vite";
@@ -712,7 +712,7 @@ function createLayoutWrapperPlugin({ data, utils }) {
712
712
  }
713
713
  //#endregion
714
714
  //#region package.json
715
- var version = "52.18.0";
715
+ var version = "52.19.0";
716
716
  //#endregion
717
717
  //#region node/integrations/addons.ts
718
718
  async function resolveAddons(addonsInConfig) {
@@ -2022,7 +2022,7 @@ function todoify(token, options) {
2022
2022
  }
2023
2023
  function generateIdForToken(token) {
2024
2024
  if (token.map) return `task-item-${token.map[0]}`;
2025
- else return `task-item-${Math.ceil(Math.random() * (1e4 * 1e3) - 1e3)}`;
2025
+ else return `task-item-${Math.ceil(Math.random() * 1e7 - 1e3)}`;
2026
2026
  }
2027
2027
  function createCheckboxToken(token, enabled, id) {
2028
2028
  const checkbox = new Token("taskListItemCheckbox", "", 0);
@@ -2387,7 +2387,8 @@ function MarkdownItVDrag(md, markdownTransformMap) {
2387
2387
  const sourceMap = s.generateMap();
2388
2388
  smc = new SourceMapConsumer({
2389
2389
  ...sourceMap,
2390
- version: sourceMap.version.toString()
2390
+ version: sourceMap.version.toString(),
2391
+ sourcesContent: sourceMap.sourcesContent?.map((content) => content ?? "")
2391
2392
  });
2392
2393
  sourceMapConsumers.set(s, smc);
2393
2394
  return smc;
@@ -2770,7 +2771,7 @@ function slideSummary(slide) {
2770
2771
  };
2771
2772
  }
2772
2773
  const noSchema = z.number().int().min(1).describe("Slide number (1-based, as displayed in the presentation)");
2773
- const frontmatterSchema = z.record(z.any()).optional().describe("Slide frontmatter (YAML headmatter of the slide) as an object, e.g. { \"layout\": \"two-cols\" }");
2774
+ const frontmatterSchema = z.record(z.string(), z.any()).optional().describe("Slide frontmatter (YAML headmatter of the slide) as an object, e.g. { \"layout\": \"two-cols\" }");
2774
2775
  /**
2775
2776
  * Create the Slidev MCP server exposing tools for agents to inspect, edit,
2776
2777
  * and (with a running dev server) navigate a slides deck.
@@ -2819,7 +2820,7 @@ function createSlidevMcpServer(ctx) {
2819
2820
  server.registerTool("slidev-get-slide", {
2820
2821
  title: "Get slide",
2821
2822
  description: "Get the full source of one slide: frontmatter, Markdown content, and speaker note.",
2822
- inputSchema: { no: noSchema },
2823
+ inputSchema: z.object({ no: noSchema }),
2823
2824
  annotations: { readOnlyHint: true }
2824
2825
  }, async ({ no }) => {
2825
2826
  const slide = resolveSlide(await ctx.getData(), no);
@@ -2834,12 +2835,12 @@ function createSlidevMcpServer(ctx) {
2834
2835
  server.registerTool("slidev-update-slide", {
2835
2836
  title: "Update slide",
2836
2837
  description: "Update the content, speaker note, and/or frontmatter of a slide. Only the provided fields are changed. Pass an empty string to clear the content or note. In `frontmatter`, only the given keys are patched; pass `null` as a value to delete that key.",
2837
- inputSchema: {
2838
+ inputSchema: z.object({
2838
2839
  no: noSchema,
2839
2840
  content: z.string().optional().describe("New Markdown content of the slide (without frontmatter and note)"),
2840
2841
  note: z.string().optional().describe("New speaker note (Markdown, stored as a trailing HTML comment)"),
2841
2842
  frontmatter: frontmatterSchema
2842
- }
2843
+ })
2843
2844
  }, async ({ no, content, note, frontmatter }) => {
2844
2845
  if (content == null && note == null && frontmatter == null) throw new Error("Nothing to update: provide at least one of `content`, `note`, or `frontmatter`.");
2845
2846
  const { slide } = await applySlidePatch(await ctx.getData(), no, {
@@ -2852,12 +2853,12 @@ function createSlidevMcpServer(ctx) {
2852
2853
  server.registerTool("slidev-insert-slide", {
2853
2854
  title: "Insert slide",
2854
2855
  description: "Insert a new slide after an existing slide (into the same markdown file). To add a slide at the very end, pass the last slide number.",
2855
- inputSchema: {
2856
+ inputSchema: z.object({
2856
2857
  after: z.number().int().min(1).describe("Slide number (1-based) after which the new slide is inserted"),
2857
2858
  content: z.string().describe("Markdown content of the new slide"),
2858
2859
  frontmatter: frontmatterSchema,
2859
2860
  note: z.string().optional().describe("Speaker note of the new slide")
2860
- }
2861
+ })
2861
2862
  }, async ({ after, content, frontmatter, note }) => {
2862
2863
  const { filepath } = await insertSlide(await ctx.getData(), {
2863
2864
  after,
@@ -2870,7 +2871,7 @@ function createSlidevMcpServer(ctx) {
2870
2871
  server.registerTool("slidev-remove-slide", {
2871
2872
  title: "Remove slide",
2872
2873
  description: "Remove a slide from the deck (deletes it from its source markdown file).",
2873
- inputSchema: { no: noSchema },
2874
+ inputSchema: z.object({ no: noSchema }),
2874
2875
  annotations: { destructiveHint: true }
2875
2876
  }, async ({ no }) => {
2876
2877
  const { removed, filepath } = await removeSlide(await ctx.getData(), no);
@@ -2879,11 +2880,11 @@ function createSlidevMcpServer(ctx) {
2879
2880
  server.registerTool("slidev-move-slide", {
2880
2881
  title: "Move slide",
2881
2882
  description: "Move a slide before or after another slide to reorder the deck. Both slides must be in the same markdown file. To swap two adjacent slides, move one after the other.",
2882
- inputSchema: {
2883
+ inputSchema: z.object({
2883
2884
  from: z.number().int().min(1).describe("Slide number (1-based) of the slide to move"),
2884
2885
  before: z.number().int().min(1).optional().describe("Move the slide right before this slide number"),
2885
2886
  after: z.number().int().min(1).optional().describe("Move the slide right after this slide number")
2886
- }
2887
+ })
2887
2888
  }, async ({ from, before, after }) => {
2888
2889
  const { filepath } = await moveSlide(await ctx.getData(), {
2889
2890
  from,
@@ -2897,10 +2898,10 @@ function createSlidevMcpServer(ctx) {
2897
2898
  server.registerTool("slidev-goto-slide", {
2898
2899
  title: "Go to slide",
2899
2900
  description: "Navigate the live presentation (all connected browsers) to a given slide, e.g. to visually verify a slide after editing it.",
2900
- inputSchema: {
2901
+ inputSchema: z.object({
2901
2902
  no: noSchema,
2902
2903
  clicks: z.number().int().min(0).optional().describe("Click animation step to reveal (defaults to 0)")
2903
- },
2904
+ }),
2904
2905
  annotations: { idempotentHint: true }
2905
2906
  }, async ({ no, clicks }) => {
2906
2907
  resolveSlide(await ctx.getData(), no);
@@ -2919,7 +2920,8 @@ function createSlidevMcpServer(ctx) {
2919
2920
  */
2920
2921
  function isSafeDrawingKey(dir, key) {
2921
2922
  if (!/^\d+$/.test(key)) return false;
2922
- const rel = relative(dir, join(dir, `${key}.svg`));
2923
+ const target = join(dir, `${key}.svg`);
2924
+ const rel = relative(dir, target);
2923
2925
  return !rel.startsWith("..") && !isAbsolute(rel);
2924
2926
  }
2925
2927
  function resolveDrawingsDir(options) {
@@ -3061,7 +3063,7 @@ function createMcpPlugin(options) {
3061
3063
  }
3062
3064
  try {
3063
3065
  const mcp = createSlidevMcpServer(ctx);
3064
- const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: void 0 });
3066
+ const transport = new NodeStreamableHTTPServerTransport({ sessionIdGenerator: void 0 });
3065
3067
  res.on("close", () => {
3066
3068
  transport.close();
3067
3069
  mcp.close();
@@ -3209,7 +3211,7 @@ async function createPWAPlugin(options) {
3209
3211
  injectRegister: null,
3210
3212
  base,
3211
3213
  workbox: {
3212
- maximumFileSizeToCacheInBytes: 100 * 1024 * 1024,
3214
+ maximumFileSizeToCacheInBytes: 104857600,
3213
3215
  globPatterns: ["**/*.{js,css,html,woff,woff2,ttf,png,jpg,jpeg,svg,gif,webp,avif,ico,mp4,webm,ogv,mov,m4v,mp3,wav,ogg,oga,m4a,aac,flac,opus,weba}"],
3214
3216
  navigateFallback: "index.html",
3215
3217
  navigateFallbackDenylist: [/^\/(presenter|notes|overview|print|export)/]
@@ -3302,7 +3304,7 @@ async function setupUnocss({ clientRoot, roots, data, utils }) {
3302
3304
  return "default" in loaded ? loaded.default : loaded;
3303
3305
  });
3304
3306
  }
3305
- const config = mergeConfigs([
3307
+ const configs = [
3306
3308
  {
3307
3309
  presets: [presetIcons({
3308
3310
  collectionsNodeResolvePath: utils.iconsResolvePath,
@@ -3312,7 +3314,8 @@ async function setupUnocss({ clientRoot, roots, data, utils }) {
3312
3314
  },
3313
3315
  (await loadModule(resolve(clientRoot, "uno.config.ts"))).default,
3314
3316
  ...await loadSetups(roots, "unocss.ts", [], loadFileConfigs)
3315
- ].filter(Boolean));
3317
+ ].filter(Boolean);
3318
+ const config = mergeConfigs(configs);
3316
3319
  config.theme ||= {};
3317
3320
  config.theme.fontFamily ||= {};
3318
3321
  config.theme.fontFamily.sans ||= data.config.fonts.sans.join(",");
@@ -3450,7 +3453,8 @@ async function resolveViteConfigs(options, baseConfig, overrideConfigs, command,
3450
3453
  //#region node/commands/serve.ts
3451
3454
  async function createServer$1(options, viteConfig = {}, serverOptions) {
3452
3455
  process.env.EDITOR = process.env.EDITOR || "code";
3453
- return await createServer(await resolveViteConfigs(options, { optimizeDeps: { entries: [join(options.clientRoot, "main.ts")] } }, viteConfig, "serve", serverOptions));
3456
+ const inlineConfig = await resolveViteConfigs(options, { optimizeDeps: { entries: [join(options.clientRoot, "main.ts")] } }, viteConfig, "serve", serverOptions);
3457
+ return await createServer(inlineConfig);
3454
3458
  }
3455
3459
  //#endregion
3456
3460
  export { createDataUtils as a, getThemeMeta as c, loadSetups as d, updateFrontmatterPatch as f, createSlidevMcpServer as i, resolveTheme as l, resolveViteConfigs as n, resolveOptions as o, ViteSlidevPlugin as r, parser as s, createServer$1 as t, version as u };
@@ -1,6 +1,6 @@
1
1
  import { n as getRoots } from "./resolver-BIhhHpe7.mjs";
2
- import { i as createSlidevMcpServer, s as parser, u as version } from "./serve-1daxO8VB.mjs";
3
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
+ import { i as createSlidevMcpServer, s as parser, u as version } from "./serve-CY7V3bOt.mjs";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
4
4
  //#region node/mcp/stdio.ts
5
5
  /**
6
6
  * Start a Slidev MCP server over stdio, operating on the markdown files
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
3
  "type": "module",
4
- "version": "52.18.0",
4
+ "version": "52.19.0",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -47,21 +47,22 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
- "@antfu/ni": "^30.2.0",
50
+ "@antfu/ni": "^30.3.0",
51
51
  "@antfu/utils": "^9.3.0",
52
52
  "@comark/markdown-it": "^0.3.4",
53
- "@iconify-json/carbon": "^1.2.24",
53
+ "@iconify-json/carbon": "^1.2.25",
54
54
  "@iconify-json/ph": "^1.2.2",
55
55
  "@iconify-json/svg-spinners": "^1.2.4",
56
56
  "@lillallol/outline-pdf": "^4.0.0",
57
- "@modelcontextprotocol/sdk": "^1.29.0",
58
- "@shikijs/magic-move": "^4.3.1",
59
- "@shikijs/markdown-it": "^4.3.1",
60
- "@shikijs/twoslash": "^4.3.1",
61
- "@shikijs/vitepress-twoslash": "^4.3.1",
57
+ "@modelcontextprotocol/node": "^2.0.0",
58
+ "@modelcontextprotocol/server": "^2.0.0",
59
+ "@shikijs/magic-move": "^4.4.1",
60
+ "@shikijs/markdown-it": "^4.4.1",
61
+ "@shikijs/twoslash": "^4.4.1",
62
+ "@shikijs/vitepress-twoslash": "^4.4.1",
62
63
  "@unocss/extractor-mdc": "^66.7.5",
63
64
  "@unocss/reset": "^66.7.5",
64
- "@vitejs/plugin-vue": "^6.0.7",
65
+ "@vitejs/plugin-vue": "^6.0.8",
65
66
  "@vitejs/plugin-vue-jsx": "^5.1.6",
66
67
  "ansis": "^4.3.1",
67
68
  "chokidar": "^5.0.0",
@@ -74,53 +75,53 @@
74
75
  "htmlparser2": "^12.0.0",
75
76
  "is-installed-globally": "^1.0.0",
76
77
  "jiti": "^2.7.0",
77
- "katex": "^0.17.0",
78
+ "katex": "^0.18.1",
78
79
  "local-pkg": "^1.2.1",
79
80
  "lz-string": "^1.5.0",
80
- "magic-string": "^0.30.21",
81
- "magic-string-stack": "^1.1.0",
81
+ "magic-string": "^1.1.0",
82
+ "magic-string-stack": "^2.0.0",
82
83
  "markdown-exit": "^1.1.0-beta.2",
83
84
  "markdown-it-footnote": "^4.0.0",
84
85
  "markdown-it-github-alerts": "^1.0.1",
85
86
  "mlly": "^1.8.2",
86
- "monaco-editor": "^0.55.1",
87
- "obug": "^2.1.3",
87
+ "monaco-editor": "^0.56.0",
88
+ "obug": "^2.1.4",
88
89
  "open": "^11.0.0",
89
90
  "pathe": "^2.0.3",
90
91
  "pdf-lib": "^1.17.1",
91
92
  "picomatch": "^4.0.5",
92
93
  "plantuml-encoder": "^1.4.0",
93
- "postcss-nested": "^7.0.2",
94
+ "postcss-nested": "^8.0.0",
94
95
  "pptxgenjs": "^4.0.1",
95
96
  "prompts": "^2.4.2",
96
97
  "public-ip": "^8.0.0",
97
98
  "resolve-from": "^5.0.0",
98
99
  "resolve-global": "^2.0.0",
99
100
  "semver": "^7.8.5",
100
- "shiki": "^4.3.1",
101
+ "shiki": "^4.4.1",
101
102
  "sirv": "^3.0.2",
102
103
  "source-map-js": "^1.2.1",
103
104
  "typescript": "^6.0.3",
104
- "unhead": "^3.1.7",
105
+ "unhead": "^3.2.3",
105
106
  "unocss": "^66.7.5",
106
107
  "unplugin-icons": "^23.0.1",
107
108
  "unplugin-vue-components": "^32.1.0",
108
109
  "unplugin-vue-markdown": "^32.0.0",
109
- "untun": "^0.1.3",
110
+ "untun": "^0.2.2",
110
111
  "uqr": "^0.1.3",
111
- "vite": "^8.1.3",
112
- "vite-plugin-inspect": "^11.4.1",
112
+ "vite": "^8.2.0",
113
+ "vite-plugin-inspect": "^12.0.2",
113
114
  "vite-plugin-remote-assets": "^2.1.0",
114
115
  "vite-plugin-static-copy": "^4.1.1",
115
116
  "vite-plugin-vue-server-ref": "^1.0.0",
116
117
  "vitefu": "^1.1.3",
117
- "vue": "^3.5.39",
118
+ "vue": "^3.5.40",
118
119
  "yaml": "^2.9.0",
119
- "yargs": "^18.0.0",
120
- "zod": "^3.25.76",
121
- "@slidev/client": "52.18.0",
122
- "@slidev/types": "52.18.0",
123
- "@slidev/parser": "52.18.0"
120
+ "yargs": "^18.1.0",
121
+ "zod": "^4.4.3",
122
+ "@slidev/client": "52.19.0",
123
+ "@slidev/parser": "52.19.0",
124
+ "@slidev/types": "52.19.0"
124
125
  },
125
126
  "devDependencies": {
126
127
  "@hedgedoc/markdown-it-plugins": "^2.1.4",