@slidev/cli 0.43.0-beta.5 → 0.43.0-beta.6

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-IMVZEGBY.mjs";
5
+ } from "./chunk-3TJE2CDX.mjs";
6
6
  import "./chunk-JDHANZ37.mjs";
7
7
  import "./chunk-ZEKM4EGL.mjs";
8
8
  import "./chunk-QHOBBTS4.mjs";
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkDXJWPFLIjs = require('./chunk-DXJWPFLI.js');
5
+ var _chunkB2S4FMPEjs = require('./chunk-B2S4FMPE.js');
6
6
  require('./chunk-KKGXM3XL.js');
7
7
  require('./chunk-JQHGZJGJ.js');
8
8
  require('./chunk-YUG22S6W.js');
@@ -651,16 +651,16 @@ async function build(options, viteConfig = {}, args) {
651
651
  let originalIndexHTML;
652
652
  if (_fsextra2.default.existsSync(indexPath))
653
653
  originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
654
- await _fsextra2.default.writeFile(indexPath, await _chunkDXJWPFLIjs.getIndexHtml.call(void 0, options), "utf-8");
654
+ await _fsextra2.default.writeFile(indexPath, await _chunkB2S4FMPEjs.getIndexHtml.call(void 0, options), "utf-8");
655
655
  let config = void 0;
656
656
  try {
657
- const inlineConfig = await _chunkDXJWPFLIjs.mergeViteConfigs.call(void 0,
657
+ const inlineConfig = await _chunkB2S4FMPEjs.mergeViteConfigs.call(void 0,
658
658
  options,
659
659
  viteConfig,
660
660
  {
661
661
  root: options.userRoot,
662
662
  plugins: [
663
- await _chunkDXJWPFLIjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
663
+ await _chunkB2S4FMPEjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
664
664
  {
665
665
  name: "resolve-config",
666
666
  configResolved(_config) {
@@ -681,7 +681,7 @@ async function build(options, viteConfig = {}, args) {
681
681
  } else {
682
682
  console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
683
683
  await _vite.build.call(void 0,
684
- await _chunkDXJWPFLIjs.mergeViteConfigs.call(void 0,
684
+ await _chunkB2S4FMPEjs.mergeViteConfigs.call(void 0,
685
685
  options,
686
686
  inlineConfig,
687
687
  {
@@ -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(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkDXJWPFLIjs = require('./chunk-DXJWPFLI.js');
4
+ var _chunkB2S4FMPEjs = require('./chunk-B2S4FMPE.js');
5
5
 
6
6
 
7
7
 
@@ -2496,7 +2496,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2496
2496
  const pluginOptions = rawConfig.slidev || {};
2497
2497
  _process2.default.env.EDITOR = _process2.default.env.EDITOR || "code";
2498
2498
  const server = await _vite.createServer.call(void 0,
2499
- await _chunkDXJWPFLIjs.mergeViteConfigs.call(void 0,
2499
+ await _chunkB2S4FMPEjs.mergeViteConfigs.call(void 0,
2500
2500
  options,
2501
2501
  viteConfig,
2502
2502
  {
@@ -2506,7 +2506,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2506
2506
  ]
2507
2507
  },
2508
2508
  plugins: [
2509
- await _chunkDXJWPFLIjs.ViteSlidevPlugin.call(void 0, options, pluginOptions, serverOptions)
2509
+ await _chunkB2S4FMPEjs.ViteSlidevPlugin.call(void 0, options, pluginOptions, serverOptions)
2510
2510
  ]
2511
2511
  },
2512
2512
  "serve"
@@ -2519,7 +2519,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2519
2519
  var _fs = require('@slidev/parser/fs'); var parser = _interopRequireWildcard(_fs);
2520
2520
 
2521
2521
  // package.json
2522
- var version = "0.43.0-beta.5";
2522
+ var version = "0.43.0-beta.6";
2523
2523
 
2524
2524
  // node/themes.ts
2525
2525
  var _prompts = require('prompts'); var _prompts2 = _interopRequireDefault(_prompts);
@@ -375,7 +375,7 @@ import { bold, gray, red, yellow } from "kolorist";
375
375
  import mila from "markdown-it-link-attributes";
376
376
  import * as parser from "@slidev/parser/fs";
377
377
  var regexId = /^\/\@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
378
- var regexIdQuery = /(\d+?)\.(md|json)$/;
378
+ var regexIdQuery = /(\d+?)\.(md|json|frontmatter)$/;
379
379
  var vueContextImports = [
380
380
  'import { inject as _vueInject, toRef as _vueToRef } from "vue"',
381
381
  `import {
@@ -417,7 +417,7 @@ function prepareSlideInfo(data) {
417
417
  noteHTML: md.render(data?.note || "")
418
418
  };
419
419
  }
420
- function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote }, pluginOptions, serverOptions) {
420
+ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote, mode }, pluginOptions, serverOptions) {
421
421
  const slidePrefix = "/@slidev/slides/";
422
422
  const hmrPages = /* @__PURE__ */ new Set();
423
423
  let server;
@@ -498,9 +498,10 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
498
498
  Object.assign(data, newData);
499
499
  if (hmrPages.size > 0)
500
500
  moduleIds.add("/@slidev/titles.md");
501
- const vueModules = Array.from(hmrPages).map(
502
- (i) => ctx.server.moduleGraph.getModuleById(`${slidePrefix}${i + 1}.md`)
503
- );
501
+ const vueModules = Array.from(hmrPages).flatMap((i) => [
502
+ ctx.server.moduleGraph.getModuleById(`${slidePrefix}${i + 1}.frontmatter`),
503
+ ctx.server.moduleGraph.getModuleById(`${slidePrefix}${i + 1}.md`)
504
+ ]);
504
505
  hmrPages.clear();
505
506
  const moduleEntries = [
506
507
  ...vueModules,
@@ -533,13 +534,11 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
533
534
  return generateCustomNavControls();
534
535
  if (id === "/@slidev/titles.md") {
535
536
  return {
536
- code: data.slides.filter(({ frontmatter }) => !frontmatter?.disabled).map(({ title }, i) => {
537
- return `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">
537
+ code: data.slides.filter(({ frontmatter }) => !frontmatter?.disabled).map(({ title }, i) => `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">
538
538
 
539
539
  ${title}
540
540
 
541
- </template>`;
542
- }).join(""),
541
+ </template>`).join(""),
543
542
  map: { mappings: "" }
544
543
  };
545
544
  }
@@ -549,9 +548,52 @@ ${title}
549
548
  if (match) {
550
549
  const [, no, type] = match;
551
550
  const pageNo = Number.parseInt(no) - 1;
551
+ const slide = data.slides[pageNo];
552
+ if (!slide)
553
+ return;
552
554
  if (type === "md") {
553
555
  return {
554
- code: data.slides[pageNo]?.content,
556
+ code: slide?.content,
557
+ map: { mappings: "" }
558
+ };
559
+ } else if (type === "frontmatter") {
560
+ return {
561
+ code: [
562
+ 'import { reactive, computed } from "vue"',
563
+ `export const frontmatter = reactive(${JSON.stringify(slide.frontmatter)})`,
564
+ `export const meta = reactive({
565
+ layout: computed(() => frontmatter.layout),
566
+ transition: computed(() => frontmatter.transition),
567
+ class: computed(() => frontmatter.class),
568
+ clicks: computed(() => frontmatter.clicks),
569
+ name: computed(() => frontmatter.name),
570
+ slide: {
571
+ ...(${JSON.stringify({
572
+ ...prepareSlideInfo(slide),
573
+ frontmatter: void 0,
574
+ // remove raw content in build, optimize the bundle size
575
+ ...mode === "build" ? { raw: "", content: "", note: "" } : {}
576
+ })}),
577
+ frontmatter,
578
+ filepath: ${JSON.stringify(slide.source?.filepath || entry)},
579
+ id: ${pageNo},
580
+ no: ${no},
581
+ },
582
+ __clicksElements: [],
583
+ __preloaded: false,
584
+ })`,
585
+ "export default frontmatter",
586
+ // handle HMR, update frontmatter with update
587
+ "if (import.meta.hot) {",
588
+ " import.meta.hot.accept(({ frontmatter: update }) => {",
589
+ " if(!update) return",
590
+ " Object.keys(frontmatter).forEach(key => {",
591
+ " if (!(key in update)) delete frontmatter[key]",
592
+ " })",
593
+ " Object.assign(frontmatter, update)",
594
+ " })",
595
+ "}"
596
+ ].join("\n"),
555
597
  map: { mappings: "" }
556
598
  };
557
599
  }
@@ -604,7 +646,9 @@ ${title}
604
646
  transform(code, id) {
605
647
  if (!id.match(/\/@slidev\/slides\/\d+\.md($|\?)/))
606
648
  return;
607
- return code.replace("if (_rerender_only)", "if (false)");
649
+ const replaced = code.replace("if (_rerender_only)", "if (false)");
650
+ if (replaced !== code)
651
+ return replaced;
608
652
  }
609
653
  }
610
654
  ];
@@ -630,8 +674,18 @@ Unknown layout "${bold(layoutName)}".${yellow(" Available layouts are:")}`) + Ob
630
674
  const imports = [
631
675
  ...vueContextImports,
632
676
  `import InjectedLayout from "${toAtFS(layouts[layoutName])}"`,
633
- `const frontmatter = ${JSON.stringify(frontmatter)}`,
634
- "const $frontmatter = frontmatter"
677
+ `import frontmatter from "${toAtFS(`${slidePrefix + (pageNo + 1)}.frontmatter`)}"`,
678
+ "const $frontmatter = frontmatter",
679
+ // update frontmatter in router
680
+ ";(() => {",
681
+ " const route = $slidev.nav.rawRoutes.find(i => i.path === String($page))",
682
+ " if (route.meta.slide.frontmatter) {",
683
+ " Object.keys(route.meta.slide.frontmatter).forEach(key => {",
684
+ " if (!(key in $frontmatter)) delete route.meta.slide.frontmatter[key]",
685
+ " })",
686
+ " Object.assign(route.meta.slide.frontmatter, frontmatter)",
687
+ " }",
688
+ "})();"
635
689
  ];
636
690
  code = code.replace(/(<script setup.*>)/g, `$1
637
691
  ${imports.join("\n")}
@@ -804,18 +858,8 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
804
858
  let no = 1;
805
859
  const routes = data.slides.filter(({ frontmatter }) => !frontmatter?.disabled).map((i, idx) => {
806
860
  imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
807
- const additions = {
808
- slide: {
809
- ...prepareSlideInfo(i),
810
- filepath: i.source?.filepath || entry,
811
- id: idx,
812
- no
813
- },
814
- __clicksElements: [],
815
- __preloaded: false
816
- };
817
- const meta = Object.assign({}, i.frontmatter, additions);
818
- const route = `{ path: '${no}', name: 'page-${no}', component: n${no}, meta: ${JSON.stringify(meta)} }`;
861
+ imports.push(`import { meta as f${no} } from '${slidePrefix}${idx + 1}.frontmatter'`);
862
+ const route = `{ path: '${no}', name: 'page-${no}', component: n${no}, meta: f${no} }`;
819
863
  if (i.frontmatter?.routeAlias)
820
864
  redirects.push(`{ path: '${i.frontmatter?.routeAlias}', redirect: { path: '${no}' } }`);
821
865
  no += 1;
@@ -375,7 +375,7 @@ var _kolorist = require('kolorist');
375
375
  var _markdownitlinkattributes = require('markdown-it-link-attributes'); var _markdownitlinkattributes2 = _interopRequireDefault(_markdownitlinkattributes);
376
376
  var _fs3 = require('@slidev/parser/fs'); var parser = _interopRequireWildcard(_fs3);
377
377
  var regexId = /^\/\@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
378
- var regexIdQuery = /(\d+?)\.(md|json)$/;
378
+ var regexIdQuery = /(\d+?)\.(md|json|frontmatter)$/;
379
379
  var vueContextImports = [
380
380
  'import { inject as _vueInject, toRef as _vueToRef } from "vue"',
381
381
  `import {
@@ -417,7 +417,7 @@ function prepareSlideInfo(data) {
417
417
  noteHTML: md.render(_optionalChain([data, 'optionalAccess', _10 => _10.note]) || "")
418
418
  };
419
419
  }
420
- function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote }, pluginOptions, serverOptions) {
420
+ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, userRoot, roots, remote, mode }, pluginOptions, serverOptions) {
421
421
  const slidePrefix = "/@slidev/slides/";
422
422
  const hmrPages = /* @__PURE__ */ new Set();
423
423
  let server;
@@ -498,9 +498,10 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
498
498
  Object.assign(data, newData);
499
499
  if (hmrPages.size > 0)
500
500
  moduleIds.add("/@slidev/titles.md");
501
- const vueModules = Array.from(hmrPages).map(
502
- (i) => ctx.server.moduleGraph.getModuleById(`${slidePrefix}${i + 1}.md`)
503
- );
501
+ const vueModules = Array.from(hmrPages).flatMap((i) => [
502
+ ctx.server.moduleGraph.getModuleById(`${slidePrefix}${i + 1}.frontmatter`),
503
+ ctx.server.moduleGraph.getModuleById(`${slidePrefix}${i + 1}.md`)
504
+ ]);
504
505
  hmrPages.clear();
505
506
  const moduleEntries = [
506
507
  ...vueModules,
@@ -533,13 +534,11 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
533
534
  return generateCustomNavControls();
534
535
  if (id === "/@slidev/titles.md") {
535
536
  return {
536
- code: data.slides.filter(({ frontmatter }) => !_optionalChain([frontmatter, 'optionalAccess', _33 => _33.disabled])).map(({ title }, i) => {
537
- return `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">
537
+ code: data.slides.filter(({ frontmatter }) => !_optionalChain([frontmatter, 'optionalAccess', _33 => _33.disabled])).map(({ title }, i) => `<template ${i === 0 ? "v-if" : "v-else-if"}="+no === ${i + 1}">
538
538
 
539
539
  ${title}
540
540
 
541
- </template>`;
542
- }).join(""),
541
+ </template>`).join(""),
543
542
  map: { mappings: "" }
544
543
  };
545
544
  }
@@ -549,9 +548,52 @@ ${title}
549
548
  if (match) {
550
549
  const [, no, type] = match;
551
550
  const pageNo = Number.parseInt(no) - 1;
551
+ const slide = data.slides[pageNo];
552
+ if (!slide)
553
+ return;
552
554
  if (type === "md") {
553
555
  return {
554
- code: _optionalChain([data, 'access', _34 => _34.slides, 'access', _35 => _35[pageNo], 'optionalAccess', _36 => _36.content]),
556
+ code: _optionalChain([slide, 'optionalAccess', _34 => _34.content]),
557
+ map: { mappings: "" }
558
+ };
559
+ } else if (type === "frontmatter") {
560
+ return {
561
+ code: [
562
+ 'import { reactive, computed } from "vue"',
563
+ `export const frontmatter = reactive(${JSON.stringify(slide.frontmatter)})`,
564
+ `export const meta = reactive({
565
+ layout: computed(() => frontmatter.layout),
566
+ transition: computed(() => frontmatter.transition),
567
+ class: computed(() => frontmatter.class),
568
+ clicks: computed(() => frontmatter.clicks),
569
+ name: computed(() => frontmatter.name),
570
+ slide: {
571
+ ...(${JSON.stringify({
572
+ ...prepareSlideInfo(slide),
573
+ frontmatter: void 0,
574
+ // remove raw content in build, optimize the bundle size
575
+ ...mode === "build" ? { raw: "", content: "", note: "" } : {}
576
+ })}),
577
+ frontmatter,
578
+ filepath: ${JSON.stringify(_optionalChain([slide, 'access', _35 => _35.source, 'optionalAccess', _36 => _36.filepath]) || entry)},
579
+ id: ${pageNo},
580
+ no: ${no},
581
+ },
582
+ __clicksElements: [],
583
+ __preloaded: false,
584
+ })`,
585
+ "export default frontmatter",
586
+ // handle HMR, update frontmatter with update
587
+ "if (import.meta.hot) {",
588
+ " import.meta.hot.accept(({ frontmatter: update }) => {",
589
+ " if(!update) return",
590
+ " Object.keys(frontmatter).forEach(key => {",
591
+ " if (!(key in update)) delete frontmatter[key]",
592
+ " })",
593
+ " Object.assign(frontmatter, update)",
594
+ " })",
595
+ "}"
596
+ ].join("\n"),
555
597
  map: { mappings: "" }
556
598
  };
557
599
  }
@@ -604,7 +646,9 @@ ${title}
604
646
  transform(code, id) {
605
647
  if (!id.match(/\/@slidev\/slides\/\d+\.md($|\?)/))
606
648
  return;
607
- return code.replace("if (_rerender_only)", "if (false)");
649
+ const replaced = code.replace("if (_rerender_only)", "if (false)");
650
+ if (replaced !== code)
651
+ return replaced;
608
652
  }
609
653
  }
610
654
  ];
@@ -630,8 +674,18 @@ Unknown layout "${_kolorist.bold.call(void 0, layoutName)}".${_kolorist.yellow.c
630
674
  const imports = [
631
675
  ...vueContextImports,
632
676
  `import InjectedLayout from "${_chunkJQHGZJGJjs.toAtFS.call(void 0, layouts[layoutName])}"`,
633
- `const frontmatter = ${JSON.stringify(frontmatter)}`,
634
- "const $frontmatter = frontmatter"
677
+ `import frontmatter from "${_chunkJQHGZJGJjs.toAtFS.call(void 0, `${slidePrefix + (pageNo + 1)}.frontmatter`)}"`,
678
+ "const $frontmatter = frontmatter",
679
+ // update frontmatter in router
680
+ ";(() => {",
681
+ " const route = $slidev.nav.rawRoutes.find(i => i.path === String($page))",
682
+ " if (route.meta.slide.frontmatter) {",
683
+ " Object.keys(route.meta.slide.frontmatter).forEach(key => {",
684
+ " if (!(key in $frontmatter)) delete route.meta.slide.frontmatter[key]",
685
+ " })",
686
+ " Object.assign(route.meta.slide.frontmatter, frontmatter)",
687
+ " }",
688
+ "})();"
635
689
  ];
636
690
  code = code.replace(/(<script setup.*>)/g, `$1
637
691
  ${imports.join("\n")}
@@ -804,20 +858,10 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
804
858
  let no = 1;
805
859
  const routes = data.slides.filter(({ frontmatter }) => !_optionalChain([frontmatter, 'optionalAccess', _46 => _46.disabled])).map((i, idx) => {
806
860
  imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
807
- const additions = {
808
- slide: {
809
- ...prepareSlideInfo(i),
810
- filepath: _optionalChain([i, 'access', _47 => _47.source, 'optionalAccess', _48 => _48.filepath]) || entry,
811
- id: idx,
812
- no
813
- },
814
- __clicksElements: [],
815
- __preloaded: false
816
- };
817
- const meta = Object.assign({}, i.frontmatter, additions);
818
- const route = `{ path: '${no}', name: 'page-${no}', component: n${no}, meta: ${JSON.stringify(meta)} }`;
819
- if (_optionalChain([i, 'access', _49 => _49.frontmatter, 'optionalAccess', _50 => _50.routeAlias]))
820
- redirects.push(`{ path: '${_optionalChain([i, 'access', _51 => _51.frontmatter, 'optionalAccess', _52 => _52.routeAlias])}', redirect: { path: '${no}' } }`);
861
+ imports.push(`import { meta as f${no} } from '${slidePrefix}${idx + 1}.frontmatter'`);
862
+ const route = `{ path: '${no}', name: 'page-${no}', component: n${no}, meta: f${no} }`;
863
+ if (_optionalChain([i, 'access', _47 => _47.frontmatter, 'optionalAccess', _48 => _48.routeAlias]))
864
+ redirects.push(`{ path: '${_optionalChain([i, 'access', _49 => _49.frontmatter, 'optionalAccess', _50 => _50.routeAlias])}', redirect: { path: '${no}' } }`);
821
865
  no += 1;
822
866
  return route;
823
867
  });
@@ -1325,7 +1369,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
1325
1369
  html: true,
1326
1370
  xhtmlOut: true,
1327
1371
  linkify: true,
1328
- ..._optionalChain([mdOptions, 'optionalAccess', _53 => _53.markdownItOptions])
1372
+ ..._optionalChain([mdOptions, 'optionalAccess', _51 => _51.markdownItOptions])
1329
1373
  },
1330
1374
  ...mdOptions,
1331
1375
  markdownItSetup(md2) {
@@ -1339,7 +1383,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
1339
1383
  md2.use(_markdownitplugins.taskLists, { enabled: true, lineNumber: true, label: true });
1340
1384
  md2.use(math_plugin, KatexOptions);
1341
1385
  setups.forEach((i) => i(md2));
1342
- _optionalChain([mdOptions, 'optionalAccess', _54 => _54.markdownItSetup, 'optionalCall', _55 => _55(md2)]);
1386
+ _optionalChain([mdOptions, 'optionalAccess', _52 => _52.markdownItSetup, 'optionalCall', _53 => _53(md2)]);
1343
1387
  },
1344
1388
  transforms: {
1345
1389
  before(code, id) {
@@ -1413,8 +1457,8 @@ function getCodeBlocks(md2) {
1413
1457
  const codeblocks = Array.from(md2.matchAll(/^```[\s\S]*?^```/mg)).map((m) => {
1414
1458
  const start = m.index;
1415
1459
  const end = m.index + m[0].length;
1416
- const startLine = _optionalChain([md2, 'access', _56 => _56.slice, 'call', _57 => _57(0, start), 'access', _58 => _58.match, 'call', _59 => _59(/\n/g), 'optionalAccess', _60 => _60.length]) || 0;
1417
- const endLine = _optionalChain([md2, 'access', _61 => _61.slice, 'call', _62 => _62(0, end), 'access', _63 => _63.match, 'call', _64 => _64(/\n/g), 'optionalAccess', _65 => _65.length]) || 0;
1460
+ const startLine = _optionalChain([md2, 'access', _54 => _54.slice, 'call', _55 => _55(0, start), 'access', _56 => _56.match, 'call', _57 => _57(/\n/g), 'optionalAccess', _58 => _58.length]) || 0;
1461
+ const endLine = _optionalChain([md2, 'access', _59 => _59.slice, 'call', _60 => _60(0, end), 'access', _61 => _61.match, 'call', _62 => _62(/\n/g), 'optionalAccess', _63 => _63.length]) || 0;
1418
1462
  return [start, end, startLine, endLine];
1419
1463
  });
1420
1464
  return {
@@ -1428,7 +1472,7 @@ function getCodeBlocks(md2) {
1428
1472
  };
1429
1473
  }
1430
1474
  function transformPageCSS(md2, id) {
1431
- const page = _optionalChain([id, 'access', _66 => _66.match, 'call', _67 => _67(/(\d+)\.md$/), 'optionalAccess', _68 => _68[1]]);
1475
+ const page = _optionalChain([id, 'access', _64 => _64.match, 'call', _65 => _65(/(\d+)\.md$/), 'optionalAccess', _66 => _66[1]]);
1432
1476
  if (!page)
1433
1477
  return md2;
1434
1478
  const { isInsideCodeblocks } = getCodeBlocks(md2);
@@ -1542,7 +1586,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1542
1586
  return customElements.has(tag);
1543
1587
  }
1544
1588
  },
1545
- ..._optionalChain([vueOptions, 'optionalAccess', _69 => _69.template])
1589
+ ..._optionalChain([vueOptions, 'optionalAccess', _67 => _67.template])
1546
1590
  },
1547
1591
  ...vueOptions
1548
1592
  });
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-IMVZEGBY.mjs";
4
+ } from "./chunk-3TJE2CDX.mjs";
5
5
  import {
6
6
  packageExists,
7
7
  resolveImportPath
@@ -2519,7 +2519,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2519
2519
  import * as parser from "@slidev/parser/fs";
2520
2520
 
2521
2521
  // package.json
2522
- var version = "0.43.0-beta.5";
2522
+ var version = "0.43.0-beta.6";
2523
2523
 
2524
2524
  // node/themes.ts
2525
2525
  import prompts2 from "prompts";
package/dist/cli.js CHANGED
@@ -9,10 +9,10 @@
9
9
 
10
10
 
11
11
 
12
- var _chunk2BMKFV7Cjs = require('./chunk-2BMKFV7C.js');
12
+ var _chunk3SSSSIJPjs = require('./chunk-3SSSSIJP.js');
13
13
 
14
14
 
15
- var _chunkDXJWPFLIjs = require('./chunk-DXJWPFLI.js');
15
+ var _chunkB2S4FMPEjs = require('./chunk-B2S4FMPE.js');
16
16
 
17
17
 
18
18
  var _chunkKKGXM3XLjs = require('./chunk-KKGXM3XL.js');
@@ -22,7 +22,7 @@ require('./chunk-JQHGZJGJ.js');
22
22
  var _chunkYUG22S6Wjs = require('./chunk-YUG22S6W.js');
23
23
 
24
24
  // node/cli.ts
25
- var import_fast_deep_equal = _chunkYUG22S6Wjs.__toESM.call(void 0, _chunkDXJWPFLIjs.require_fast_deep_equal.call(void 0, ));
25
+ var import_fast_deep_equal = _chunkYUG22S6Wjs.__toESM.call(void 0, _chunkB2S4FMPEjs.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');
@@ -51,15 +51,15 @@ _fs.injectPreparserExtensionLoader.call(void 0, async (headmatter, filepath) =>
51
51
  const roots = (
52
52
  /* uniq */
53
53
  [
54
- _chunk2BMKFV7Cjs.getUserRoot.call(void 0, {}).userRoot,
55
- ..._chunk2BMKFV7Cjs.getAddonRoots.call(void 0, addons, ""),
56
- _chunk2BMKFV7Cjs.getClientRoot.call(void 0, )
54
+ _chunk3SSSSIJPjs.getUserRoot.call(void 0, {}).userRoot,
55
+ ..._chunk3SSSSIJPjs.getAddonRoots.call(void 0, addons, ""),
56
+ _chunk3SSSSIJPjs.getClientRoot.call(void 0, )
57
57
  ]
58
58
  );
59
59
  const mergeArrays = (a, b) => a.concat(b);
60
60
  return await _chunkKKGXM3XLjs.loadSetups.call(void 0, roots, "preparser.ts", { filepath, headmatter }, [], false, mergeArrays);
61
61
  });
62
- var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunk2BMKFV7Cjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
62
+ var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunk3SSSSIJPjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
63
63
  cli.command(
64
64
  "* [entry]",
65
65
  "Start a local server for Slidev",
@@ -115,9 +115,9 @@ cli.command(
115
115
  async function initServer() {
116
116
  if (server)
117
117
  await server.close();
118
- const options = await _chunk2BMKFV7Cjs.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
118
+ const options = await _chunk3SSSSIJPjs.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
119
119
  port = userPort || await findFreePort(3030);
120
- server = await _chunk2BMKFV7Cjs.createServer.call(void 0,
120
+ server = await _chunk3SSSSIJPjs.createServer.call(void 0,
121
121
  options,
122
122
  {
123
123
  server: {
@@ -131,7 +131,7 @@ cli.command(
131
131
  },
132
132
  {
133
133
  onDataReload(newData, data) {
134
- if (!theme && _chunk2BMKFV7Cjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunk2BMKFV7Cjs.resolveThemeName.call(void 0, data.config.theme)) {
134
+ if (!theme && _chunk3SSSSIJPjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunk3SSSSIJPjs.resolveThemeName.call(void 0, data.config.theme)) {
135
135
  console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
136
136
  initServer();
137
137
  } else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
@@ -260,9 +260,9 @@ cli.command(
260
260
  }).strict().help(),
261
261
  async (args) => {
262
262
  const { entry, theme, watch, base, download, out, inspect } = args;
263
- const { build } = await Promise.resolve().then(() => require("./build-2HVDTXMU.js"));
263
+ const { build } = await Promise.resolve().then(() => require("./build-IN5YJEKU.js"));
264
264
  for (const entryFile of entry) {
265
- const options = await _chunk2BMKFV7Cjs.resolveOptions.call(void 0, { entry: entryFile, theme, inspect }, "build");
265
+ const options = await _chunk3SSSSIJPjs.resolveOptions.call(void 0, { entry: entryFile, theme, inspect }, "build");
266
266
  if (download && !options.data.config.download)
267
267
  options.data.config.download = download;
268
268
  printInfo(options);
@@ -282,9 +282,9 @@ cli.command(
282
282
  (args) => commonOptions(args).strict().help(),
283
283
  async ({ entry }) => {
284
284
  for (const entryFile of entry) {
285
- const data = await _chunk2BMKFV7Cjs.parser.load(entryFile);
286
- _chunk2BMKFV7Cjs.parser.prettify(data);
287
- await _chunk2BMKFV7Cjs.parser.save(data);
285
+ const data = await _chunk3SSSSIJPjs.parser.load(entryFile);
286
+ _chunk3SSSSIJPjs.parser.prettify(data);
287
+ await _chunk3SSSSIJPjs.parser.save(data);
288
288
  }
289
289
  }
290
290
  );
@@ -300,17 +300,17 @@ cli.command(
300
300
  default: "theme"
301
301
  }),
302
302
  async ({ entry, dir, theme: themeInput }) => {
303
- const data = await _chunk2BMKFV7Cjs.parser.load(entry);
304
- const theme = _chunk2BMKFV7Cjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
303
+ const data = await _chunk3SSSSIJPjs.parser.load(entry);
304
+ const theme = _chunk3SSSSIJPjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
305
305
  if (theme === "none") {
306
306
  console.error('Cannot eject theme "none"');
307
307
  _process2.default.exit(1);
308
308
  }
309
- if (_chunk2BMKFV7Cjs.isPath.call(void 0, theme)) {
309
+ if (_chunk3SSSSIJPjs.isPath.call(void 0, theme)) {
310
310
  console.error("Theme is already ejected");
311
311
  _process2.default.exit(1);
312
312
  }
313
- const roots = _chunk2BMKFV7Cjs.getThemeRoots.call(void 0, theme, entry);
313
+ const roots = _chunk3SSSSIJPjs.getThemeRoots.call(void 0, theme, entry);
314
314
  if (!roots.length) {
315
315
  console.error(`Could not find theme "${theme}"`);
316
316
  _process2.default.exit(1);
@@ -322,7 +322,7 @@ cli.command(
322
322
  const dirPath = `./${dir}`;
323
323
  data.slides[0].frontmatter.theme = dirPath;
324
324
  data.slides[0].raw = null;
325
- await _chunk2BMKFV7Cjs.parser.save(data);
325
+ await _chunk3SSSSIJPjs.parser.save(data);
326
326
  console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
327
327
  }
328
328
  );
@@ -342,8 +342,8 @@ cli.command(
342
342
  const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-MCALG7XD.js"));
343
343
  const port = await findFreePort(12445);
344
344
  for (const entryFile of entry) {
345
- const options = await _chunk2BMKFV7Cjs.resolveOptions.call(void 0, { entry: entryFile, theme }, "export");
346
- const server = await _chunk2BMKFV7Cjs.createServer.call(void 0,
345
+ const options = await _chunk3SSSSIJPjs.resolveOptions.call(void 0, { entry: entryFile, theme }, "export");
346
+ const server = await _chunk3SSSSIJPjs.createServer.call(void 0,
347
347
  options,
348
348
  {
349
349
  server: { port },
@@ -352,7 +352,7 @@ cli.command(
352
352
  );
353
353
  await server.listen(port);
354
354
  printInfo(options);
355
- _chunk2BMKFV7Cjs.parser.filterDisabled(options.data);
355
+ _chunk3SSSSIJPjs.parser.filterDisabled(options.data);
356
356
  const result = await exportSlides({
357
357
  port,
358
358
  ...getExportOptions({ ...args, entry: entryFile }, options)
@@ -388,8 +388,8 @@ cli.command(
388
388
  const { exportNotes } = await Promise.resolve().then(() => require("./export-MCALG7XD.js"));
389
389
  const port = await findFreePort(12445);
390
390
  for (const entryFile of entry) {
391
- const options = await _chunk2BMKFV7Cjs.resolveOptions.call(void 0, { entry: entryFile }, "export");
392
- const server = await _chunk2BMKFV7Cjs.createServer.call(void 0,
391
+ const options = await _chunk3SSSSIJPjs.resolveOptions.call(void 0, { entry: entryFile }, "export");
392
+ const server = await _chunk3SSSSIJPjs.createServer.call(void 0,
393
393
  options,
394
394
  {
395
395
  server: { port },
@@ -398,7 +398,7 @@ cli.command(
398
398
  );
399
399
  await server.listen(port);
400
400
  printInfo(options);
401
- _chunk2BMKFV7Cjs.parser.filterDisabled(options.data);
401
+ _chunk3SSSSIJPjs.parser.filterDisabled(options.data);
402
402
  const result = await exportNotes({
403
403
  port,
404
404
  output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${_path2.default.basename(entryFile, ".md")}-export-notes`),
@@ -459,7 +459,7 @@ function printInfo(options, port, remote, tunnelUrl) {
459
459
  console.log();
460
460
  console.log();
461
461
  console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
462
- console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunk2BMKFV7Cjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
462
+ console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunk3SSSSIJPjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
463
463
  console.log();
464
464
  _parser.verifyConfig.call(void 0, options.data.config, options.data.themeMeta, (v) => console.warn(_kolorist.yellow.call(void 0, ` ! ${v}`)));
465
465
  console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
package/dist/cli.mjs CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  resolveOptions,
10
10
  resolveThemeName,
11
11
  version
12
- } from "./chunk-BAK2YZDZ.mjs";
12
+ } from "./chunk-XH4NQ4ZL.mjs";
13
13
  import {
14
14
  require_fast_deep_equal
15
- } from "./chunk-IMVZEGBY.mjs";
15
+ } from "./chunk-3TJE2CDX.mjs";
16
16
  import {
17
17
  loadSetups
18
18
  } from "./chunk-JDHANZ37.mjs";
@@ -260,7 +260,7 @@ cli.command(
260
260
  }).strict().help(),
261
261
  async (args) => {
262
262
  const { entry, theme, watch, base, download, out, inspect } = args;
263
- const { build } = await import("./build-UUIAUK3H.mjs");
263
+ const { build } = await import("./build-BUNPGN2Z.mjs");
264
264
  for (const entryFile of entry) {
265
265
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
266
266
  if (download && !options.data.config.download)
package/dist/index.js CHANGED
@@ -9,13 +9,13 @@
9
9
 
10
10
 
11
11
 
12
- var _chunk2BMKFV7Cjs = require('./chunk-2BMKFV7C.js');
12
+ var _chunk3SSSSIJPjs = require('./chunk-3SSSSIJP.js');
13
13
 
14
14
 
15
15
  var _chunkJ7PXWEZ7js = require('./chunk-J7PXWEZ7.js');
16
16
 
17
17
 
18
- var _chunkDXJWPFLIjs = require('./chunk-DXJWPFLI.js');
18
+ var _chunkB2S4FMPEjs = require('./chunk-B2S4FMPE.js');
19
19
  require('./chunk-KKGXM3XL.js');
20
20
  require('./chunk-JQHGZJGJ.js');
21
21
  require('./chunk-YUG22S6W.js');
@@ -32,4 +32,4 @@ require('./chunk-YUG22S6W.js');
32
32
 
33
33
 
34
34
 
35
- exports.ViteSlidevPlugin = _chunkDXJWPFLIjs.ViteSlidevPlugin; exports.createServer = _chunk2BMKFV7Cjs.createServer; exports.createWindiCSSPlugin = _chunkJ7PXWEZ7js.createWindiCSSPlugin; exports.getAddonRoots = _chunk2BMKFV7Cjs.getAddonRoots; exports.getCLIRoot = _chunk2BMKFV7Cjs.getCLIRoot; exports.getClientRoot = _chunk2BMKFV7Cjs.getClientRoot; exports.getRoot = _chunk2BMKFV7Cjs.getRoot; exports.getThemeRoots = _chunk2BMKFV7Cjs.getThemeRoots; exports.getUserRoot = _chunk2BMKFV7Cjs.getUserRoot; exports.isPath = _chunk2BMKFV7Cjs.isPath; exports.parser = _chunk2BMKFV7Cjs.parser; exports.resolveOptions = _chunk2BMKFV7Cjs.resolveOptions;
35
+ exports.ViteSlidevPlugin = _chunkB2S4FMPEjs.ViteSlidevPlugin; exports.createServer = _chunk3SSSSIJPjs.createServer; exports.createWindiCSSPlugin = _chunkJ7PXWEZ7js.createWindiCSSPlugin; exports.getAddonRoots = _chunk3SSSSIJPjs.getAddonRoots; exports.getCLIRoot = _chunk3SSSSIJPjs.getCLIRoot; exports.getClientRoot = _chunk3SSSSIJPjs.getClientRoot; exports.getRoot = _chunk3SSSSIJPjs.getRoot; exports.getThemeRoots = _chunk3SSSSIJPjs.getThemeRoots; exports.getUserRoot = _chunk3SSSSIJPjs.getUserRoot; exports.isPath = _chunk3SSSSIJPjs.isPath; exports.parser = _chunk3SSSSIJPjs.parser; exports.resolveOptions = _chunk3SSSSIJPjs.resolveOptions;
package/dist/index.mjs CHANGED
@@ -9,13 +9,13 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-BAK2YZDZ.mjs";
12
+ } from "./chunk-XH4NQ4ZL.mjs";
13
13
  import {
14
14
  createWindiCSSPlugin
15
15
  } from "./chunk-HO75FTDI.mjs";
16
16
  import {
17
17
  ViteSlidevPlugin
18
- } from "./chunk-IMVZEGBY.mjs";
18
+ } from "./chunk-3TJE2CDX.mjs";
19
19
  import "./chunk-JDHANZ37.mjs";
20
20
  import "./chunk-ZEKM4EGL.mjs";
21
21
  import "./chunk-QHOBBTS4.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.43.0-beta.5",
3
+ "version": "0.43.0-beta.6",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -71,7 +71,7 @@
71
71
  "markdown-it": "^13.0.1",
72
72
  "markdown-it-footnote": "^3.0.3",
73
73
  "markdown-it-link-attributes": "^4.0.1",
74
- "markdown-it-mdc": "^0.1.2",
74
+ "markdown-it-mdc": "^0.1.3",
75
75
  "monaco-editor": "^0.37.1",
76
76
  "nanoid": "^4.0.2",
77
77
  "open": "^8.4.1",
@@ -98,9 +98,9 @@
98
98
  "vue": "^3.3.4",
99
99
  "windicss": "^3.5.6",
100
100
  "yargs": "^17.7.2",
101
- "@slidev/client": "0.43.0-beta.5",
102
- "@slidev/parser": "0.43.0-beta.5",
103
- "@slidev/types": "0.43.0-beta.5"
101
+ "@slidev/client": "0.43.0-beta.6",
102
+ "@slidev/parser": "0.43.0-beta.6",
103
+ "@slidev/types": "0.43.0-beta.6"
104
104
  },
105
105
  "devDependencies": {
106
106
  "@types/plantuml-encoder": "^1.4.0",