@slidev/cli 0.40.2 → 0.40.4

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.mjs CHANGED
@@ -9,14 +9,14 @@ import {
9
9
  resolveOptions,
10
10
  resolveThemeName,
11
11
  version
12
- } from "./chunk-EZ2J7PMK.mjs";
12
+ } from "./chunk-4FABOYKQ.mjs";
13
13
  import {
14
14
  loadSetups,
15
15
  require_fast_deep_equal
16
- } from "./chunk-ZAT6O5HR.mjs";
16
+ } from "./chunk-46GOGODM.mjs";
17
17
  import {
18
18
  __toESM
19
- } from "./chunk-VLEV37KF.mjs";
19
+ } from "./chunk-CTG3GV2W.mjs";
20
20
 
21
21
  // node/cli.ts
22
22
  var import_fast_deep_equal = __toESM(require_fast_deep_equal());
@@ -42,11 +42,14 @@ var CONFIG_RESTART_FIELDS = [
42
42
  ];
43
43
  injectPreparserExtensionLoader(async (headmatter, filepath) => {
44
44
  const addons = (headmatter == null ? void 0 : headmatter.addons) ?? [];
45
- const roots = [
46
- getUserRoot({}).userRoot,
47
- ...getAddonRoots(addons, ""),
48
- getClientRoot()
49
- ];
45
+ const roots = (
46
+ /* uniq */
47
+ [
48
+ getUserRoot({}).userRoot,
49
+ ...getAddonRoots(addons, ""),
50
+ getClientRoot()
51
+ ]
52
+ );
50
53
  const mergeArrays = (a, b) => a.concat(b);
51
54
  return await loadSetups(roots, "preparser.ts", { filepath, headmatter }, [], false, mergeArrays);
52
55
  });
@@ -215,7 +218,7 @@ ${dim(" QR Code for remote control: ")}
215
218
  }
216
219
  );
