@slidev/cli 52.19.1 → 52.20.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-DzftUF4M.mjs";
1
+ import { n as resolveViteConfigs } from "./serve-BRH-KJ3L.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-B_maVZXE.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-B_maVZXE.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-DzftUF4M.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-BRH-KJ3L.mjs";
3
3
  import process from "node:process";
4
4
  import path from "pathe";
5
5
  import fs from "node:fs/promises";
@@ -161,10 +161,12 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
161
161
  } });
162
162
  await server.listen();
163
163
  let tunnelUrl = "";
164
- if (tunnel) if (remote != null) tunnelUrl = await openTunnel(port);
165
- else console.log(yellow("\n --remote is required for tunneling, Cloudflare Quick Tunnel is not enabled.\n"));
164
+ if (tunnel) {
165
+ if (remote != null) tunnelUrl = await openTunnel(port);
166
+ else console.log(yellow("\n --remote is required for tunneling, Cloudflare Quick Tunnel is not enabled.\n"));
167
+ }
166
168
  let publicIp;
167
- if (remote) publicIp = await import("public-ip").then((r) => r.publicIpv4());
169
+ if (remote) publicIp = await resolvePublicIp();
168
170
  lastRemoteUrl = printInfo(options, port, base, remote, tunnelUrl, publicIp);
169
171
  if (open) await openSlidevInBrowser();
170
172
  return options;
@@ -177,6 +179,13 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
177
179
  console.log(yellow(`\n Could not open the browser automatically. Please open ${url} in your browser.\n`));
178
180
  }
179
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
+ }
180
189
  async function openTunnel(port) {
181
190
  const { startTunnel } = await import("untun");
182
191
  return await (await startTunnel({
@@ -302,7 +311,7 @@ cli.command("build [entry..]", "Build hostable SPA", (args) => exportOptions(com
302
311
  describe: "enable the inspect plugin for debugging"
303
312
  }).strict().help(), async (args) => {
304
313
  const { entry, theme, base, download, out, inspect, "without-notes": withoutNotes, "router-mode": routerMode } = args;
305
- const { build } = await import("./build-CnBLrEp0.mjs");
314
+ const { build } = await import("./build-BrwsAFCa.mjs");
306
315
  for (const entryFile of entry) {
307
316
  const options = await resolveOptions({
308
317
  entry: entryFile,
@@ -331,7 +340,7 @@ cli.command("format [entry..]", "Format the markdown file", (args) => commonOpti
331
340
  }
332
341
  });
333
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 }) => {
334
- const { startMcpStdioServer } = await import("./stdio-BrKVwy-M.mjs");
343
+ const { startMcpStdioServer } = await import("./stdio-B5Rvh_az.mjs");
335
344
  await startMcpStdioServer(await resolveEntry(entry));
336
345
  });
337
346
  cli.command("theme [subcommand]", "Theme related operations", (command) => {
@@ -371,7 +380,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
371
380
  });
372
381
  cli.command("export [entry..]", "Export slides to PDF", (args) => exportOptions(commonOptions(args)).strict().help(), async (args) => {
373
382
  const { entry, theme } = args;
374
- const { exportSlides, getExportOptions } = await import("./export-B_maVZXE.mjs");
383
+ const { exportSlides, getExportOptions } = await import("./export-LauAJGMx.mjs");
375
384
  const candidatePort = await getPort(12445);
376
385
  let warned = false;
377
386
  for (const entryFile of entry) {
@@ -423,7 +432,7 @@ cli.command("export-notes [entry..]", "Export slide notes to PDF", (args) => arg
423
432
  type: "number",
424
433
  describe: "wait for the specified ms before exporting"
425
434
  }).strict().help(), async ({ entry, output, timeout, wait }) => {
426
- const { exportNotes } = await import("./export-B_maVZXE.mjs");
435
+ const { exportNotes } = await import("./export-LauAJGMx.mjs");
427
436
  const candidatePort = await getPort(12445);
428
437
  for (const entryFile of entry) {
429
438
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -476,6 +485,7 @@ function exportOptions(args) {
476
485
  "pdf",
477
486
  "png",
478
487
  "pptx",
488
+ "pptx-editable",
479
489
  "md"
480
490
  ],
481
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,13 +350,30 @@ 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);
355
371
  if (titleSlide?.frontmatter?.info) pdf.setSubject(titleSlide.frontmatter.info);
356
372
  if (titleSlide?.frontmatter?.author) pdf.setAuthor(titleSlide.frontmatter.author);
357
- if (titleSlide?.frontmatter?.keywords) if (Array.isArray(titleSlide?.frontmatter?.keywords)) pdf.setKeywords(titleSlide?.frontmatter?.keywords);
358
- else pdf.setKeywords(titleSlide?.frontmatter?.keywords.split(","));
373
+ if (titleSlide?.frontmatter?.keywords) {
374
+ if (Array.isArray(titleSlide?.frontmatter?.keywords)) pdf.setKeywords(titleSlide?.frontmatter?.keywords);
375
+ else pdf.setKeywords(titleSlide?.frontmatter?.keywords.split(","));
376
+ }
359
377
  }
360
378
  async function addTocToPdf(pdf) {
361
379
  const outlinePdf = outlinePdfFactory(pdfLib);
@@ -396,7 +414,7 @@ function getExportOptions(args, options, outFilename) {
396
414
  routerMode: options.data.config.routerMode === "memory" ? "history" : options.data.config.routerMode,
397
415
  width: options.data.config.canvasWidth,
398
416
  height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
399
- withClicks: withClicks ?? format === "pptx",
417
+ withClicks: withClicks ?? !!format?.startsWith("pptx"),
400
418
  executablePath,
401
419
  withToc: withToc || false,
402
420
  perSlide: perSlide || false,
package/dist/index.d.mts CHANGED
@@ -2,13 +2,13 @@ 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
4
  //#region node/commands/serve.d.ts
5
- declare function createServer(options: ResolvedSlidevOptions, viteConfig?: InlineConfig, serverOptions?: SlidevServerOptions): Promise<import("vite").ViteDevServer>;
5
+ export declare function createServer(options: ResolvedSlidevOptions, viteConfig?: InlineConfig, serverOptions?: SlidevServerOptions): Promise<import("vite").ViteDevServer>;
6
6
  //#endregion
7
7
  //#region node/options.d.ts
8
- declare function resolveOptions(entryOptions: SlidevEntryOptions, mode: ResolvedSlidevOptions['mode']): Promise<ResolvedSlidevOptions>;
9
- declare function createDataUtils(resolved: Omit<ResolvedSlidevOptions, 'utils'>): Promise<ResolvedSlidevUtils>;
8
+ export declare function resolveOptions(entryOptions: SlidevEntryOptions, mode: ResolvedSlidevOptions['mode']): Promise<ResolvedSlidevOptions>;
9
+ export declare function createDataUtils(resolved: Omit<ResolvedSlidevOptions, 'utils'>): Promise<ResolvedSlidevUtils>;
10
10
  //#endregion
11
11
  //#region node/vite/index.d.ts
12
- declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions?: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<PluginOption[]>;
12
+ export declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions?: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<PluginOption[]>;
13
13
  //#endregion
14
- export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };
14
+ export { parser };
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-DzftUF4M.mjs";
1
+ import { a as createDataUtils, o as resolveOptions, r as ViteSlidevPlugin, s as parser, t as createServer } from "./serve-BRH-KJ3L.mjs";
2
2
  export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };