@slidev/cli 0.42.5 → 0.42.7

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/dist/cli.d.mts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/cli.js CHANGED
@@ -9,24 +9,25 @@
9
9
 
10
10
 
11
11
 
12
- var _chunk35XQHQN5js = require('./chunk-35XQHQN5.js');
12
+ var _chunkXWJGVGSPjs = require('./chunk-XWJGVGSP.js');
13
13
 
14
14
 
15
- var _chunkGPOP6RE3js = require('./chunk-GPOP6RE3.js');
15
+ var _chunkELRZS7XIjs = require('./chunk-ELRZS7XI.js');
16
16
 
17
17
 
18
18
  var _chunkKKGXM3XLjs = require('./chunk-KKGXM3XL.js');
19
- require('./chunk-6ZL4B4HQ.js');
19
+ require('./chunk-34SGGZ4P.js');
20
20
 
21
21
 
22
- var _chunkMJQETB73js = require('./chunk-MJQETB73.js');
22
+ var _chunkQDKRARRUjs = require('./chunk-QDKRARRU.js');
23
23
 
24
24
  // node/cli.ts
25
- var import_fast_deep_equal = _chunkMJQETB73js.__toESM.call(void 0, _chunkGPOP6RE3js.require_fast_deep_equal.call(void 0, ));
25
+ var import_fast_deep_equal = _chunkQDKRARRUjs.__toESM.call(void 0, _chunkELRZS7XIjs.require_fast_deep_equal.call(void 0, ));
26
26
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
27
27
  var _os = require('os'); var _os2 = _interopRequireDefault(_os);
28
28
  var _child_process = require('child_process');
29
29
  var _readline = require('readline'); var readline = _interopRequireWildcard(_readline);
30
+ var _process = require('process'); var _process2 = _interopRequireDefault(_process);
30
31
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
31
32
  var _open = require('open'); var _open2 = _interopRequireDefault(_open);
32
33
  var _yargs = require('yargs'); var _yargs2 = _interopRequireDefault(_yargs);
@@ -48,15 +49,15 @@ _fs.injectPreparserExtensionLoader.call(void 0, async (headmatter, filepath) =>
48
49
  const roots = (
49
50
  /* uniq */
50
51
  [
51
- _chunk35XQHQN5js.getUserRoot.call(void 0, {}).userRoot,
52
- ..._chunk35XQHQN5js.getAddonRoots.call(void 0, addons, ""),
53
- _chunk35XQHQN5js.getClientRoot.call(void 0, )
52
+ _chunkXWJGVGSPjs.getUserRoot.call(void 0, {}).userRoot,
53
+ ..._chunkXWJGVGSPjs.getAddonRoots.call(void 0, addons, ""),
54
+ _chunkXWJGVGSPjs.getClientRoot.call(void 0, )
54
55
  ]
55
56
  );
56
57
  const mergeArrays = (a, b) => a.concat(b);
57
58
  return await _chunkKKGXM3XLjs.loadSetups.call(void 0, roots, "preparser.ts", { filepath, headmatter }, [], false, mergeArrays);
58
59
  });
