@slidev/cli 0.48.6 → 0.48.8

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-M3AHQMLP.mjs";
5
+ } from "./chunk-D66Q4K5C.mjs";
6
6
  import "./chunk-LOUKLO2C.mjs";
7
7
  import "./chunk-AQQIBD5X.mjs";
8
8
 
@@ -62,7 +62,7 @@ async function build(options, viteConfig = {}, args) {
62
62
  await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
63
63
  `, "utf-8");
64
64
  if ([true, "true", "auto"].includes(options.data.config.download)) {
65
- const { exportSlides, getExportOptions } = await import("./export-674XF5SK.mjs");
65
+ const { exportSlides, getExportOptions } = await import("./export-H5Y2LN6J.mjs");
66
66
  const port = 12445;
67
67
  const app = connect();
68
68
  const server = http.createServer(app);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-M3AHQMLP.mjs";
4
+ } from "./chunk-D66Q4K5C.mjs";
5
5
  import {
6
6
  createResolver,
7
7
  getRoots,
@@ -48,7 +48,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
48
48
  import * as parser from "@slidev/parser/fs";
49
49
 
50
50
  // package.json
51
- var version = "0.48.6";
51
+ var version = "0.48.8";
52
52
 
53
53
  // node/integrations/themes.ts
54
54
  import { join as join2 } from "node:path";
@@ -140,14 +140,14 @@ var dependencies = {
140
140
  "@iconify-json/carbon": "^1.1.31",
141
141
  "@iconify-json/ph": "^1.1.11",
142
142
  "@iconify-json/svg-spinners": "^1.1.2",
143
- "@shikijs/monaco": "^1.1.7",
144
- "@shikijs/vitepress-twoslash": "^1.1.7",
143
+ "@shikijs/monaco": "^1.2.1",
144
+ "@shikijs/vitepress-twoslash": "^1.2.1",
145
145
  "@slidev/parser": "workspace:*",
146
146
  "@slidev/rough-notation": "^0.1.0",
147
147
  "@slidev/types": "workspace:*",
148
148
  "@typescript/ata": "^0.9.4",
149
- "@unhead/vue": "^1.8.18",
150
- "@unocss/reset": "^0.58.5",
149
+ "@unhead/vue": "^1.9.3",
150
+ "@unocss/reset": "^0.58.8",
151
151
  "@vueuse/core": "^10.9.0",
152
152
  "@vueuse/math": "^10.9.0",
153
153
  "@vueuse/motion": "^2.1.0",
@@ -157,16 +157,16 @@ var dependencies = {
157
157
  "floating-vue": "^5.2.2",
158
158
  "fuse.js": "^7.0.0",
159
159
  "js-yaml": "^4.1.0",
160
- katex: "^0.16.9",
160
+ katex: "^0.16.10",
161
161
  "lz-string": "^1.5.0",
162
162
  mermaid: "^10.9.0",
163
163
  "monaco-editor": "^0.47.0",
164
164
  prettier: "^3.2.5",
165
165
  recordrtc: "^5.6.2",
166
- shiki: "^1.1.7",
166
+ shiki: "^1.2.1",
167
167
  "shiki-magic-move": "^0.3.4",
168
- typescript: "^5.4.2",
169
- unocss: "^0.58.5",
168
+ typescript: "^5.4.3",
169
+ unocss: "^0.58.8",
170
170
  vue: "^3.4.21",
171
171
  "vue-demi": "^0.14.7",
172
172
  "vue-router": "^4.3.0"
@@ -232,7 +232,7 @@ function createConfigPlugin(options) {
232
232
  },
233
233
  {
234
234
  find: "vue",
235
- replacement: await resolveImportPath("vue/dist/vue.esm-browser.js", true)
235
+ replacement: await resolveImportPath("vue/dist/vue.esm-bundler.js", true)
236
236
  }
237
237
  ],
238
238
  dedupe: ["vue"]
@@ -768,12 +768,20 @@ var templateStyle = {
768
768
  var templateTitleRendererMd = {
769
769
  id: "/@slidev/title-renderer.md",
770
770
  async getContent({ data }) {
771
- const lines = data.slides.map(({ title }, i) => `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">
771
+ const lines = data.slides.map(({ title }, i) => `<template ${i === 0 ? "v-if" : "v-else-if"}="no === ${i + 1}">
772
772
 
773
773
  ${title}
774
774
 
775
775
  </template>`);
776
- lines.push(`<script setup lang="ts">defineProps<{ no: number | string }>()</script>`);
776
+ lines.push(
777
+ `<script setup lang="ts">`,
778
+ `import { useSlideContext } from '@slidev/client'`,
779
+ `import { computed } from 'vue'`,
780
+ `const props = defineProps<{ no?: number | string }>()`,
781
+ `const { $page } = useSlideContext()`,
782
+ `const no = computed(() => +(props.no ?? $page.value))`,
783
+ `</script>`
784
+ );
777
785
  return lines.join("\n");
778
786
  }
