@slidev/cli 0.46.1 → 0.46.3

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.
@@ -2,7 +2,7 @@ import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml,
4
4
  mergeViteConfigs
5
- } from "./chunk-FPUM6TIB.mjs";
5
+ } from "./chunk-BDBBIE6Z.mjs";
6
6
  import "./chunk-CTBVOVLQ.mjs";
7
7
  import "./chunk-5L3XKTHL.mjs";
8
8
  import "./chunk-BXO7ZPPU.mjs";
@@ -98,7 +98,7 @@ async function build(options, viteConfig = {}, args) {
98
98
  await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
99
99
  `, "utf-8");
100
100
  if ([true, "true", "auto"].includes(options.data.config.download)) {
101
- const { exportSlides, getExportOptions } = await import("./export-T7HYPK5J.mjs");
101
+ const { exportSlides, getExportOptions } = await import("./export-WYWYD5MK.mjs");
102
102
  const port = 12445;
103
103
  const app = connect();
104
104
  const server = http.createServer(app);
@@ -139,28 +139,28 @@ var dependencies = {
139
139
  "@antfu/utils": "^0.7.7",
140
140
  "@slidev/parser": "workspace:*",
141
141
  "@slidev/types": "workspace:*",
142
- "@unhead/vue": "^1.8.9",
143
- "@unocss/reset": "^0.58.0",
144
- "@vueuse/core": "^10.7.0",
145
- "@vueuse/math": "^10.7.0",
142
+ "@unhead/vue": "^1.8.10",
143
+ "@unocss/reset": "^0.58.3",
144
+ "@vueuse/core": "^10.7.2",
145
+ "@vueuse/math": "^10.7.2",
146
146
  "@vueuse/motion": "^2.0.0",
147
147
  codemirror: "^5.65.5",
148
- defu: "^6.1.3",
148
+ defu: "^6.1.4",
149
149
  drauu: "^0.3.7",
150
150
  "file-saver": "^2.0.5",
151
151
  "fuse.js": "^7.0.0",
152
- "js-base64": "^3.7.5",
152
+ "js-base64": "^3.7.6",
153
153
  "js-yaml": "^4.1.0",
154
154
  katex: "^0.16.9",
155
- mermaid: "^10.6.1",
155
+ mermaid: "^10.7.0",
156
156
  "monaco-editor": "^0.37.1",
157
157
  nanoid: "^5.0.4",
158
- prettier: "^3.1.1",
158
+ prettier: "^3.2.4",
159
159
  recordrtc: "^5.6.2",
160
160
  resolve: "^1.22.8",
161
- unocss: "^0.58.0",
162
- "vite-plugin-windicss": "^1.9.2",
163
- vue: "^3.3.12",
161
+ unocss: "^0.58.3",
162
+ "vite-plugin-windicss": "^1.9.3",
163
+ vue: "^3.4.15",
164
164
  "vue-router": "^4.2.5",
165
165
  "vue-starport": "^0.4.0",
166
166
  windicss: "^3.5.6"
@@ -1530,10 +1530,11 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
1530
1530
  });
1531
1531
  }
1532
1532
  function transformKaTex(md2) {
1533
- return md2.replace(/^\$\$(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?\s*?)?\n([\s\S]+?)^\$\$/mg, (full, rangeStr = "", _, code) => {
1533
+ return md2.replace(/^\$\$(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?\s*?)?\n([\s\S]+?)^\$\$/mg, (full, rangeStr = "", options = "", code) => {
1534
1534
  const ranges = rangeStr.split(/\|/g).map((i) => i.trim());
1535
1535
  code = code.trimEnd();
1536
- return `<KaTexBlockWrapper :ranges='${JSON.stringify(ranges)}'>
1536
+ options = options.trim() || "{}";
1537
+ return `<KaTexBlockWrapper v-bind="${options}" :ranges='${JSON.stringify(ranges)}'>
1537
1538
 
1538
1539
  $$
1539
1540
  ${code}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-FPUM6TIB.mjs";
4
+ } from "./chunk-BDBBIE6Z.mjs";
5
5
  import {
6
6
  packageExists,
7
7
  resolveImportPath
@@ -2523,7 +2523,7 @@ async function createServer(options2, viteConfig = {}, serverOptions = {}) {
2523
2523
  import * as parser from "@slidev/parser/fs";
2524
2524
 
2525
2525
  // package.json
2526
- var version = "0.46.1";
2526
+ var version = "0.46.3";
2527
2527
 
2528
2528
  // node/themes.ts
2529
2529
  import prompts2 from "prompts";
package/dist/cli.mjs CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  resolveOptions,
10
10
  resolveThemeName,
11
11
  version
12
- } from "./chunk-RRC2SQPF.mjs";
13
- import "./chunk-FPUM6TIB.mjs";
12
+ } from "./chunk-P5XEHWCU.mjs";
13
+ import "./chunk-BDBBIE6Z.mjs";
14
14
  import {
15
15
  loadSetups
16
16
  } from "./chunk-CTBVOVLQ.mjs";
@@ -269,7 +269,7 @@ cli.command(
269
269
  }).strict().help(),
270
270
  async (args) => {
271
271
  const { entry, theme, watch, base, download, out, inspect } = args;
272
- const { build } = await import("./build-Q7WKYPRH.mjs");
272
+ const { build } = await import("./build-XIN6SGB6.mjs");
273
273
  for (const entryFile of entry) {
274
274
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
275
275
  if (download && !options.data.config.download)
@@ -348,7 +348,7 @@ cli.command(
348
348
  async (args) => {
349
349
  const { entry, theme } = args;
350
350
  process.env.NODE_ENV = "production";
351
- const { exportSlides, getExportOptions } = await import("./export-T7HYPK5J.mjs");
351
+ const { exportSlides, getExportOptions } = await import("./export-WYWYD5MK.mjs");
352
352
  const port = await findFreePort(12445);
353
353
  for (const entryFile of entry) {
354
354
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
@@ -394,7 +394,7 @@ cli.command(
394
394
  timeout
395
395
  }) => {
396
396
  process.env.NODE_ENV = "production";
397
- const { exportNotes } = await import("./export-T7HYPK5J.mjs");
397
+ const { exportNotes } = await import("./export-WYWYD5MK.mjs");
398
398
  const port = await findFreePort(12445);
399
399
  for (const entryFile of entry) {
400
400
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -208,7 +208,7 @@ async function exportSlides({
208
208
  await genPageWithClicks(genPdfBuffer, i);
209
209
  progress.update(++idx);
210
210
  }
211
- const mergedPdf = await PDFDocument.create({});
211
+ let mergedPdf = await PDFDocument.create({});
212
212
  for (const pdfBytes of buffers) {
213
213
  const pdf = await PDFDocument.load(pdfBytes);
214
214
  const copiedPages = await mergedPdf.copyPages(pdf, pdf.getPageIndices());
@@ -216,12 +216,14 @@ async function exportSlides({
216
216
  mergedPdf.addPage(page2);
217
217
  });
218
218
  }
219
+ addPdfMetadata(mergedPdf);
220
+ if (withToc)
221
+ mergedPdf = await addTocToPdf(mergedPdf);
219
222
  const buffer = await mergedPdf.save();
220
223
  await fs.writeFile(output, buffer);
221
224
  }
222
225
  async function genPagePdfOnePiece() {
223
226
  await go("print");
224
- const slideIndexes = await getSlidesIndex();
225
227
  await page.pdf({
226
228
  path: output,
227
229
  width,
@@ -237,28 +239,9 @@ async function exportSlides({
237
239
  });
238
240
  let pdfData = await fs.readFile(output);
239
241
  let pdf = await PDFDocument.load(pdfData);
240
- const titleSlide = slides[0];
241
- if (titleSlide?.title)
242
- pdf.setTitle(titleSlide.title);
243
- if (titleSlide?.frontmatter?.info)
244
- pdf.setSubject(titleSlide.frontmatter.info);
245
- if (titleSlide?.frontmatter?.author)
246
- pdf.setAuthor(titleSlide.frontmatter.author);
247
- if (titleSlide?.frontmatter?.keywords) {
248
- if (Array.isArray(titleSlide?.frontmatter?.keywords))
249
- pdf.setKeywords(titleSlide?.frontmatter?.keywords);
250
- else
251
- pdf.setKeywords(titleSlide?.frontmatter?.keywords.split(","));
252
- }
253
- if (withToc) {
254
- const outlinePdf = outlinePdfFactory(pdfLib);
255
- const tocTree = slides.filter((slide) => slide.title).reduce((acc, slide) => {
256
- addToTree(acc, slide, slideIndexes);
257
- return acc;
258
- }, []);
259
- const outline = makeOutline(tocTree);
260
- pdf = await outlinePdf({ outline, pdf });
261
- }
242
+ addPdfMetadata(pdf);
243
+ if (withToc)
244
+ pdf = await addTocToPdf(pdf);
262
245
  pdfData = Buffer.from(await pdf.save());
263
246
  await fs.writeFile(output, pdfData);
264
247
  }
@@ -318,6 +301,31 @@ async function exportSlides({
318
301
  const slideId = file.substring(0, file.indexOf(".")).split("-")[0];
319
302
  return Number(slideId) - 1;
320
303
  }
304
+ function addPdfMetadata(pdf) {
305
+ const titleSlide = slides[0];
306
+ if (titleSlide?.title)
307
+ pdf.setTitle(titleSlide.title);
308
+ if (titleSlide?.frontmatter?.info)
309
+ pdf.setSubject(titleSlide.frontmatter.info);
310
+ if (titleSlide?.frontmatter?.author)
311
+ pdf.setAuthor(titleSlide.frontmatter.author);
312
+ if (titleSlide?.frontmatter?.keywords) {
313
+ if (Array.isArray(titleSlide?.frontmatter?.keywords))
314
+ pdf.setKeywords(titleSlide?.frontmatter?.keywords);
315
+ else
316
+ pdf.setKeywords(titleSlide?.frontmatter?.keywords.split(","));
317
+ }
318
+ }
319
+ async function addTocToPdf(pdf) {
320
+ const outlinePdf = outlinePdfFactory(pdfLib);
321
+ const slideIndexes = await getSlidesIndex();
322
+ const tocTree = slides.filter((slide) => slide.title).reduce((acc, slide) => {
323
+ addToTree(acc, slide, slideIndexes);
324
+ return acc;
325
+ }, []);
326
+ const outline = makeOutline(tocTree);
327
+ return await outlinePdf({ outline, pdf });
328
+ }
321
329
  progress.start(pages.length);
322
330
  if (format === "pdf") {
323
331
  await genPagePdf();
package/dist/index.mjs CHANGED
@@ -9,13 +9,13 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-RRC2SQPF.mjs";
12
+ } from "./chunk-P5XEHWCU.mjs";
13
13
  import {
14
14
  createWindiCSSPlugin
15
15
  } from "./chunk-GLZC72RJ.mjs";
16
16
  import {
17
17
  ViteSlidevPlugin
18
- } from "./chunk-FPUM6TIB.mjs";
18
+ } from "./chunk-BDBBIE6Z.mjs";
19
19
  import "./chunk-CTBVOVLQ.mjs";
20
20
  import "./chunk-5L3XKTHL.mjs";
21
21
  import "./chunk-BXO7ZPPU.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.46.1",
3
+ "version": "0.46.3",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -43,15 +43,15 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@antfu/utils": "^0.7.7",
46
- "@iconify-json/carbon": "^1.1.26",
47
- "@iconify-json/ph": "^1.1.9",
46
+ "@iconify-json/carbon": "^1.1.28",
47
+ "@iconify-json/ph": "^1.1.10",
48
48
  "@lillallol/outline-pdf": "^4.0.0",
49
49
  "@mrdrogdrog/optional": "^1.2.1",
50
- "@unocss/extractor-mdc": "^0.58.0",
51
- "@unocss/reset": "^0.58.0",
52
- "@vitejs/plugin-vue": "^4.5.2",
50
+ "@unocss/extractor-mdc": "^0.58.3",
51
+ "@unocss/reset": "^0.58.3",
52
+ "@vitejs/plugin-vue": "^5.0.3",
53
53
  "@vitejs/plugin-vue-jsx": "^3.1.0",
54
- "@windicss/config": "^1.9.2",
54
+ "@windicss/config": "^1.9.3",
55
55
  "cli-progress": "^3.12.0",
56
56
  "codemirror": "^5.65.5",
57
57
  "connect": "^3.7.0",
@@ -59,13 +59,13 @@
59
59
  "fast-deep-equal": "^3.1.3",
60
60
  "fast-glob": "^3.3.2",
61
61
  "fs-extra": "^11.2.0",
62
- "get-port-please": "^3.1.1",
62
+ "get-port-please": "^3.1.2",
63
63
  "global-directory": "^4.0.1",
64
- "htmlparser2": "^9.0.0",
64
+ "htmlparser2": "^9.1.0",
65
65
  "import-from": "^4.0.0",
66
66
  "is-installed-globally": "^1.0.0",
67
67
  "jiti": "^1.21.0",
68
- "js-base64": "^3.7.5",
68
+ "js-base64": "^3.7.6",
69
69
  "katex": "^0.16.9",
70
70
  "kolorist": "^1.8.0",
71
71
  "local-pkg": "^0.5.0",
@@ -74,10 +74,10 @@
74
74
  "markdown-it-footnote": "^4.0.0",
75
75
  "markdown-it-link-attributes": "^4.0.1",
76
76
  "markdown-it-mdc": "^0.2.1",
77
- "markdown-it-shikiji": "^0.9.9",
77
+ "markdown-it-shikiji": "^0.9.19",
78
78
  "monaco-editor": "^0.37.1",
79
79
  "nanoid": "^5.0.4",
80
- "open": "^9.1.0",
80
+ "open": "^10.0.3",
81
81
  "pdf-lib": "^1.17.1",
82
82
  "plantuml-encoder": "^1.4.0",
83
83
  "postcss-nested": "^6.0.1",
@@ -87,28 +87,28 @@
87
87
  "resolve": "^1.22.8",
88
88
  "resolve-from": "^5.0.0",
89
89
  "resolve-global": "^2.0.0",
90
- "shikiji": "^0.9.9",
91
- "shiki": "npm:shikiji-compat@^0.9.9",
92
- "shikiji-twoslash": "^0.9.9",
93
- "sirv": "^2.0.3",
94
- "unocss": "^0.58.0",
95
- "unplugin-icons": "^0.18.1",
90
+ "shikiji": "^0.9.19",
91
+ "shiki": "npm:shikiji-compat@^0.9.19",
92
+ "shikiji-twoslash": "^0.9.19",
93
+ "sirv": "^2.0.4",
94
+ "unocss": "^0.58.3",
95
+ "unplugin-icons": "^0.18.2",
96
96
  "unplugin-vue-components": "^0.26.0",
97
97
  "unplugin-vue-markdown": "^0.25.2",
98
98
  "uqr": "^0.1.2",
99
- "vite": "^5.0.10",
99
+ "vite": "^5.0.12",
100
100
  "vite-plugin-inspect": "^0.8.1",
101
- "vite-plugin-remote-assets": "^0.4.0",
101
+ "vite-plugin-remote-assets": "^0.4.1",
102
102
  "vite-plugin-static-copy": "^1.0.0",
103
103
  "vite-plugin-vue-server-ref": "^0.4.0",
104
- "vite-plugin-windicss": "^1.9.2",
104
+ "vite-plugin-windicss": "^1.9.3",
105
105
  "vitefu": "^0.2.5",
106
- "vue": "^3.3.12",
106
+ "vue": "^3.4.15",
107
107
  "windicss": "^3.5.6",
108
108
  "yargs": "^17.7.2",
109
- "@slidev/parser": "0.46.1",
110
- "@slidev/client": "0.46.1",
111
- "@slidev/types": "0.46.1"
109
+ "@slidev/client": "0.46.3",
110
+ "@slidev/parser": "0.46.3",
111
+ "@slidev/types": "0.46.3"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@hedgedoc/markdown-it-plugins": "^2.1.4",