@slidev/cli 52.19.2 → 52.20.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.
@@ -1,4 +1,4 @@
1
- import { n as resolveViteConfigs } from "./serve-CLfxiJWo.mjs";
1
+ import { n as resolveViteConfigs } from "./serve-Be4VBJJX.mjs";
2
2
  import { join, resolve } from "pathe";
3
3
  import { build as build$1 } from "vite";
4
4
  import { existsSync } from "node:fs";
@@ -52,7 +52,7 @@ async function build(options, viteConfig = {}, args) {
52
52
  dev: true
53
53
  }));
54
54
  server.listen(port);
55
- const { exportSlides } = await import("./export-DbxUfS31.mjs");
55
+ const { exportSlides } = await import("./export-LauAJGMx.mjs");
56
56
  const tempDir = resolve(outDir, "temp");
57
57
  await fs$1.mkdir(tempDir, { recursive: true });
58
58
  await exportSlides({
@@ -93,7 +93,7 @@ async function build(options, viteConfig = {}, args) {
93
93
  "true",
94
94
  "auto"
95
95
  ].includes(options.data.config.download)) {
96
- const { exportSlides, getExportOptions } = await import("./export-DbxUfS31.mjs");
96
+ const { exportSlides, getExportOptions } = await import("./export-LauAJGMx.mjs");
97
97
  const port = 12445;
98
98
  const app = connect();
99
99
  const server = http.createServer(app);
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-CLfxiJWo.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-Be4VBJJX.mjs";
3
3
  import process from "node:process";
4
4
  import path from "pathe";
5
5
  import fs from "node:fs/promises";
@@ -166,9 +166,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
166
166
  else console.log(yellow("\n --remote is required for tunneling, Cloudflare Quick Tunnel is not enabled.\n"));
167
167
  }
168
168
  let publicIp;
169
- if (remote) try {
170
- publicIp = await import("public-ip").then((r) => r.publicIpv4());
171
- } catch {}
169
+ if (remote) publicIp = await resolvePublicIp();
172
170
  lastRemoteUrl = printInfo(options, port, base, remote, tunnelUrl, publicIp);
173
171
  if (open) await openSlidevInBrowser();
174
172
  return options;
@@ -181,6 +179,13 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
181
179
  console.log(yellow(`\n Could not open the browser automatically. Please open ${url} in your browser.\n`));
182
180
  }
183
181
  }
182
+ async function resolvePublicIp() {
183
+ try {
184
+ return await import("public-ip").then((r) => r.publicIpv4());
185
+ } catch {
186
+ console.log(yellow("\n Could not determine the public IP address.\n"));
187
+ }
188
+ }
184
189
  async function openTunnel(port) {
185
190
  const { startTunnel } = await import("untun");
186
191
  return await (await startTunnel({
@@ -231,10 +236,8 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
231
236
  const code = r.renderUnicodeCompact(lastRemoteUrl);
232
237
  console.log(`\n${dim(" QR Code for remote control: ")}\n ${blue(lastRemoteUrl)}\n`);
233
238
  console.log(code.split("\n").map((i) => ` ${i}`).join("\n"));
234
- try {
235
- const publicIp = await import("public-ip").then((r) => r.publicIpv4());
236
- if (publicIp) console.log(`\n${dim(" Public IP: ")} ${blue(publicIp)}\n`);
237
- } catch {}
239
+ const publicIp = await import("public-ip").then((r) => r.publicIpv4());
240
+ if (publicIp) console.log(`\n${dim(" Public IP: ")} ${blue(publicIp)}\n`);
238
241
  });
239
242
  }
240
243
  }
@@ -308,7 +311,7 @@ cli.command("build [entry..]", "Build hostable SPA", (args) => exportOptions(com
308
311
  describe: "enable the inspect plugin for debugging"
309
312
  }).strict().help(), async (args) => {
310
313
  const { entry, theme, base, download, out, inspect, "without-notes": withoutNotes, "router-mode": routerMode } = args;
311
- const { build } = await import("./build-D2W5VZjC.mjs");
314
+ const { build } = await import("./build-BUQLxoIx.mjs");
312
315
  for (const entryFile of entry) {
313
316
  const options = await resolveOptions({
314
317
  entry: entryFile,
@@ -337,7 +340,7 @@ cli.command("format [entry..]", "Format the markdown file", (args) => commonOpti
337
340
  }
338
341
  });
339
342
  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 }) => {
340
- const { startMcpStdioServer } = await import("./stdio-SMQ1-gi9.mjs");
343
+ const { startMcpStdioServer } = await import("./stdio-SXW6hFKc.mjs");
341
344
  await startMcpStdioServer(await resolveEntry(entry));
342
345
  });