59
- var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunk35XQHQN5js.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
60
+ var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkXWJGVGSPjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
60
61
  cli.command(
61
62
  "* [entry]",
62
63
  "Start a local server for Slidev",
@@ -104,7 +105,7 @@ cli.command(
104
105
  if (create)
105
106
  await _fsextra2.default.copyFile(_path2.default.resolve(__dirname, "../template.md"), entry);
106
107
  else
107
- process.exit(0);
108
+ _process2.default.exit(0);
108
109
  }
109
110
  let server;
110
111
  let port = 3030;
@@ -112,9 +113,9 @@ cli.command(
112
113
  async function initServer() {
113
114
  if (server)
114
115
  await server.close();
115
- const options = await _chunk35XQHQN5js.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
116
+ const options = await _chunkXWJGVGSPjs.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
116
117
  port = userPort || await findFreePort(3030);
117
- server = await _chunk35XQHQN5js.createServer.call(void 0,
118
+ server = await _chunkXWJGVGSPjs.createServer.call(void 0,
118
119
  options,
119
120
  {
120
121
  server: {
@@ -128,7 +129,7 @@ cli.command(
128
129
  },
129
130
  {
130
131
  onDataReload(newData, data) {
131
- if (!theme && _chunk35XQHQN5js.resolveThemeName.call(void 0, newData.config.theme) !== _chunk35XQHQN5js.resolveThemeName.call(void 0, data.config.theme)) {
132
+ if (!theme && _chunkXWJGVGSPjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunkXWJGVGSPjs.resolveThemeName.call(void 0, data.config.theme)) {
132
133
  console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
133
134
  initServer();
134
135
  } else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
@@ -178,32 +179,43 @@ cli.command(
178
179
  _child_process.exec.call(void 0, `code "${entry}"`);
179
180
  }
180
181
  },
182
+ {
183
+ name: "q",
184
+ fullname: "quit",
185
+ action() {
186
+ try {
187
+ server == null ? void 0 : server.close();
188
+ } finally {
189
+ _process2.default.exit();
190
+ }
191
+ }
192
+ },
181
193
  {
182
194
  name: "c",
183
195
  fullname: "qrcode",
184
196
  async action() {
185
197
  if (!lastRemoteUrl)
186
198
  return;
187
- const qrcode = await Promise.resolve().then(() => require("qrcode-terminal")).then((r) => r.default || r);
188
- qrcode.generate(lastRemoteUrl, { small: true }, (v) => {
199
+ await Promise.resolve().then(() => require("uqr")).then((r) => {
200
+ const code = r.renderUnicodeCompact(lastRemoteUrl);
189
201
  console.log(`
190
202
  ${_kolorist.dim.call(void 0, " QR Code for remote control: ")}
191
203
  ${_kolorist.blue.call(void 0, lastRemoteUrl)}
192
204
  `);
193
- console.log(v.split("\n").map((i) => ` ${i}`).join("\n"));
205
+ console.log(code.split("\n").map((i) => ` ${i}`).join("\n"));
194
206
  });
195
207
  }
196
208
  }
197
209
  ];
198
210
  function bindShortcut() {
199
- process.stdin.resume();
200
- process.stdin.setEncoding("utf8");
201
- readline.emitKeypressEvents(process.stdin);
202
- if (process.stdin.isTTY)
203
- process.stdin.setRawMode(true);
204
- process.stdin.on("keypress", (str, key) => {
211
+ _process2.default.stdin.resume();
212
+ _process2.default.stdin.setEncoding("utf8");
213
+ readline.emitKeypressEvents(_process2.default.stdin);
214
+ if (_process2.default.stdin.isTTY)
215
+ _process2.default.stdin.setRawMode(true);
216
+ _process2.default.stdin.on("keypress", (str, key) => {
205
217
  if (key.ctrl && key.name === "c") {
206
- process.exit();
218
+ _process2.default.exit();
207
219
  } else {
208
220
  const [sh] = SHORTCUTS.filter((item) => item.name === str);
209
221
  if (sh) {
@@ -246,9 +258,9 @@ cli.command(
246
258
  }).strict().help(),
247
259
  async (args) => {
248
260
  const { entry, theme, watch, base, download, out, inspect } = args;
249
- const { build } = await Promise.resolve().then(() => require("./build-D4QSB7HD.js"));
261
+ const { build } = await Promise.resolve().then(() => require("./build-FGRU7R5C.js"));
250
262
  for (const entryFile of entry) {
251
- const options = await _chunk35XQHQN5js.resolveOptions.call(void 0, { entry: entryFile, theme, inspect }, "build");
263
+ const options = await _chunkXWJGVGSPjs.resolveOptions.call(void 0, { entry: entryFile, theme, inspect }, "build");
252
264
  if (download && !options.data.config.download)
253
265
  options.data.config.download = download;
254
266
  printInfo(options);
@@ -268,9 +280,9 @@ cli.command(
268
280
  (args) => commonOptions(args).strict().help(),
269
281
  async ({ entry }) => {
270
282
  for (const entryFile of entry) {
271
- const data = await _chunk35XQHQN5js.parser.load(entryFile);
272
- _chunk35XQHQN5js.parser.prettify(data);
273
- await _chunk35XQHQN5js.parser.save(data);
283
+ const data = await _chunkXWJGVGSPjs.parser.load(entryFile);
284
+ _chunkXWJGVGSPjs.parser.prettify(data);
285
+ await _chunkXWJGVGSPjs.parser.save(data);
274
286
  }
275
287
  }
276
288
  );
@@ -286,20 +298,20 @@ cli.command(
286
298
  default: "theme"
287
299
  }),
288
300
  async ({ entry, dir, theme: themeInput }) => {
289
- const data = await _chunk35XQHQN5js.parser.load(entry);
290
- const theme = _chunk35XQHQN5js.resolveThemeName.call(void 0, themeInput || data.config.theme);
301
+ const data = await _chunkXWJGVGSPjs.parser.load(entry);
302
+ const theme = _chunkXWJGVGSPjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
291
303
  if (theme === "none") {
292
304
  console.error('Cannot eject theme "none"');
293
- process.exit(1);
305
+ _process2.default.exit(1);
294
306
  }
295
- if (_chunk35XQHQN5js.isPath.call(void 0, theme)) {
307
+ if (_chunkXWJGVGSPjs.isPath.call(void 0, theme)) {
296
308
  console.error("Theme is already ejected");
297
- process.exit(1);
309
+ _process2.default.exit(1);
298
310
  }
299
- const roots = _chunk35XQHQN5js.getThemeRoots.call(void 0, theme, entry);
311
+ const roots = _chunkXWJGVGSPjs.getThemeRoots.call(void 0, theme, entry);
300
312
  if (!roots.length) {
301
313
  console.error(`Could not find theme "${theme}"`);
302
- process.exit(1);
314
+ _process2.default.exit(1);
303
315
  }
304
316
  const root = roots[0];
305
317
  await _fsextra2.default.copy(root, _path2.default.resolve(dir), {
@@ -308,14 +320,14 @@ cli.command(
308
320
  const dirPath = `./${dir}`;
309
321
  data.slides[0].frontmatter.theme = dirPath;
310
322
  data.slides[0].raw = null;
311
- await _chunk35XQHQN5js.parser.save(data);
323
+ await _chunkXWJGVGSPjs.parser.save(data);
312
324
  console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
313
325
  }
314
326
  );
315
327
  },
316
328
  () => {
317
329
  cli.showHelp();
318
- process.exit(1);
330
+ _process2.default.exit(1);
319
331
  }
320
332
  );
321
333
  cli.command(
@@ -324,12 +336,12 @@ cli.command(
324
336
  (args) => exportOptions(commonOptions(args)).strict().help(),
325
337
  async (args) => {
326
338
  const { entry, theme } = args;
327
- process.env.NODE_ENV = "production";
328
- const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-PN4EOI4Z.js"));
339
+ _process2.default.env.NODE_ENV = "production";
340
+ const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-BGMCS4F2.js"));
329
341
  const port = await findFreePort(12445);
330
342
  for (const entryFile of entry) {
331
- const options = await _chunk35XQHQN5js.resolveOptions.call(void 0, { entry: entryFile, theme }, "export");
332
- const server = await _chunk35XQHQN5js.createServer.call(void 0,
343
+ const options = await _chunkXWJGVGSPjs.resolveOptions.call(void 0, { entry: entryFile, theme }, "export");
344
+ const server = await _chunkXWJGVGSPjs.createServer.call(void 0,
333
345
  options,
334
346
  {
335
347
  server: { port },
@@ -338,7 +350,7 @@ cli.command(
338
350
  );
339
351
  await server.listen(port);
340
352
  printInfo(options);
341
- _chunk35XQHQN5js.parser.filterDisabled(options.data);
353
+ _chunkXWJGVGSPjs.parser.filterDisabled(options.data);
342
354
  const result = await exportSlides({
343
355
  port,
344
356
  ...getExportOptions({ ...args, entry: entryFile }, options)
@@ -347,7 +359,7 @@ cli.command(
347
359
  `);
348
360
  server.close();
349
361
  }
350
- process.exit(0);
362
+ _process2.default.exit(0);
351
363
  }
352
364
  );
353
365
  cli.command(
@@ -370,12 +382,12 @@ cli.command(
370
382
  output,
371
383
  timeout
372
384
  }) => {
373
- process.env.NODE_ENV = "production";
374
- const { exportNotes } = await Promise.resolve().then(() => require("./export-PN4EOI4Z.js"));
385
+ _process2.default.env.NODE_ENV = "production";
386
+ const { exportNotes } = await Promise.resolve().then(() => require("./export-BGMCS4F2.js"));
375
387
  const port = await findFreePort(12445);
376
388
  for (const entryFile of entry) {
377
- const options = await _chunk35XQHQN5js.resolveOptions.call(void 0, { entry: entryFile }, "export");
378
- const server = await _chunk35XQHQN5js.createServer.call(void 0,
389
+ const options = await _chunkXWJGVGSPjs.resolveOptions.call(void 0, { entry: entryFile }, "export");
390
+ const server = await _chunkXWJGVGSPjs.createServer.call(void 0,
379
391
  options,
380
392
  {
381
393
  server: { port },
@@ -384,7 +396,7 @@ cli.command(
384
396
  );
385
397
  await server.listen(port);
386
398
  printInfo(options);
387
- _chunk35XQHQN5js.parser.filterDisabled(options.data);
399
+ _chunkXWJGVGSPjs.parser.filterDisabled(options.data);
388
400
  const result = await exportNotes({
389
401
  port,
390
402
  output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${_path2.default.basename(entryFile, ".md")}-export-notes`),
@@ -394,7 +406,7 @@ cli.command(
394
406
  `);
395
407
  server.close();
396
408
  }
397
- process.exit(0);
409
+ _process2.default.exit(0);
398
410
  }
399
411
  );
400
412
  cli.help().parse();
@@ -445,7 +457,7 @@ function printInfo(options, port, remote, tunnelUrl) {
445
457
  console.log();
446
458
  console.log();
447
459
  console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
448
- console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunk35XQHQN5js.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
460
+ console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkXWJGVGSPjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
449
461
  console.log();
450
462
  _parser.verifyConfig.call(void 0, options.data.config, options.data.themeMeta, (v) => console.warn(_kolorist.yellow.call(void 0, ` ! ${v}`)));
451
463
  console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
@@ -477,7 +489,7 @@ function printInfo(options, port, remote, tunnelUrl) {
477
489
  console.log(`${_kolorist.dim.call(void 0, " remote control ")} > ${_kolorist.dim.call(void 0, "pass --remote to enable")}`);
478
490
  }
479
491
  console.log();
480
- console.log(`${_kolorist.dim.call(void 0, " shortcuts ")} > ${_kolorist.underline.call(void 0, "r")}${_kolorist.dim.call(void 0, "estart | ")}${_kolorist.underline.call(void 0, "o")}${_kolorist.dim.call(void 0, "pen | ")}${_kolorist.underline.call(void 0, "e")}${_kolorist.dim.call(void 0, "dit")}${lastRemoteUrl ? ` | ${_kolorist.dim.call(void 0, "qr")}${_kolorist.underline.call(void 0, "c")}${_kolorist.dim.call(void 0, "ode")}` : ""}`);
492
+ console.log(`${_kolorist.dim.call(void 0, " shortcuts ")} > ${_kolorist.underline.call(void 0, "r")}${_kolorist.dim.call(void 0, "estart | ")}${_kolorist.underline.call(void 0, "o")}${_kolorist.dim.call(void 0, "pen | ")}${_kolorist.underline.call(void 0, "e")}${_kolorist.dim.call(void 0, "dit | ")}${_kolorist.underline.call(void 0, "q")}${_kolorist.dim.call(void 0, "uit")}${lastRemoteUrl ? ` | ${_kolorist.dim.call(void 0, "qr")}${_kolorist.underline.call(void 0, "c")}${_kolorist.dim.call(void 0, "ode")}` : ""}`);
481
493
  return lastRemoteUrl;
482
494
  }
483
495
  }
package/dist/cli.mjs CHANGED
@@ -9,17 +9,17 @@ import {
9
9
  resolveOptions,
10
10
  resolveThemeName,
11
11
  version
12
- } from "./chunk-YZMOU6XV.mjs";
12
+ } from "./chunk-ACFLBCHI.mjs";
13
13
  import {
14
14
  require_fast_deep_equal
15
- } from "./chunk-Q3TKTGHS.mjs";
15
+ } from "./chunk-LN5DOTNJ.mjs";
16
16
  import {
17
17
  loadSetups
18
18
  } from "./chunk-6XVZLT3I.mjs";
19
- import "./chunk-CIUEQ4TI.mjs";
19
+ import "./chunk-MZBIET7Y.mjs";
20
20
  import {
21
21
  __toESM
22
- } from "./chunk-L5QH2WZE.mjs";
22
+ } from "./chunk-KB3DQ2OE.mjs";
23
23
 
24
24
  // node/cli.ts
25
25
  var import_fast_deep_equal = __toESM(require_fast_deep_equal());
@@ -27,6 +27,7 @@ import path from "path";
27
27
  import os from "os";
28
28
  import { exec } from "child_process";
29
29
  import * as readline from "readline";
30
+ import process from "process";
30
31
  import fs from "fs-extra";
31
32
  import openBrowser from "open";
32
33
  import yargs from "yargs";
@@ -178,19 +179,30 @@ cli.command(
178
179
  exec(`code "${entry}"`);
179
180
  }
180
181
  },
182
+ {
183
+ name: "q",
184
+ fullname: "quit",
185
+ action() {
186
+ try {
187
+ server == null ? void 0 : server.close();
188
+ } finally {
189
+ process.exit();
190
+ }
191
+ }
192
+ },
181
193
  {
182
194
  name: "c",
183
195
  fullname: "qrcode",
184
196
  async action() {
185
197
  if (!lastRemoteUrl)
186
198
  return;
187
- const qrcode = await import("qrcode-terminal").then((r) => r.default || r);
188
- qrcode.generate(lastRemoteUrl, { small: true }, (v) => {
199
+ await import("uqr").then((r) => {
200
+ const code = r.renderUnicodeCompact(lastRemoteUrl);
189
201
  console.log(`
190
202
  ${dim(" QR Code for remote control: ")}
191
203
  ${blue(lastRemoteUrl)}
192
204
  `);
193
- console.log(v.split("\n").map((i) => ` ${i}`).join("\n"));
205
+ console.log(code.split("\n").map((i) => ` ${i}`).join("\n"));
194
206
  });
195
207
  }
196
208
  }
@@ -246,7 +258,7 @@ cli.command(
246
258
  }).strict().help(),
247
259
  async (args) => {
248
260
  const { entry, theme, watch, base, download, out, inspect } = args;
249
- const { build } = await import("./build-7A4AKFCP.mjs");
261
+ const { build } = await import("./build-MQ5SJ6HF.mjs");
250
262
  for (const entryFile of entry) {
251
263
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
252
264
  if (download && !options.data.config.download)
@@ -325,7 +337,7 @@ cli.command(
325
337
  async (args) => {
326
338
  const { entry, theme } = args;
327
339
  process.env.NODE_ENV = "production";
328
- const { exportSlides, getExportOptions } = await import("./export-KRS4L4HC.mjs");
340
+ const { exportSlides, getExportOptions } = await import("./export-6G7WYT32.mjs");
329
341
  const port = await findFreePort(12445);
330
342
  for (const entryFile of entry) {
331
343
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
@@ -371,7 +383,7 @@ cli.command(
371
383
  timeout
372
384
  }) => {
373
385
  process.env.NODE_ENV = "production";
374
- const { exportNotes } = await import("./export-KRS4L4HC.mjs");
386
+ const { exportNotes } = await import("./export-6G7WYT32.mjs");
375
387
  const port = await findFreePort(12445);
376
388
  for (const entryFile of entry) {
377
389
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -477,7 +489,7 @@ function printInfo(options, port, remote, tunnelUrl) {
477
489
  console.log(`${dim(" remote control ")} > ${dim("pass --remote to enable")}`);
478
490
  }
479
491
  console.log();
480
- console.log(`${dim(" shortcuts ")} > ${underline("r")}${dim("estart | ")}${underline("o")}${dim("pen | ")}${underline("e")}${dim("dit")}${lastRemoteUrl ? ` | ${dim("qr")}${underline("c")}${dim("ode")}` : ""}`);
492
+ console.log(`${dim(" shortcuts ")} > ${underline("r")}${dim("estart | ")}${underline("o")}${dim("pen | ")}${underline("e")}${dim("dit | ")}${underline("q")}${dim("uit")}${lastRemoteUrl ? ` | ${dim("qr")}${underline("c")}${dim("ode")}` : ""}`);
481
493
  return lastRemoteUrl;
482
494
  }
483
495
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  packageExists
3
- } from "./chunk-CIUEQ4TI.mjs";
4
- import "./chunk-L5QH2WZE.mjs";
3
+ } from "./chunk-MZBIET7Y.mjs";
4
+ import "./chunk-KB3DQ2OE.mjs";
5
5
 
6
6
  // node/export.ts
7
7
  import path from "path";
@@ -225,7 +225,7 @@ async function exportSlides({
225
225
  await fs.writeFile(output, buffer);
226
226
  }
227
227
  async function genPagePdfOnePiece() {
228
- var _a;
228
+ var _a, _b, _c, _d, _e, _f;
229
229
  await go("print");
230
230
  const slideIndexes = await getSlidesIndex();
231
231
  await page.pdf({
@@ -248,6 +248,14 @@ async function exportSlides({
248
248
  pdf.setTitle(titleSlide.title);
249
249
  if ((_a = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _a.info)
250
250
  pdf.setSubject(titleSlide.frontmatter.info);
251
+ if ((_b = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _b.author)
252
+ pdf.setAuthor(titleSlide.frontmatter.author);
253
+ if ((_c = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _c.keywords) {
254
+ if (Array.isArray((_d = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _d.keywords))
255
+ pdf.setKeywords((_e = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _e.keywords);
256
+ else
257
+ pdf.setKeywords((_f = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _f.keywords.split(","));
258
+ }
251
259
  if (withToc) {
252
260
  const outlinePdf = outlinePdfFactory(pdfLib);
253
261
  const tocTree = slides.filter((slide) => slide.title).reduce((acc, slide) => {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunk6ZL4B4HQjs = require('./chunk-6ZL4B4HQ.js');
4
- require('./chunk-MJQETB73.js');
3
+ var _chunk34SGGZ4Pjs = require('./chunk-34SGGZ4P.js');
4
+ require('./chunk-QDKRARRU.js');
5
5
 
6
6
  // node/export.ts
7
7
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -77,7 +77,7 @@ async function exportNotes({
77
77
  output = "notes",
78
78
  timeout = 3e4
79
79
  }) {
80
- if (!_chunk6ZL4B4HQjs.packageExists.call(void 0, "playwright-chromium"))
80
+ if (!_chunk34SGGZ4Pjs.packageExists.call(void 0, "playwright-chromium"))
81
81
  throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
82
82
  const { chromium } = await Promise.resolve().then(() => require("playwright-chromium"));
83
83
  const browser = await chromium.launch();
@@ -123,7 +123,7 @@ async function exportSlides({
123
123
  withToc = false,
124
124
  perSlide = false
125
125
  }) {
126
- if (!_chunk6ZL4B4HQjs.packageExists.call(void 0, "playwright-chromium"))
126
+ if (!_chunk34SGGZ4Pjs.packageExists.call(void 0, "playwright-chromium"))
127
127
  throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
128
128
  const pages = _core.parseRangeString.call(void 0, total, range);
129
129
  const { chromium } = await Promise.resolve().then(() => require("playwright-chromium"));
@@ -225,7 +225,7 @@ async function exportSlides({
225
225
  await _fsextra2.default.writeFile(output, buffer);
226
226
  }
227
227
  async function genPagePdfOnePiece() {
228
- var _a;
228
+ var _a, _b, _c, _d, _e, _f;
229
229
  await go("print");
230
230
  const slideIndexes = await getSlidesIndex();
231
231
  await page.pdf({
@@ -248,6 +248,14 @@ async function exportSlides({
248
248
  pdf.setTitle(titleSlide.title);
249
249
  if ((_a = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _a.info)
250
250
  pdf.setSubject(titleSlide.frontmatter.info);
251
+ if ((_b = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _b.author)
252
+ pdf.setAuthor(titleSlide.frontmatter.author);
253
+ if ((_c = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _c.keywords) {
254
+ if (Array.isArray((_d = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _d.keywords))
255
+ pdf.setKeywords((_e = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _e.keywords);
256
+ else
257
+ pdf.setKeywords((_f = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _f.keywords.split(","));
258
+ }
251
259
  if (withToc) {
252
260
  const outlinePdf = _outlinepdf.outlinePdfFactory.call(void 0, pdfLib);
253
261
  const tocTree = slides.filter((slide) => slide.title).reduce((acc, slide) => {
@@ -0,0 +1,100 @@
1
+ import Vue from '@vitejs/plugin-vue';
2
+ import VueJsx from '@vitejs/plugin-vue-jsx';
3
+ import Icons from 'unplugin-icons/vite';
4
+ import Components from 'unplugin-vue-components/vite';
5
+ import Markdown from 'vite-plugin-vue-markdown';
6
+ import WindiCSS from 'vite-plugin-windicss';
7
+ import { VitePluginConfig } from 'unocss/vite';
8
+ import RemoteAssets from 'vite-plugin-remote-assets';
9
+ import ServerRef from 'vite-plugin-vue-server-ref';
10
+ import { ArgumentsType } from '@antfu/utils';
11
+ import { SlidevMarkdown } from '@slidev/types';
12
+ import * as vite from 'vite';
13
+ import { InlineConfig, Plugin } from 'vite';
14
+ import * as fs from '@slidev/parser/fs';
15
+ export { fs as parser };
16
+
17
+ interface SlidevEntryOptions {
18
+ /**
19
+ * Markdown entry
20
+ *
21
+ * @default 'slides.md'
22
+ */
23
+ entry?: string;
24
+ /**
25
+ * Theme id
26
+ */
27
+ theme?: string;
28
+ /**
29
+ * Remote password
30
+ */
31
+ remote?: string;
32
+ /**
33
+ * Root path
34
+ *
35
+ * @default process.cwd()
36
+ */
37
+ userRoot?: string;
38
+ /**
39
+ * Enable inspect plugin
40
+ */
41
+ inspect?: boolean;
42
+ }
43
+ interface ResolvedSlidevOptions {
44
+ data: SlidevMarkdown;
45
+ entry: string;
46
+ userRoot: string;
47
+ cliRoot: string;
48
+ clientRoot: string;
49
+ theme: string;
50
+ themeRoots: string[];
51
+ addonRoots: string[];
52
+ roots: string[];
53
+ mode: 'dev' | 'build' | 'export';
54
+ remote?: string;
55
+ inspect?: boolean;
56
+ }
57
+ interface SlidevPluginOptions extends SlidevEntryOptions {
58
+ vue?: ArgumentsType<typeof Vue>[0];
59
+ vuejsx?: ArgumentsType<typeof VueJsx>[0];
60
+ markdown?: ArgumentsType<typeof Markdown>[0];
61
+ components?: ArgumentsType<typeof Components>[0];
62
+ windicss?: ArgumentsType<typeof WindiCSS>[0];
63
+ icons?: ArgumentsType<typeof Icons>[0];
64
+ remoteAssets?: ArgumentsType<typeof RemoteAssets>[0];
65
+ serverRef?: ArgumentsType<typeof ServerRef>[0];
66
+ unocss?: VitePluginConfig;
67
+ }
68
+ interface SlidevServerOptions {
69
+ onDataReload?: (newData: SlidevMarkdown, data: SlidevMarkdown) => void;
70
+ }
71
+ declare function getClientRoot(): string;
72
+ declare function getCLIRoot(): string;
73
+ declare function isPath(name: string): boolean;
74
+ declare function getThemeRoots(name: string, entry: string): string[];
75
+ declare function getAddonRoots(addons: string[], entry: string): string[];
76
+ declare function getRoot(name: string, entry: string): string;
77
+ declare function getUserRoot(options: SlidevEntryOptions): {
78
+ entry: string;
79
+ userRoot: string;
80
+ };
81
+ declare function resolveOptions(options: SlidevEntryOptions, mode: ResolvedSlidevOptions['mode'], promptForInstallation?: boolean): Promise<ResolvedSlidevOptions>;
82
+
83
+ declare module 'vite' {
84
+ interface UserConfig {
85
+ /**
86
+ * Custom internal plugin options for Slidev (advanced)
87
+ *
88
+ * @see https://github.com/slidevjs/slidev/blob/main/packages/slidev/node/options.ts#L50
89
+ */
90
+ slidev?: SlidevPluginOptions;
91
+ }
92
+ }
93
+
94
+ declare function createServer(options: ResolvedSlidevOptions, viteConfig?: InlineConfig, serverOptions?: SlidevServerOptions): Promise<vite.ViteDevServer>;
95
+
96
+ declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<Plugin[]>;
97
+
98
+ declare function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRoot, roots, data }: ResolvedSlidevOptions, { windicss: windiOptions }: SlidevPluginOptions): Promise<vite.Plugin[]>;
99
+
100
+ export { ResolvedSlidevOptions, SlidevEntryOptions, SlidevPluginOptions, SlidevServerOptions, ViteSlidevPlugin, createServer, createWindiCSSPlugin, getAddonRoots, getCLIRoot, getClientRoot, getRoot, getThemeRoots, getUserRoot, isPath, resolveOptions };
package/dist/index.js CHANGED
@@ -9,16 +9,16 @@
9
9
 
10
10
 
11
11
 
12
- var _chunk35XQHQN5js = require('./chunk-35XQHQN5.js');
12
+ var _chunkXWJGVGSPjs = require('./chunk-XWJGVGSP.js');
13
13
 
14
14
 
15
- var _chunkYI4ZV27Kjs = require('./chunk-YI4ZV27K.js');
15
+ var _chunkRSZHGGR3js = require('./chunk-RSZHGGR3.js');
16
16
 
17
17
 
18
- var _chunkGPOP6RE3js = require('./chunk-GPOP6RE3.js');
18
+ var _chunkELRZS7XIjs = require('./chunk-ELRZS7XI.js');
19
19
  require('./chunk-KKGXM3XL.js');
20
- require('./chunk-6ZL4B4HQ.js');
21
- require('./chunk-MJQETB73.js');
20
+ require('./chunk-34SGGZ4P.js');
21
+ require('./chunk-QDKRARRU.js');
22
22
 
23
23
 
24
24
 
@@ -32,4 +32,4 @@ require('./chunk-MJQETB73.js');
32
32
 
33
33
 
34
34
 
35
- exports.ViteSlidevPlugin = _chunkGPOP6RE3js.ViteSlidevPlugin; exports.createServer = _chunk35XQHQN5js.createServer; exports.createWindiCSSPlugin = _chunkYI4ZV27Kjs.createWindiCSSPlugin; exports.getAddonRoots = _chunk35XQHQN5js.getAddonRoots; exports.getCLIRoot = _chunk35XQHQN5js.getCLIRoot; exports.getClientRoot = _chunk35XQHQN5js.getClientRoot; exports.getRoot = _chunk35XQHQN5js.getRoot; exports.getThemeRoots = _chunk35XQHQN5js.getThemeRoots; exports.getUserRoot = _chunk35XQHQN5js.getUserRoot; exports.isPath = _chunk35XQHQN5js.isPath; exports.parser = _chunk35XQHQN5js.parser; exports.resolveOptions = _chunk35XQHQN5js.resolveOptions;
35
+ exports.ViteSlidevPlugin = _chunkELRZS7XIjs.ViteSlidevPlugin; exports.createServer = _chunkXWJGVGSPjs.createServer; exports.createWindiCSSPlugin = _chunkRSZHGGR3js.createWindiCSSPlugin; exports.getAddonRoots = _chunkXWJGVGSPjs.getAddonRoots; exports.getCLIRoot = _chunkXWJGVGSPjs.getCLIRoot; exports.getClientRoot = _chunkXWJGVGSPjs.getClientRoot; exports.getRoot = _chunkXWJGVGSPjs.getRoot; exports.getThemeRoots = _chunkXWJGVGSPjs.getThemeRoots; exports.getUserRoot = _chunkXWJGVGSPjs.getUserRoot; exports.isPath = _chunkXWJGVGSPjs.isPath; exports.parser = _chunkXWJGVGSPjs.parser; exports.resolveOptions = _chunkXWJGVGSPjs.resolveOptions;
package/dist/index.mjs CHANGED
@@ -9,16 +9,16 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-YZMOU6XV.mjs";
12
+ } from "./chunk-ACFLBCHI.mjs";
13
13
  import {
14
14
  createWindiCSSPlugin
15
- } from "./chunk-X7P5WRYP.mjs";
15
+ } from "./chunk-VPD6PH2L.mjs";
16
16
  import {
17
17
  ViteSlidevPlugin
18
- } from "./chunk-Q3TKTGHS.mjs";
18
+ } from "./chunk-LN5DOTNJ.mjs";
19
19
  import "./chunk-6XVZLT3I.mjs";
20
- import "./chunk-CIUEQ4TI.mjs";
21
- import "./chunk-L5QH2WZE.mjs";
20
+ import "./chunk-MZBIET7Y.mjs";
21
+ import "./chunk-KB3DQ2OE.mjs";
22
22
  export {
23
23
  ViteSlidevPlugin,
24
24
  createServer,
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
3
  var _chunkKKGXM3XLjs = require('./chunk-KKGXM3XL.js');
4
- require('./chunk-MJQETB73.js');
4
+ require('./chunk-QDKRARRU.js');
5
5
 
6
6
  // node/plugins/unocss.ts
7
7
  var _path = require('path');
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadSetups
3
3
  } from "./chunk-6XVZLT3I.mjs";
4
- import "./chunk-L5QH2WZE.mjs";
4
+ import "./chunk-KB3DQ2OE.mjs";
5
5
 
6
6
  // node/plugins/unocss.ts
7
7
  import { resolve } from "path";
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkRSZHGGR3js = require('./chunk-RSZHGGR3.js');
4
+ require('./chunk-KKGXM3XL.js');
5
+ require('./chunk-34SGGZ4P.js');
6
+ require('./chunk-QDKRARRU.js');
7
+
8
+
9
+ exports.createWindiCSSPlugin = _chunkRSZHGGR3js.createWindiCSSPlugin;