779
787
  };
@@ -1245,7 +1253,7 @@ ${code}`;
1245
1253
  import Markdown2 from "unplugin-vue-markdown/vite";
1246
1254
  import { isTruthy as isTruthy3, slash } from "@antfu/utils";
1247
1255
 
1248
- // ../../node_modules/.pnpm/@hedgedoc+markdown-it-plugins@2.1.4_patch_hash=tuyuxytl56b2vxulpkzt2wf4o4_markdown-it@14.0.0/node_modules/@hedgedoc/markdown-it-plugins/dist/esm/image-size/specialCharacters.js
1256
+ // ../../node_modules/.pnpm/@hedgedoc+markdown-it-plugins@2.1.4_patch_hash=tuyuxytl56b2vxulpkzt2wf4o4_markdown-it@14.1.0/node_modules/@hedgedoc/markdown-it-plugins/dist/esm/image-size/specialCharacters.js
1249
1257
  var SpecialCharacters;
1250
1258
  (function(SpecialCharacters2) {
1251
1259
  SpecialCharacters2[SpecialCharacters2["EXCLAMATION_MARK"] = 33] = "EXCLAMATION_MARK";
@@ -1261,7 +1269,7 @@ var SpecialCharacters;
1261
1269
  SpecialCharacters2[SpecialCharacters2["CLOSING_PARENTHESIS"] = 41] = "CLOSING_PARENTHESIS";
1262
1270
  })(SpecialCharacters || (SpecialCharacters = {}));
1263
1271
 
1264
- // ../../node_modules/.pnpm/@hedgedoc+markdown-it-plugins@2.1.4_patch_hash=tuyuxytl56b2vxulpkzt2wf4o4_markdown-it@14.0.0/node_modules/@hedgedoc/markdown-it-plugins/dist/esm/task-lists/index.js
1272
+ // ../../node_modules/.pnpm/@hedgedoc+markdown-it-plugins@2.1.4_patch_hash=tuyuxytl56b2vxulpkzt2wf4o4_markdown-it@14.1.0/node_modules/@hedgedoc/markdown-it-plugins/dist/esm/task-lists/index.js
1265
1273
  import Token from "markdown-it/lib/token.mjs";
1266
1274
  var checkboxRegex = /^ *\[([\sx])] /i;
1267
1275
  function taskLists(md2, options = { enabled: false, label: false, lineNumber: false }) {
package/dist/cli.mjs CHANGED
@@ -6,8 +6,8 @@ import {
6
6
  resolveOptions,
7
7
  resolveTheme,
8
8
  version
9
- } from "./chunk-2FVGDH3A.mjs";
10
- import "./chunk-M3AHQMLP.mjs";
9
+ } from "./chunk-4HC3TZOH.mjs";
10
+ import "./chunk-D66Q4K5C.mjs";
11
11
  import {
12
12
  loadSetups
13
13
  } from "./chunk-LOUKLO2C.mjs";
@@ -325,7 +325,7 @@ cli.command(
325
325
  }).strict().help(),
326
326
  async (args) => {
327
327
  const { entry, theme, watch, base, download, out, inspect } = args;
328
- const { build } = await import("./build-A5ALFNZS.mjs");
328
+ const { build } = await import("./build-6U4JAACM.mjs");
329
329
  for (const entryFile of entry) {
330
330
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
331
331
  if (download && !options.data.config.download)
@@ -406,7 +406,7 @@ cli.command(
406
406
  (args) => exportOptions(commonOptions(args)).strict().help(),
407
407
  async (args) => {
408
408
  const { entry, theme } = args;
409
- const { exportSlides, getExportOptions } = await import("./export-674XF5SK.mjs");
409
+ const { exportSlides, getExportOptions } = await import("./export-H5Y2LN6J.mjs");
410
410
  const port = await getPort(12445);
411
411
  for (const entryFile of entry) {
412
412
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
@@ -444,13 +444,18 @@ cli.command(
444
444
  default: 3e4,
445
445
  type: "number",
446
446
  describe: "timeout for rendering the print page"
447
+ }).option("wait", {
448
+ default: 0,
449
+ type: "number",
450
+ describe: "wait for the specified ms before exporting"
447
451
  }).strict().help(),
448
452
  async ({
449
453
  entry,
450
454
  output,
451
- timeout
455
+ timeout,
456
+ wait
452
457
  }) => {
453
- const { exportNotes } = await import("./export-674XF5SK.mjs");
458
+ const { exportNotes } = await import("./export-H5Y2LN6J.mjs");
454
459
  const port = await getPort(12445);
455
460
  for (const entryFile of entry) {
456
461
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -466,7 +471,8 @@ cli.command(
466
471
  const result = await exportNotes({
467
472
  port,
468
473
  output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${path.basename(entryFile, ".md")}-export-notes`),
469
- timeout
474
+ timeout,
475
+ wait
470
476
  });
471
477
  console.log(`${green(" \u2713 ")}${dim("exported to ")}./${result}
472
478
  `);
@@ -498,6 +504,9 @@ function exportOptions(args) {
498
504
  }).option("timeout", {
499
505
  type: "number",
500
506
  describe: "timeout for rendering the print page"
507
+ }).option("wait", {
508
+ type: "number",
509
+ describe: "wait for the specified ms before exporting"
501
510
  }).option("range", {
502
511
  type: "string",
503
512
  describe: 'page ranges to export, for example "1,4-5,6"'
@@ -75,7 +75,8 @@ async function exportNotes({
75
75
  port = 18724,
76
76
  base = "/",
77
77
  output = "notes",
78
- timeout = 3e4
78
+ timeout = 3e4,
79
+ wait = 0
79
80
  }) {
80
81
  const { chromium } = await importPlaywright();
81
82
  const browser = await chromium.launch();
@@ -88,6 +89,8 @@ async function exportNotes({
88
89
  await page.goto(`http://localhost:${port}${base}presenter/print`, { waitUntil: "networkidle", timeout });
89
90
  await page.waitForLoadState("networkidle");
90
91
  await page.emulateMedia({ media: "screen" });
92
+ if (wait)
93
+ await page.waitForTimeout(wait);
91
94
  await page.pdf({
92
95
  path: output,
93
96
  margin: {
@@ -112,6 +115,7 @@ async function exportSlides({
112
115
  slides,
113
116
  base = "/",
114
117
  timeout = 3e4,
118
+ wait = 0,
115
119
  dark = false,
116
120
  routerMode = "history",
117
121
  width = 1920,
@@ -155,8 +159,8 @@ async function exportSlides({
155
159
  });
156
160
  await page.waitForLoadState("networkidle");
157
161
  await page.emulateMedia({ colorScheme: dark ? "dark" : "light", media: "screen" });
158
- const slide = page.locator(`[data-slidev-no="${no}"]`);
159
- await slide.waitFor({ state: "visible" });
162
+ const slide = no === "print" ? page.locator("body") : page.locator(`[data-slidev-no="${no}"]`);
163
+ await slide.waitFor();
160
164
  {
161
165
  const elements = slide.locator(".slidev-slide-loading");
162
166
  const count = await elements.count();
@@ -202,6 +206,8 @@ async function exportSlides({
202
206
  await element.evaluate((node) => node.style.display = "none");
203
207
  }
204
208
  }
209
+ if (wait)
210
+ await page.waitForTimeout(wait);
205
211
  }
206
212
  async function getSlidesIndex() {
207
213
  const clicksBySlide = {};
@@ -403,6 +409,7 @@ function getExportOptions(args, options, outDir, outFilename) {
403
409
  output,
404
410
  format,
405
411
  timeout,
412
+ wait,
406
413
  range,
407
414
  dark,
408
415
  withClicks,
@@ -421,6 +428,7 @@ function getExportOptions(args, options, outDir, outFilename) {
421
428
  range,
422
429
  format: format || "pdf",
423
430
  timeout: timeout ?? 3e4,
431
+ wait: wait ?? 0,
424
432
  dark: dark || options.data.config.colorSchema === "dark",
425
433
  routerMode: options.data.config.routerMode,
426
434
  width: options.data.config.canvasWidth,
package/dist/index.mjs CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createServer,
3
3
  parser,
4
4
  resolveOptions
5
- } from "./chunk-2FVGDH3A.mjs";
5
+ } from "./chunk-4HC3TZOH.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
- } from "./chunk-M3AHQMLP.mjs";
8
+ } from "./chunk-D66Q4K5C.mjs";
9
9
  import "./chunk-LOUKLO2C.mjs";
10
10
  import "./chunk-AQQIBD5X.mjs";
11
11
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.48.6",
3
+ "version": "0.48.8",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -48,11 +48,11 @@
48
48
  "@iconify-json/ph": "^1.1.11",
49
49
  "@iconify-json/svg-spinners": "^1.1.2",
50
50
  "@lillallol/outline-pdf": "^4.0.0",
51
- "@shikijs/markdown-it": "^1.1.7",
52
- "@shikijs/twoslash": "^1.1.7",
53
- "@shikijs/vitepress-twoslash": "^1.1.7",
54
- "@unocss/extractor-mdc": "^0.58.5",
55
- "@unocss/reset": "^0.58.5",
51
+ "@shikijs/markdown-it": "^1.2.1",
52
+ "@shikijs/twoslash": "^1.2.1",
53
+ "@shikijs/vitepress-twoslash": "^1.2.1",
54
+ "@unocss/extractor-mdc": "^0.58.8",
55
+ "@unocss/reset": "^0.58.8",
56
56
  "@vitejs/plugin-vue": "^5.0.4",
57
57
  "@vitejs/plugin-vue-jsx": "^3.1.0",
58
58
  "chokidar": "^3.6.0",
@@ -68,11 +68,11 @@
68
68
  "htmlparser2": "^9.1.0",
69
69
  "is-installed-globally": "^1.0.0",
70
70
  "jiti": "^1.21.0",
71
- "katex": "^0.16.9",
71
+ "katex": "^0.16.10",
72
72
  "kolorist": "^1.8.0",
73
73
  "local-pkg": "^0.5.0",
74
74
  "lz-string": "^1.5.0",
75
- "markdown-it": "^14.0.0",
75
+ "markdown-it": "^14.1.0",
76
76
  "markdown-it-footnote": "^4.0.0",
77
77
  "markdown-it-link-attributes": "^4.0.1",
78
78
  "markdown-it-mdc": "^0.2.3",
@@ -84,31 +84,31 @@
84
84
  "postcss-nested": "^6.0.1",
85
85
  "prismjs": "^1.29.0",
86
86
  "prompts": "^2.4.2",
87
- "public-ip": "^6.0.1",
87
+ "public-ip": "^6.0.2",
88
88
  "resolve-from": "^5.0.0",
89
89
  "resolve-global": "^2.0.0",
90
90
  "semver": "^7.6.0",
91
- "shiki": "^1.1.7",
91
+ "shiki": "^1.2.1",
92
92
  "shiki-magic-move": "^0.3.4",
93
93
  "sirv": "^2.0.4",
94
- "typescript": "^5.4.2",
95
- "unocss": "^0.58.5",
94
+ "typescript": "^5.4.3",
95
+ "unocss": "^0.58.8",
96
96
  "unplugin-icons": "^0.18.5",
97
97
  "unplugin-vue-components": "^0.26.0",
98
98
  "unplugin-vue-markdown": "^0.26.0",
99
99
  "untun": "^0.1.3",
100
100
  "uqr": "^0.1.2",
101
- "vite": "^5.1.6",
101
+ "vite": "^5.2.7",
102
102
  "vite-plugin-inspect": "^0.8.3",
103
103
  "vite-plugin-remote-assets": "^0.4.1",
104
- "vite-plugin-static-copy": "^1.0.1",
104
+ "vite-plugin-static-copy": "^1.0.2",
105
105
  "vite-plugin-vue-server-ref": "^0.4.2",
106
106
  "vitefu": "^0.2.5",
107
107
  "vue": "^3.4.21",
108
108
  "yargs": "^17.7.2",
109
- "@slidev/parser": "0.48.6",
110
- "@slidev/client": "0.48.6",
111
- "@slidev/types": "0.48.6"
109
+ "@slidev/parser": "0.48.8",
110
+ "@slidev/types": "0.48.8",
111
+ "@slidev/client": "0.48.8"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@hedgedoc/markdown-it-plugins": "^2.1.4",