217
220
  cli.command(
218
- "build [entry]",
221
+ "build [entry..]",
219
222
  "Build hostable SPA",
220
223
  (args) => exportOptions(commonOptions(args)).option("watch", {
221
224
  alias: "w",
@@ -240,28 +243,32 @@ cli.command(
240
243
  }).strict().help(),
241
244
  async (args) => {
242
245
  const { entry, theme, watch, base, download, out, inspect } = args;
243
- const { build } = await import("./build-BGUF7J7N.mjs");
244
- const options = await resolveOptions({ entry, theme, inspect }, "build");
245
- if (download && !options.data.config.download)
246
- options.data.config.download = download;
247
- printInfo(options);
248
- await build(options, {
249
- base,
250
- build: {
251
- watch: watch ? {} : void 0,
252
- outDir: out
253
- }
254
- }, args);
246
+ const { build } = await import("./build-QEAAPDMG.mjs");
247
+ for (const entryFile of entry) {
248
+ const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
249
+ if (download && !options.data.config.download)
250
+ options.data.config.download = download;
251
+ printInfo(options);
252
+ await build(options, {
253
+ base,
254
+ build: {
255
+ watch: watch ? {} : void 0,
256
+ outDir: entry.length === 1 ? out : path.join(out, path.basename(entryFile, ".md"))
257
+ }
258
+ }, { ...args, entry: entryFile });
259
+ }
255
260
  }
256
261
  );
257
262
  cli.command(
258
- "format [entry]",
263
+ "format [entry..]",
259
264
  "Format the markdown file",
260
265
  (args) => commonOptions(args).strict().help(),
261
266
  async ({ entry }) => {
262
- const data = await parser.load(entry);
263
- parser.prettify(data);
264
- await parser.save(data);
267
+ for (const entryFile of entry) {
268
+ const data = await parser.load(entryFile);
269
+ parser.prettify(data);
270
+ await parser.save(data);
271
+ }
265
272
  }
266
273
  );
267
274
  cli.command(
@@ -309,37 +316,39 @@ cli.command(
309
316
  }
310
317
  );
311
318
  cli.command(
312
- "export [entry]",
319
+ "export [entry..]",
313
320
  "Export slides to PDF",
314
321
  (args) => exportOptions(commonOptions(args)).strict().help(),
315
322
  async (args) => {
316
323
  const { entry, theme } = args;
317
324
  process.env.NODE_ENV = "production";
318
- const { exportSlides, getExportOptions } = await import("./export-BAZ4BSV6.mjs");
325
+ const { exportSlides, getExportOptions } = await import("./export-N3YCMXVO.mjs");
319
326
  const port = await findFreePort(12445);
320
- const options = await resolveOptions({ entry, theme }, "export");
321
- const server = await createServer(
322
- options,
323
- {
324
- server: { port },
325
- clearScreen: false
326
- }
327
- );
328
- await server.listen(port);
329
- printInfo(options);
330
- parser.filterDisabled(options.data);
331
- const output = await exportSlides({
332
- port,
333
- ...getExportOptions(args, options)
334
- });
335
- console.log(`${green(" \u2713 ")}${dim("exported to ")}./${output}
327
+ for (const entryFile of entry) {
328
+ const options = await resolveOptions({ entry: entryFile, theme }, "export");
329
+ const server = await createServer(
330
+ options,
331
+ {
332
+ server: { port },
333
+ clearScreen: false
334
+ }
335
+ );
336
+ await server.listen(port);
337
+ printInfo(options);
338
+ parser.filterDisabled(options.data);
339
+ const result = await exportSlides({
340
+ port,
341
+ ...getExportOptions({ ...args, entry: entryFile }, options)
342
+ });
343
+ console.log(`${green(" \u2713 ")}${dim("exported to ")}./${result}
336
344
  `);
337
- server.close();
345
+ server.close();
346
+ }
338
347
  process.exit(0);
339
348
  }
340
349
  );
341
350
  cli.command(
342
- "export-notes [entry]",
351
+ "export-notes [entry..]",
343
352
  "Export slide notes to PDF",
344
353
  (args) => args.positional("entry", {
345
354
  default: "slides.md",
@@ -359,29 +368,29 @@ cli.command(
359
368
  timeout
360
369
  }) => {
361
370
  process.env.NODE_ENV = "production";
362
- const { exportNotes } = await import("./export-BAZ4BSV6.mjs");
371
+ const { exportNotes } = await import("./export-N3YCMXVO.mjs");
363
372
  const port = await findFreePort(12445);
364
- const options = await resolveOptions({ entry }, "export");
365
- if (!output)
366
- output = options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${path.basename(entry, ".md")}-export-notes`;
367
- const server = await createServer(
368
- options,
369
- {
370
- server: { port },
371
- clearScreen: false
372
- }
373
- );
374
- await server.listen(port);
375
- printInfo(options);
376
- parser.filterDisabled(options.data);
377
- output = await exportNotes({
378
- port,
379
- output,
380
- timeout
381
- });
382
- console.log(`${green(" \u2713 ")}${dim("exported to ")}./${output}
373
+ for (const entryFile of entry) {
374
+ const options = await resolveOptions({ entry: entryFile }, "export");
375
+ const server = await createServer(
376
+ options,
377
+ {
378
+ server: { port },
379
+ clearScreen: false
380
+ }
381
+ );
382
+ await server.listen(port);
383
+ printInfo(options);
384
+ parser.filterDisabled(options.data);
385
+ const result = await exportNotes({
386
+ port,
387
+ output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${path.basename(entryFile, ".md")}-export-notes`),
388
+ timeout
389
+ });
390
+ console.log(`${green(" \u2713 ")}${dim("exported to ")}./${result}
383
391
  `);
384
- server.close();
392
+ server.close();
393
+ }
385
394
  process.exit(0);
386
395
  }
387
396
  );
@@ -1,6 +1,6 @@
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 _chunkUJ5GHVIIjs = require('./chunk-UJ5GHVII.js');
3
+ var _chunkGE7W2DBEjs = require('./chunk-GE7W2DBE.js');
4
4
 
5
5
  // node/export.ts
6
6
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -75,8 +75,8 @@ async function exportNotes({
75
75
  output = "notes",
76
76
  timeout = 3e4
77
77
  }) {
78
- if (!_chunkUJ5GHVIIjs.packageExists.call(void 0, "playwright-chromium"))
79
- throw new Error("The exporting for Slidev is powered by Playwright, please installed it via `npm i -D playwright-chromium`");
78
+ if (!_chunkGE7W2DBEjs.packageExists.call(void 0, "playwright-chromium"))
79
+ throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
80
80
  const { chromium } = await Promise.resolve().then(() => require("playwright-chromium"));
81
81
  const browser = await chromium.launch();
82
82
  const context = await browser.newContext();
@@ -121,8 +121,8 @@ async function exportSlides({
121
121
  withToc = false,
122
122
  perSlide = false
123
123
  }) {
124
- if (!_chunkUJ5GHVIIjs.packageExists.call(void 0, "playwright-chromium"))
125
- throw new Error("The exporting for Slidev is powered by Playwright, please installed it via `npm i -D playwright-chromium`");
124
+ if (!_chunkGE7W2DBEjs.packageExists.call(void 0, "playwright-chromium"))
125
+ throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
126
126
  const pages = _core.parseRangeString.call(void 0, total, range);
127
127
  const { chromium } = await Promise.resolve().then(() => require("playwright-chromium"));
128
128
  const browser = await chromium.launch({
@@ -131,6 +131,7 @@ async function exportSlides({
131
131
  const context = await browser.newContext({
132
132
  viewport: {
133
133
  width,
134
+ // Calculate height for every slides to be in the viewport to trigger the rendering of iframes (twitter, youtube...)
134
135
  height: perSlide ? height : height * pages.length
135
136
  },
136
137
  deviceScaleFactor: 1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  packageExists
3
- } from "./chunk-VLEV37KF.mjs";
3
+ } from "./chunk-CTG3GV2W.mjs";
4
4
 
5
5
  // node/export.ts
6
6
  import path from "path";
@@ -76,7 +76,7 @@ async function exportNotes({
76
76
  timeout = 3e4
77
77
  }) {
78
78
  if (!packageExists("playwright-chromium"))
79
- throw new Error("The exporting for Slidev is powered by Playwright, please installed it via `npm i -D playwright-chromium`");
79
+ throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
80
80
  const { chromium } = await import("playwright-chromium");
81
81
  const browser = await chromium.launch();
82
82
  const context = await browser.newContext();
@@ -122,7 +122,7 @@ async function exportSlides({
122
122
  perSlide = false
123
123
  }) {
124
124
  if (!packageExists("playwright-chromium"))
125
- throw new Error("The exporting for Slidev is powered by Playwright, please installed it via `npm i -D playwright-chromium`");
125
+ throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
126
126
  const pages = parseRangeString(total, range);
127
127
  const { chromium } = await import("playwright-chromium");
128
128
  const browser = await chromium.launch({
@@ -131,6 +131,7 @@ async function exportSlides({
131
131
  const context = await browser.newContext({
132
132
  viewport: {
133
133
  width,
134
+ // Calculate height for every slides to be in the viewport to trigger the rendering of iframes (twitter, youtube...)
134
135
  height: perSlide ? height : height * pages.length
135
136
  },
136
137
  deviceScaleFactor: 1
package/dist/index.js CHANGED
@@ -9,12 +9,12 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkRRNUXVEAjs = require('./chunk-RRNUXVEA.js');
12
+ var _chunkCKLR5LMVjs = require('./chunk-CKLR5LMV.js');
13
13
 
14
14
 
15
15
 
16
- var _chunkQU6XIJOBjs = require('./chunk-QU6XIJOB.js');
17
- require('./chunk-UJ5GHVII.js');
16
+ var _chunkFT5Y6KDWjs = require('./chunk-FT5Y6KDW.js');
17
+ require('./chunk-GE7W2DBE.js');
18
18
 
19
19
 
20
20
 
@@ -28,4 +28,4 @@ require('./chunk-UJ5GHVII.js');
28
28
 
29
29
 
30
30
 
31
- exports.ViteSlidevPlugin = _chunkQU6XIJOBjs.ViteSlidevPlugin; exports.createServer = _chunkRRNUXVEAjs.createServer; exports.createWindiCSSPlugin = _chunkQU6XIJOBjs.createWindiCSSPlugin; exports.getAddonRoots = _chunkRRNUXVEAjs.getAddonRoots; exports.getCLIRoot = _chunkRRNUXVEAjs.getCLIRoot; exports.getClientRoot = _chunkRRNUXVEAjs.getClientRoot; exports.getRoot = _chunkRRNUXVEAjs.getRoot; exports.getThemeRoots = _chunkRRNUXVEAjs.getThemeRoots; exports.getUserRoot = _chunkRRNUXVEAjs.getUserRoot; exports.isPath = _chunkRRNUXVEAjs.isPath; exports.parser = _chunkRRNUXVEAjs.parser; exports.resolveOptions = _chunkRRNUXVEAjs.resolveOptions;
31
+ exports.ViteSlidevPlugin = _chunkFT5Y6KDWjs.ViteSlidevPlugin; exports.createServer = _chunkCKLR5LMVjs.createServer; exports.createWindiCSSPlugin = _chunkFT5Y6KDWjs.createWindiCSSPlugin; exports.getAddonRoots = _chunkCKLR5LMVjs.getAddonRoots; exports.getCLIRoot = _chunkCKLR5LMVjs.getCLIRoot; exports.getClientRoot = _chunkCKLR5LMVjs.getClientRoot; exports.getRoot = _chunkCKLR5LMVjs.getRoot; exports.getThemeRoots = _chunkCKLR5LMVjs.getThemeRoots; exports.getUserRoot = _chunkCKLR5LMVjs.getUserRoot; exports.isPath = _chunkCKLR5LMVjs.isPath; exports.parser = _chunkCKLR5LMVjs.parser; exports.resolveOptions = _chunkCKLR5LMVjs.resolveOptions;
package/dist/index.mjs CHANGED
@@ -9,12 +9,12 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-EZ2J7PMK.mjs";
12
+ } from "./chunk-4FABOYKQ.mjs";
13
13
  import {
14
14
  ViteSlidevPlugin,
15
15
  createWindiCSSPlugin
16
- } from "./chunk-ZAT6O5HR.mjs";
17
- import "./chunk-VLEV37KF.mjs";
16
+ } from "./chunk-46GOGODM.mjs";
17
+ import "./chunk-CTG3GV2W.mjs";
18
18
  export {
19
19
  ViteSlidevPlugin,
20
20
  createServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.40.2",
3
+ "version": "0.40.4",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -44,24 +44,24 @@
44
44
  "dependencies": {
45
45
  "@antfu/utils": "^0.7.2",
46
46
  "@hedgedoc/markdown-it-plugins": "^2.0.0",
47
- "@iconify-json/carbon": "^1.1.14",
48
- "@iconify-json/ph": "^1.1.3",
47
+ "@iconify-json/carbon": "^1.1.16",
48
+ "@iconify-json/ph": "^1.1.5",
49
49
  "@lillallol/outline-pdf": "^4.0.0",
50
- "@vitejs/plugin-vue": "^4.0.0",
51
- "@vitejs/plugin-vue-jsx": "^3.0.0",
50
+ "@vitejs/plugin-vue": "^4.1.0",
51
+ "@vitejs/plugin-vue-jsx": "^3.0.1",
52
52
  "@windicss/config": "^1.8.10",
53
- "cli-progress": "^3.11.2",
53
+ "cli-progress": "^3.12.0",
54
54
  "codemirror": "^5.65.5",
55
55
  "connect": "^3.7.0",
56
56
  "debug": "^4.3.4",
57
57
  "fast-glob": "^3.2.12",
58
- "fs-extra": "^11.1.0",
58
+ "fs-extra": "^11.1.1",
59
59
  "get-port-please": "^3.0.1",
60
60
  "global-dirs": "^3.0.1",
61
61
  "import-from": "^4.0.0",
62
62
  "is-installed-globally": "^0.4.0",
63
- "jiti": "^1.16.2",
64
- "js-base64": "^3.7.4",
63
+ "jiti": "^1.18.2",
64
+ "js-base64": "^3.7.5",
65
65
  "katex": "^0.16.4",
66
66
  "kolorist": "^1.7.0",
67
67
  "localtunnel": "^2.0.2",
@@ -69,33 +69,33 @@
69
69
  "markdown-it-footnote": "^3.0.3",
70
70
  "markdown-it-link-attributes": "^4.0.1",
71
71
  "monaco-editor": "^0.33.0",
72
- "nanoid": "^4.0.0",
73
- "open": "^8.4.0",
72
+ "nanoid": "^4.0.1",
73
+ "open": "^9.0.0",
74
74
  "pdf-lib": "^1.17.1",
75
75
  "plantuml-encoder": "^1.4.0",
76
- "postcss-nested": "^6.0.0",
76
+ "postcss-nested": "^6.0.1",
77
77
  "prismjs": "^1.29.0",
78
78
  "prompts": "^2.4.2",
79
79
  "qrcode-terminal": "^0.12.0",
80
80
  "resolve": "^1.22.1",
81
81
  "resolve-from": "^5.0.0",
82
82
  "resolve-global": "^1.0.0",
83
- "shiki": "^0.14.0",
84
- "unocss": "^0.49.4",
85
- "unplugin-icons": "^0.15.2",
86
- "unplugin-vue-components": "^0.23.0",
87
- "vite": "^4.1.1",
88
- "vite-plugin-inspect": "^0.7.15",
89
- "vite-plugin-remote-assets": "^0.3.0",
90
- "vite-plugin-vue-markdown": "^0.22.2",
91
- "vite-plugin-vue-server-ref": "^0.3.0",
83
+ "shiki": "^0.14.1",
84
+ "unocss": "^0.50.6",
85
+ "unplugin-icons": "^0.15.3",
86
+ "unplugin-vue-components": "^0.24.1",
87
+ "vite": "^4.2.1",
88
+ "vite-plugin-inspect": "^0.7.18",
89
+ "vite-plugin-remote-assets": "^0.3.1",
90
+ "vite-plugin-vue-markdown": "^0.22.4",
91
+ "vite-plugin-vue-server-ref": "^0.3.1",
92
92
  "vite-plugin-windicss": "^1.8.10",
93
93
  "vue": "^3.2.47",
94
94
  "windicss": "^3.5.6",
95
- "yargs": "^17.6.2",
96
- "@slidev/client": "0.40.2",
97
- "@slidev/parser": "0.40.2",
98
- "@slidev/types": "0.40.2"
95
+ "yargs": "^17.7.1",
96
+ "@slidev/client": "0.40.4",
97
+ "@slidev/parser": "0.40.4",
98
+ "@slidev/types": "0.40.4"
99
99
  },
100
100
  "devDependencies": {
101
101
  "@types/plantuml-encoder": "^1.4.0",