343
346
  cli.command("theme [subcommand]", "Theme related operations", (command) => {
@@ -377,7 +380,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
377
380
  });
378
381
  cli.command("export [entry..]", "Export slides to PDF", (args) => exportOptions(commonOptions(args)).strict().help(), async (args) => {
379
382
  const { entry, theme } = args;
380
- const { exportSlides, getExportOptions } = await import("./export-DbxUfS31.mjs");
383
+ const { exportSlides, getExportOptions } = await import("./export-LauAJGMx.mjs");
381
384
  const candidatePort = await getPort(12445);
382
385
  let warned = false;
383
386
  for (const entryFile of entry) {
@@ -429,7 +432,7 @@ cli.command("export-notes [entry..]", "Export slide notes to PDF", (args) => arg
429
432
  type: "number",
430
433
  describe: "wait for the specified ms before exporting"
431
434
  }).strict().help(), async ({ entry, output, timeout, wait }) => {
432
- const { exportNotes } = await import("./export-DbxUfS31.mjs");
435
+ const { exportNotes } = await import("./export-LauAJGMx.mjs");
433
436
  const candidatePort = await getPort(12445);
434
437
  for (const entryFile of entry) {
435
438
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -482,6 +485,7 @@ function exportOptions(args) {
482
485
  "pdf",
483
486
  "png",
484
487
  "pptx",
488
+ "pptx-editable",
485
489
  "md"
486
490
  ],
487
491
  describe: "output format"
@@ -121,6 +121,7 @@ async function exportSlides({ port = 18724, total = 0, range, format = "pdf", ou
121
121
  else if (format === "png") await genPagePng(output);
122
122
  else if (format === "md") await genPageMd();
123
123
  else if (format === "pptx") await genPagePptx(await genPagePng(false));
124
+ else if (format === "pptx-editable") await genPagePptxEditable();
124
125
  else throw new Error(`[slidev] Unsupported exporting format "${format}"`);
125
126
  } finally {
126
127
  progress.stop();
@@ -349,6 +350,21 @@ async function exportSlides({ port = 18724, total = 0, range, format = "pdf", ou
349
350
  if (!output.endsWith(".pptx")) output = `${output}.pptx`;
350
351
  await fs.writeFile(output, buffer);
351
352
  }
353
+ async function genPagePptxEditable() {
354
+ if (perSlide) throw new Error("[slidev] `--per-slide` is not supported with `--format pptx-editable`");
355
+ const { exportPptxEditable, reportEditableExport } = await import("./pptx-D2UE590V.mjs");
356
+ const result = await exportPptxEditable({
357
+ page,
358
+ slides,
359
+ width,
360
+ height,
361
+ pages,
362
+ go
363
+ }, output);
364
+ output = result.output;
365
+ progress.stop();
366
+ reportEditableExport(result);
367
+ }
352
368
  function addPdfMetadata(pdf) {
353
369
  const titleSlide = slides[0];
354
370
  if (titleSlide?.title) pdf.setTitle(titleSlide.title);
@@ -398,7 +414,7 @@ function getExportOptions(args, options, outFilename) {
398
414
  routerMode: options.data.config.routerMode === "memory" ? "history" : options.data.config.routerMode,
399
415
  width: options.data.config.canvasWidth,
400
416
  height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
401
- withClicks: withClicks ?? format === "pptx",
417
+ withClicks: withClicks ?? !!format?.startsWith("pptx"),
402
418
  executablePath,
403
419
  withToc: withToc || false,
404
420
  perSlide: perSlide || false,
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-CLfxiJWo.mjs";
1
+ import { a as createDataUtils, o as resolveOptions, r as ViteSlidevPlugin, s as parser, t as createServer } from "./serve-Be4VBJJX.mjs";
2
2
  export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };