@slidev/cli 0.48.7 → 0.48.9

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-STSW6326.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-F3TWPZMI.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-STSW6326.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.7";
51
+ var version = "0.48.9";
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.3",
144
+ "@shikijs/vitepress-twoslash": "^1.2.3",
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.4",
150
+ "@unocss/reset": "^0.58.9",
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",
167
- "shiki-magic-move": "^0.3.4",
168
- typescript: "^5.4.2",
169
- unocss: "^0.58.5",
166
+ shiki: "^1.2.3",
167
+ "shiki-magic-move": "^0.3.5",
168
+ typescript: "^5.4.3",
169
+ unocss: "^0.58.9",
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"]
@@ -476,38 +476,42 @@ import { uniq as uniq2 } from "@antfu/utils";
476
476
  // node/syntax/transform/monaco.ts
477
477
  import { isTruthy } from "@antfu/utils";
478
478
  import lz from "lz-string";
479
- function transformMonaco(md2, enabled = true) {
480
- if (!enabled)
481
- return truncateMancoMark(md2);
482
- md2 = md2.replace(
479
+ function transformMonaco(ctx, enabled = true) {
480
+ if (!enabled) {
481
+ ctx.s.replace(/{monaco([\w:,-]*)}/g, "");
482
+ return;
483
+ }
484
+ ctx.s.replace(
483
485
  /^```(\w+?)\s*{monaco-diff}\s*?({.*?})?\s*?\n([\s\S]+?)^~~~\s*?\n([\s\S]+?)^```/mg,
484
- (full, lang = "ts", options = "{}", code, diff) => {
486
+ (full, lang = "ts", options = "{}", code, diff, index) => {
485
487
  lang = lang.trim();
486
488
  options = options.trim() || "{}";
487
489
  const encoded = lz.compressToBase64(code);
488
490
  const encodedDiff = lz.compressToBase64(diff);
491
+ ctx.ignores.push([index, index + full.length]);
489
492
  return `<Monaco code-lz="${encoded}" diff-lz="${encodedDiff}" lang="${lang}" v-bind="${options}" />`;
490
493
  }
491
494
  );
492
- md2 = md2.replace(
495
+ ctx.s.replace(
493
496
  /^```(\w+?)\s*{monaco}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg,
494
- (full, lang = "ts", options = "{}", code) => {
497
+ (full, lang = "ts", options = "{}", code, index) => {
495
498
  lang = lang.trim();
496
499
  options = options.trim() || "{}";
497
500
  const encoded = lz.compressToBase64(code);
501
+ ctx.ignores.push([index, index + full.length]);
498
502
  return `<Monaco code-lz="${encoded}" lang="${lang}" v-bind="${options}" />`;
499
503
  }
500
504
  );
501
- md2 = md2.replace(
505
+ ctx.s.replace(
502
506
  /^```(\w+?)\s*{monaco-run}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg,
503
- (full, lang = "ts", options = "{}", code) => {
507
+ (full, lang = "ts", options = "{}", code, index) => {
504
508
  lang = lang.trim();
505
509
  options = options.trim() || "{}";
506
510
  const encoded = lz.compressToBase64(code);
511
+ ctx.ignores.push([index, index + full.length]);
507
512
  return `<Monaco runnable code-lz="${encoded}" lang="${lang}" v-bind="${options}" />`;
508
513
  }
509
514
  );
510
- return md2;
511
515
  }
512
516
  function scanMonacoModules(md2) {
513
517
  const typeModules = /* @__PURE__ */ new Set();
@@ -524,9 +528,6 @@ function scanMonacoModules(md2) {
524
528
  );
525
529
  return Array.from(typeModules);
526
530
  }
527
- function truncateMancoMark(md2) {
528
- return md2.replace(/{monaco([\w:,-]*)}/g, "");
529
- }
530
531
 
531
532
  // node/virtual/monaco-types.ts
532
533
  var templateMonacoTypes = {
@@ -768,12 +769,20 @@ var templateStyle = {
768
769
  var templateTitleRendererMd = {
769
770
  id: "/@slidev/title-renderer.md",
770
771
  async getContent({ data }) {
771
- const lines = data.slides.map(({ title }, i) => `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">
772
+ const lines = data.slides.map(({ title }, i) => `<template ${i === 0 ? "v-if" : "v-else-if"}="no === ${i + 1}">
772
773
 
773
774
  ${title}
774
775
 
775
776
  </template>`);
776
- lines.push(`<script setup lang="ts">defineProps<{ no: number | string }>()</script>`);
777
+ lines.push(
778
+ `<script setup lang="ts">`,
779
+ `import { useSlideContext } from '@slidev/client'`,
780
+ `import { computed } from 'vue'`,
781
+ `const props = defineProps<{ no?: number | string }>()`,
782
+ `const { $page } = useSlideContext()`,
783
+ `const no = computed(() => +(props.no ?? $page.value))`,
784
+ `</script>`
785
+ );
777
786
  return lines.join("\n");
778
787
  }
779
788
  };
@@ -911,6 +920,16 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
911
920
  }
912
921
  next();
913
922
  });
923
+ server.middlewares.use(async (req, res, next) => {
924
+ const match = req.url?.match(/^\/\@slidev\/resolve-id\/(.*)$/);
925
+ if (!match)
926
+ return next();
927
+ const [, specifier] = match;
928
+ const resolved = await server.pluginContainer.resolveId(specifier);
929
+ res.statusCode = 200;
930
+ res.write(resolved?.id ?? "");
931
+ return res.end();
932
+ });
914
933
  },
915
934
  async handleHotUpdate(ctx) {
916
935
  if (!data.watchFiles.includes(ctx.file))
@@ -1245,7 +1264,7 @@ ${code}`;
1245
1264
  import Markdown2 from "unplugin-vue-markdown/vite";
1246
1265
  import { isTruthy as isTruthy3, slash } from "@antfu/utils";
1247
1266
 
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
1267
+ // ../../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
1268
  var SpecialCharacters;
1250
1269
  (function(SpecialCharacters2) {
1251
1270
  SpecialCharacters2[SpecialCharacters2["EXCLAMATION_MARK"] = 33] = "EXCLAMATION_MARK";
@@ -1261,7 +1280,7 @@ var SpecialCharacters;
1261
1280
  SpecialCharacters2[SpecialCharacters2["CLOSING_PARENTHESIS"] = 41] = "CLOSING_PARENTHESIS";
1262
1281
  })(SpecialCharacters || (SpecialCharacters = {}));
1263
1282
 
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
1283
+ // ../../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
1284
  import Token from "markdown-it/lib/token.mjs";
1266
1285
  var checkboxRegex = /^ *\[([\sx])] /i;
1267
1286
  function taskLists(md2, options = { enabled: false, label: false, lineNumber: false }) {
@@ -1372,6 +1391,7 @@ function startsWithTodoMarkdown(token) {
1372
1391
 
1373
1392
  // node/vite/markdown.ts
1374
1393
  import MarkdownItMdc from "markdown-it-mdc";
1394
+ import MagicString from "magic-string";
1375
1395
  import MarkdownItAttrs from "markdown-it-link-attributes";
1376
1396
  import MarkdownItFootnote from "markdown-it-footnote";
1377
1397
 
@@ -1532,24 +1552,6 @@ import * as htmlparser2 from "htmlparser2";
1532
1552
  function normalizeRangeStr(rangeStr = "") {
1533
1553
  return !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
1534
1554
  }
1535
- function getCodeBlocks(md2) {
1536
- const codeblocks = Array.from(md2.matchAll(/^```[\s\S]*?^```/mg)).map((m) => {
1537
- const start = m.index;
1538
- const end = m.index + m[0].length;
1539
- const startLine = md2.slice(0, start).match(/\n/g)?.length || 0;
1540
- const endLine = md2.slice(0, end).match(/\n/g)?.length || 0;
1541
- return [start, end, startLine, endLine];
1542
- });
1543
- return {
1544
- codeblocks,
1545
- isInsideCodeblocks(idx) {
1546
- return codeblocks.some(([s, e]) => s <= idx && idx <= e);
1547
- },
1548
- isLineInsideCodeblocks(line) {
1549
- return codeblocks.some(([, , s, e]) => s <= line && line <= e);
1550
- }
1551
- };
1552
- }
1553
1555
  function escapeVueInCode(md2) {
1554
1556
  return md2.replace(/{{/g, "&lbrace;&lbrace;");
1555
1557
  }
@@ -1653,13 +1655,16 @@ function markdownItPrism(markdownit, useroptions) {
1653
1655
 
1654
1656
  // node/syntax/transform/code-wrapper.ts
1655
1657
  var reCodeBlock = /^```([\w'-]+?)(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?(.*?))?\n([\s\S]+?)^```$/mg;
1656
- function transformCodeWrapper(md2) {
1657
- return md2.replace(
1658
+ function transformCodeWrapper(ctx) {
1659
+ ctx.s.replace(
1658
1660
  reCodeBlock,
1659
- (full, lang = "", rangeStr = "", options = "", attrs = "", code) => {
1661
+ (full, lang = "", rangeStr = "", options = "", attrs = "", code, index) => {
1662
+ if (ctx.isIgnored(index))
1663
+ return full;
1660
1664
  const ranges = normalizeRangeStr(rangeStr);
1661
1665
  code = code.trimEnd();
1662
1666
  options = options.trim() || "{}";
1667
+ ctx.ignores.push([index, index + full.length]);
1663
1668
  return `
1664
1669
  <CodeBlockWrapper v-bind="${options}" :ranges='${JSON.stringify(ranges)}'>
1665
1670
 
@@ -1676,10 +1681,10 @@ ${code}
1676
1681
  import { codeToKeyedTokens } from "shiki-magic-move/core";
1677
1682
  import lz2 from "lz-string";
1678
1683
  var reMagicMoveBlock = /^````(?:md|markdown) magic-move(?:[ ]*(\{.*?\})?([^\n]*?))?\n([\s\S]+?)^````$/mg;
1679
- function transformMagicMove(md2, shiki2, shikiOptions2) {
1680
- return md2.replace(
1684
+ function transformMagicMove(ctx, shiki2, shikiOptions2) {
1685
+ ctx.s.replace(
1681
1686
  reMagicMoveBlock,
1682
- (full, options = "{}", _attrs = "", body) => {
1687
+ (full, options = "{}", _attrs = "", body, index) => {
1683
1688
  if (!shiki2 || !shikiOptions2)
1684
1689
  throw new Error("Shiki is required for Magic Move. You may need to set `highlighter: shiki` in your Slidev config.");
1685
1690
  const matches = Array.from(body.matchAll(reCodeBlock));
@@ -1693,6 +1698,7 @@ function transformMagicMove(md2, shiki2, shikiOptions2) {
1693
1698
  })
1694
1699
  );
1695
1700
  const compressed = lz2.compressToBase64(JSON.stringify(steps));
1701
+ ctx.ignores.push([index, index + full.length]);
1696
1702
  return `<ShikiMagicMove v-bind="${options}" steps-lz="${compressed}" :step-ranges='${JSON.stringify(ranges)}' />`;
1697
1703
  }
1698
1704
  );
@@ -1700,21 +1706,23 @@ function transformMagicMove(md2, shiki2, shikiOptions2) {
1700
1706
 
1701
1707
  // node/syntax/transform/mermaid.ts
1702
1708
  import lz3 from "lz-string";
1703
- function transformMermaid(md2) {
1704
- return md2.replace(/^```mermaid\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", code = "") => {
1709
+ function transformMermaid(ctx) {
1710
+ ctx.s.replace(/^```mermaid\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", code = "", index) => {
1705
1711
  code = code.trim();
1706
1712
  options = options.trim() || "{}";
1707
1713
  const encoded = lz3.compressToBase64(code);
1714
+ ctx.ignores.push([index, index + full.length]);
1708
1715
  return `<Mermaid code-lz="${encoded}" v-bind="${options}" />`;
1709
1716
  });
1710
1717
  }
1711
1718
 
1712
1719
  // node/syntax/transform/plant-uml.ts
1713
1720
  import { encode as encodePlantUml } from "plantuml-encoder";
1714
- function transformPlantUml(md2, server) {
1715
- return md2.replace(/^```plantuml\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", content = "") => {
1721
+ function transformPlantUml(ctx, server) {
1722
+ ctx.s.replace(/^```plantuml\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", content = "", index) => {
1716
1723
  const code = encodePlantUml(content.trim());
1717
1724
  options = options.trim() || "{}";
1725
+ ctx.ignores.push([index, index + full.length]);
1718
1726
  return `<PlantUml :code="'${code}'" :server="'${server}'" v-bind="${options}" />`;
1719
1727
  });
1720
1728
  }
@@ -1773,14 +1781,14 @@ function findRegion(lines, regionName) {
1773
1781
  }
1774
1782
  return null;
1775
1783
  }
1776
- function transformSnippet(md2, options, id) {
1784
+ function transformSnippet(ctx, options, id) {
1777
1785
  const slideId = id.match(/(\d+)\.md$/)?.[1];
1778
1786
  if (!slideId)
1779
- return md2;
1787
+ return;
1780
1788
  const data = options.data;
1781
1789
  const slideInfo = data.slides[+slideId - 1];
1782
1790
  const dir = path.dirname(slideInfo.source?.filepath ?? options.entry ?? options.userRoot);
1783
- return md2.replace(
1791
+ ctx.s.replace(
1784
1792
  /^<<< *(.+?)(#[\w-]+)? *(?: (\S+?))? *(\{.*)?$/mg,
1785
1793
  (full, filepath = "", regionName = "", lang = "", meta = "") => {
1786
1794
  const firstLine = `\`\`\`${lang || path.extname(filepath).slice(1)} ${meta}`;
@@ -1810,35 +1818,41 @@ ${content}
1810
1818
  }
1811
1819
 
1812
1820
  // node/syntax/transform/slot-sugar.ts
1813
- function transformSlotSugar(md2) {
1814
- const lines = md2.split(/\r?\n/g);
1821
+ function transformSlotSugar(ctx) {
1822
+ const linesWithNewline = ctx.s.original.split(/(\r?\n)/g);
1823
+ const lines = [];
1824
+ for (let i = 0; i < linesWithNewline.length; i += 2) {
1825
+ const line = linesWithNewline[i];
1826
+ const newline = linesWithNewline[i + 1] || "";
1827
+ lines.push(line + newline);
1828
+ }
1815
1829
  let prevSlot = false;
1816
- const { isLineInsideCodeblocks } = getCodeBlocks(md2);
1817
- lines.forEach((line, idx) => {
1818
- if (isLineInsideCodeblocks(idx))
1830
+ let offset = 0;
1831
+ lines.forEach((line) => {
1832
+ const start = offset;
1833
+ offset += line.length;
1834
+ if (ctx.isIgnored(start))
1819
1835
  return;
1820
- const match = line.trimEnd().match(/^::\s*([\w\.\-\:]+)\s*::$/);
1836
+ const match = line.match(/^::\s*([\w\.\-\:]+)\s*::(\s*)?$/);
1821
1837
  if (match) {
1822
- lines[idx] = `${prevSlot ? "\n\n</template>\n" : "\n"}<template v-slot:${match[1]}="slotProps">
1823
- `;
1838
+ ctx.s.overwrite(start, offset - match[2].length, `${prevSlot ? "\n\n</template>\n" : "\n"}<template v-slot:${match[1]}="slotProps">
1839
+ `);
1824
1840
  prevSlot = true;
1825
1841
  }
1826
1842
  });
1827
1843
  if (prevSlot)
1828
- lines[lines.length - 1] += "\n\n</template>";
1829
- return lines.join("\n");
1844
+ ctx.s.append("\n\n</template>");
1830
1845
  }
1831
1846
 
1832
1847
  // node/syntax/transform/in-page-css.ts
1833
- function transformPageCSS(md2, id) {
1848
+ function transformPageCSS(ctx, id) {
1834
1849
  const page = id.match(/(\d+)\.md$/)?.[1];
1835
1850
  if (!page)
1836
- return md2;
1837
- const { isInsideCodeblocks } = getCodeBlocks(md2);
1838
- const result = md2.replace(
1851
+ return;
1852
+ ctx.s.replace(
1839
1853
  /(\n<style[^>]*?>)([\s\S]+?)(<\/style>)/g,
1840
1854
  (full, start, css, end, index) => {
1841
- if (index < 0 || isInsideCodeblocks(index))
1855
+ if (ctx.isIgnored(index))
1842
1856
  return full;
1843
1857
  if (!start.includes("scoped"))
1844
1858
  start = start.replace("<style", "<style scoped");
@@ -1846,17 +1860,17 @@ function transformPageCSS(md2, id) {
1846
1860
  ${css}${end}`;
1847
1861
  }
1848
1862
  );
1849
- return result;
1850
1863
  }
1851
1864
 
1852
1865
  // node/syntax/transform/katex-wrapper.ts
1853
- function transformKaTexWrapper(md2) {
1854
- return md2.replace(
1866
+ function transformKaTexWrapper(ctx) {
1867
+ ctx.s.replace(
1855
1868
  /^\$\$(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?\s*?)?\n([\s\S]+?)^\$\$/mg,
1856
- (full, rangeStr = "", options = "", code) => {
1869
+ (full, rangeStr = "", options = "", code, index) => {
1857
1870
  const ranges = !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
1858
1871
  code = code.trimEnd();
1859
1872
  options = options.trim() || "{}";
1873
+ ctx.ignores.push([index, index + full.length]);
1860
1874
  return `<KaTexBlockWrapper v-bind="${options}" :ranges='${JSON.stringify(ranges)}'>
1861
1875
 
1862
1876
  $$
@@ -1957,17 +1971,24 @@ async function createMarkdownPlugin(options, { markdown: mdOptions }) {
1957
1971
  if (id === entryPath)
1958
1972
  return "";
1959
1973
  const monacoEnabled = config.monaco === true || config.monaco === mode;
1974
+ const ctx = {
1975
+ s: new MagicString(code),
1976
+ ignores: [],
1977
+ isIgnored(index) {
1978
+ return index < 0 || ctx.ignores.some(([start, end]) => start <= index && index < end);
1979
+ }
1980
+ };
1981
+ transformSnippet(ctx, options, id);
1960
1982
  if (config.highlighter === "shiki")
1961
- code = transformMagicMove(code, shiki, shikiOptions);
1962
- code = transformSlotSugar(code);
1963
- code = transformSnippet(code, options, id);
1964
- code = transformMermaid(code);
1965
- code = transformPlantUml(code, config.plantUmlServer);
1966
- code = transformMonaco(code, monacoEnabled);
1967
- code = transformCodeWrapper(code);
1968
- code = transformPageCSS(code, id);
1969
- code = transformKaTexWrapper(code);
1970
- return code;
1983
+ transformMagicMove(ctx, shiki, shikiOptions);
1984
+ transformMermaid(ctx);
1985
+ transformPlantUml(ctx, config.plantUmlServer);
1986
+ transformMonaco(ctx, monacoEnabled);
1987
+ transformCodeWrapper(ctx);
1988
+ transformKaTexWrapper(ctx);
1989
+ transformPageCSS(ctx, id);
1990
+ transformSlotSugar(ctx);
1991
+ return ctx.s.toString();
1971
1992
  }
1972
1993
  }
1973
1994
  });
package/dist/cli.mjs CHANGED
@@ -6,8 +6,8 @@ import {
6
6
  resolveOptions,
7
7
  resolveTheme,
8
8
  version
9
- } from "./chunk-IYOBM2Q4.mjs";
10
- import "./chunk-M3AHQMLP.mjs";
9
+ } from "./chunk-JGRWIL55.mjs";
10
+ import "./chunk-STSW6326.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-4QIFFIAR.mjs");
328
+ const { build } = await import("./build-CPSFSDEL.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-F3TWPZMI.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-F3TWPZMI.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,
@@ -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-IYOBM2Q4.mjs";
5
+ } from "./chunk-JGRWIL55.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
- } from "./chunk-M3AHQMLP.mjs";
8
+ } from "./chunk-STSW6326.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.7",
3
+ "version": "0.48.9",
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.3",
52
+ "@shikijs/twoslash": "^1.2.3",
53
+ "@shikijs/vitepress-twoslash": "^1.2.3",
54
+ "@unocss/extractor-mdc": "^0.58.9",
55
+ "@unocss/reset": "^0.58.9",
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,12 @@
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
+ "magic-string": "^0.30.9",
76
+ "markdown-it": "^14.1.0",
76
77
  "markdown-it-footnote": "^4.0.0",
77
78
  "markdown-it-link-attributes": "^4.0.1",
78
79
  "markdown-it-mdc": "^0.2.3",
@@ -84,31 +85,31 @@
84
85
  "postcss-nested": "^6.0.1",
85
86
  "prismjs": "^1.29.0",
86
87
  "prompts": "^2.4.2",
87
- "public-ip": "^6.0.1",
88
+ "public-ip": "^6.0.2",
88
89
  "resolve-from": "^5.0.0",
89
90
  "resolve-global": "^2.0.0",
90
91
  "semver": "^7.6.0",
91
- "shiki": "^1.1.7",
92
- "shiki-magic-move": "^0.3.4",
92
+ "shiki": "^1.2.3",
93
+ "shiki-magic-move": "^0.3.5",
93
94
  "sirv": "^2.0.4",
94
- "typescript": "^5.4.2",
95
- "unocss": "^0.58.5",
95
+ "typescript": "^5.4.3",
96
+ "unocss": "^0.58.9",
96
97
  "unplugin-icons": "^0.18.5",
97
98
  "unplugin-vue-components": "^0.26.0",
98
99
  "unplugin-vue-markdown": "^0.26.0",
99
100
  "untun": "^0.1.3",
100
101
  "uqr": "^0.1.2",
101
- "vite": "^5.1.6",
102
+ "vite": "^5.2.7",
102
103
  "vite-plugin-inspect": "^0.8.3",
103
104
  "vite-plugin-remote-assets": "^0.4.1",
104
- "vite-plugin-static-copy": "^1.0.1",
105
+ "vite-plugin-static-copy": "^1.0.2",
105
106
  "vite-plugin-vue-server-ref": "^0.4.2",
106
107
  "vitefu": "^0.2.5",
107
108
  "vue": "^3.4.21",
108
109
  "yargs": "^17.7.2",
109
- "@slidev/parser": "0.48.7",
110
- "@slidev/types": "0.48.7",
111
- "@slidev/client": "0.48.7"
110
+ "@slidev/client": "0.48.9",
111
+ "@slidev/parser": "0.48.9",
112
+ "@slidev/types": "0.48.9"
112
113
  },
113
114
  "devDependencies": {
114
115
  "@hedgedoc/markdown-it-plugins": "^2.1.4",