@slidev/cli 0.49.0-beta.3 → 0.49.0-beta.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/README.md CHANGED
@@ -79,7 +79,7 @@ For a full example, you can check the [demo](https://github.com/slidevjs/slidev/
79
79
  - [Vite](https://vitejs.dev) - An extremely fast frontend tooling
80
80
  - [Vue 3](https://v3.vuejs.org/) powered [Markdown](https://daringfireball.net/projects/markdown/syntax) - Focus on the content while having the power of HTML and Vue components whenever needed
81
81
  - [UnoCSS](https://github.com/unocss/unocss) - On-demand utility-first CSS engine, style your slides at ease
82
- - [Prism](https://github.com/PrismJS/prism), [Shiki](https://github.com/shikijs/shiki), [Monaco Editor](https://github.com/Microsoft/monaco-editor) - First-class code snippets support with live coding capability
82
+ - [Shiki](https://github.com/shikijs/shiki), [Monaco Editor](https://github.com/Microsoft/monaco-editor) - First-class code snippets support with live coding capability
83
83
  - [RecordRTC](https://recordrtc.org) - Built-in recording and camera view
84
84
  - [VueUse](https://vueuse.org) family - [`@vueuse/core`](https://github.com/vueuse/vueuse), [`@vueuse/motion`](https://github.com/vueuse/motion), etc.
85
85
  - [Iconify](https://iconify.design/) - Iconsets collection.
@@ -2,7 +2,7 @@ import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml,
4
4
  mergeViteConfigs
5
- } from "./chunk-Y6VNORK4.mjs";
5
+ } from "./chunk-NZM6E5T7.mjs";
6
6
  import "./chunk-LOUKLO2C.mjs";
7
7
  import "./chunk-AQQIBD5X.mjs";
8
8
  import "./chunk-BXO7ZPPU.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-Y6VNORK4.mjs";
4
+ } from "./chunk-NZM6E5T7.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.49.0-beta.3";
51
+ var version = "0.49.0-beta.4";
52
52
 
53
53
  // node/integrations/themes.ts
54
54
  import { join as join2 } from "node:path";
@@ -6706,14 +6706,14 @@ var require_parser = __commonJS({
6706
6706
  case "scalar":
6707
6707
  case "single-quoted-scalar":
6708
6708
  case "double-quoted-scalar": {
6709
- const fs7 = this.flowScalar(this.type);
6709
+ const fs6 = this.flowScalar(this.type);
6710
6710
  if (atNextItem || it.value) {
6711
- map.items.push({ start, key: fs7, sep: [] });
6711
+ map.items.push({ start, key: fs6, sep: [] });
6712
6712
  this.onKeyLine = true;
6713
6713
  } else if (it.sep) {
6714
- this.stack.push(fs7);
6714
+ this.stack.push(fs6);
6715
6715
  } else {
6716
- Object.assign(it, { key: fs7, sep: [] });
6716
+ Object.assign(it, { key: fs6, sep: [] });
6717
6717
  this.onKeyLine = true;
6718
6718
  }
6719
6719
  return;
@@ -6831,13 +6831,13 @@ var require_parser = __commonJS({
6831
6831
  case "scalar":
6832
6832
  case "single-quoted-scalar":
6833
6833
  case "double-quoted-scalar": {
6834
- const fs7 = this.flowScalar(this.type);
6834
+ const fs6 = this.flowScalar(this.type);
6835
6835
  if (!it || it.value)
6836
- fc.items.push({ start: [], key: fs7, sep: [] });
6836
+ fc.items.push({ start: [], key: fs6, sep: [] });
6837
6837
  else if (it.sep)
6838
- this.stack.push(fs7);
6838
+ this.stack.push(fs6);
6839
6839
  else
6840
- Object.assign(it, { key: fs7, sep: [] });
6840
+ Object.assign(it, { key: fs6, sep: [] });
6841
6841
  return;
6842
6842
  }
6843
6843
  case "flow-map-end":
@@ -7315,7 +7315,7 @@ var dependencies = {
7315
7315
  "@slidev/types": "workspace:*",
7316
7316
  "@typescript/ata": "^0.9.4",
7317
7317
  "@unhead/vue": "^1.9.5",
7318
- "@unocss/reset": "^0.59.2",
7318
+ "@unocss/reset": "^0.59.3",
7319
7319
  "@vueuse/core": "^10.9.0",
7320
7320
  "@vueuse/math": "^10.9.0",
7321
7321
  "@vueuse/motion": "^2.1.0",
@@ -7331,10 +7331,10 @@ var dependencies = {
7331
7331
  prettier: "^3.2.5",
7332
7332
  recordrtc: "^5.6.2",
7333
7333
  shiki: "^1.3.0",
7334
- "shiki-magic-move": "^0.3.5",
7334
+ "shiki-magic-move": "^0.3.6",
7335
7335
  typescript: "^5.4.5",
7336
- unocss: "^0.59.2",
7337
- vue: "^3.4.21",
7336
+ unocss: "^0.59.3",
7337
+ vue: "^3.4.22",
7338
7338
  "vue-demi": "^0.14.7",
7339
7339
  "vue-router": "^4.3.0",
7340
7340
  yaml: "^2.4.1"
@@ -7496,9 +7496,8 @@ function getDefine(options) {
7496
7496
 
7497
7497
  // node/vite/loaders.ts
7498
7498
  import path from "node:path";
7499
- import { isString as isString2, isTruthy as isTruthy2, notNullish, range } from "@antfu/utils";
7499
+ import { isString as isString2, isTruthy, notNullish, range } from "@antfu/utils";
7500
7500
  import fg3 from "fast-glob";
7501
- import fs4 from "fs-extra";
7502
7501
  import Markdown from "markdown-it";
7503
7502
  import { bold, gray, red, yellow } from "kolorist";
7504
7503
  import mila from "markdown-it-link-attributes";
@@ -7635,83 +7634,55 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
7635
7634
  }
7636
7635
  };
7637
7636
 
7638
- // node/virtual/monaco-types.ts
7639
- import { builtinModules } from "node:module";
7640
- import { join as join5, resolve as resolve2 } from "node:path";
7641
- import fg2 from "fast-glob";
7637
+ // node/virtual/monaco-deps.ts
7638
+ import { resolve as resolve2 } from "node:path";
7642
7639
  import { uniq as uniq2 } from "@antfu/utils";
7643
-
7644
- // node/syntax/transform/monaco.ts
7645
- import { isTruthy } from "@antfu/utils";
7646
- import lz from "lz-string";
7647
- function transformMonaco(ctx, enabled = true) {
7648
- if (!enabled) {
7649
- ctx.s.replace(/{monaco([\w:,-]*)}/g, "");
7650
- return;
7651
- }
7652
- ctx.s.replace(
7653
- /^```(\w+?)\s*{monaco-diff}\s*?({.*?})?\s*?\n([\s\S]+?)^~~~\s*?\n([\s\S]+?)^```/mg,
7654
- (full, lang = "ts", options = "{}", code, diff, index) => {
7655
- lang = lang.trim();
7656
- options = options.trim() || "{}";
7657
- const encoded = lz.compressToBase64(code);
7658
- const encodedDiff = lz.compressToBase64(diff);
7659
- ctx.ignores.push([index, index + full.length]);
7660
- return `<Monaco code-lz="${encoded}" diff-lz="${encodedDiff}" lang="${lang}" v-bind="${options}" />`;
7661
- }
7662
- );
7663
- ctx.s.replace(
7664
- /^```(\w+?)\s*{monaco}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg,
7665
- (full, lang = "ts", options = "{}", code, index) => {
7666
- lang = lang.trim();
7667
- options = options.trim() || "{}";
7668
- const encoded = lz.compressToBase64(code);
7669
- ctx.ignores.push([index, index + full.length]);
7670
- return `<Monaco code-lz="${encoded}" lang="${lang}" v-bind="${options}" />`;
7671
- }
7672
- );
7673
- ctx.s.replace(
7674
- /^```(\w+?)\s*{monaco-run}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg,
7675
- (full, lang = "ts", options = "{}", code, index) => {
7676
- lang = lang.trim();
7677
- options = options.trim() || "{}";
7678
- const encoded = lz.compressToBase64(code);
7679
- ctx.ignores.push([index, index + full.length]);
7680
- return `<Monaco runnable code-lz="${encoded}" lang="${lang}" v-bind="${options}" />`;
7681
- }
7682
- );
7683
- }
7684
- function scanMonacoModules(md2) {
7685
- const typeModules = /* @__PURE__ */ new Set();
7686
- md2.replace(
7687
- /^```(\w+?)\s*{monaco([\w:,-]*)}[\s\n]*([\s\S]+?)^```/mg,
7688
- (full, lang = "ts", options, code) => {
7689
- options = options || "";
7690
- lang = lang.trim();
7691
- if (lang === "ts" || lang === "typescript") {
7692
- Array.from(code.matchAll(/\s+from\s+(["'])([\/\w@-]+)\1/g)).map((i) => i[2]).filter(isTruthy).map((i) => typeModules.add(i));
7693
- }
7640
+ var templateMonacoRunDeps = {
7641
+ id: "/@slidev/monaco-run-deps",
7642
+ getContent: async ({ userRoot, data }, _ctx, pluginCtx) => {
7643
+ if (!data.features.monaco)
7694
7644
  return "";
7645
+ const deps = uniq2(data.features.monaco.deps.concat(data.config.monacoTypesAdditionalPackages));
7646
+ const importerPath = resolve2(userRoot, "./snippets/__importer__.ts");
7647
+ let result = "";
7648
+ for (let i = 0; i < deps.length; i++) {
7649
+ const specifier = deps[i];
7650
+ const resolved = await pluginCtx.resolve(specifier, importerPath);
7651
+ if (!resolved)
7652
+ continue;
7653
+ result += `import * as vendored${i} from ${JSON.stringify(resolved.id)}
7654
+ `;
7695
7655
  }
7696
- );
7697
- return Array.from(typeModules);
7698
- }
7656
+ result += "export default {\n";
7657
+ for (let i = 0; i < deps.length; i++)
7658
+ result += `${JSON.stringify(deps[i])}: vendored${i},
7659
+ `;
7660
+ result += "}\n";
7661
+ return result;
7662
+ }
7663
+ };
7699
7664
 
7700
7665
  // node/virtual/monaco-types.ts
7666
+ import { builtinModules } from "node:module";
7667
+ import { join as join5, resolve as resolve3 } from "node:path";
7668
+ import fg2 from "fast-glob";
7669
+ import { uniq as uniq3 } from "@antfu/utils";
7701
7670
  var templateMonacoTypes = {
7702
7671
  id: "/@slidev/monaco-types",
7703
7672
  getContent: async ({ userRoot, data }) => {
7673
+ if (!data.features.monaco)
7674
+ return "";
7704
7675
  const typesRoot = join5(userRoot, "snippets");
7705
7676
  const files = await fg2(["**/*.ts", "**/*.mts", "**/*.cts"], { cwd: typesRoot });
7706
7677
  let result = 'import { addFile } from "@slidev/client/setup/monaco.ts"\n';
7707
7678
  for (const file of files) {
7708
- const url = `${toAtFS(resolve2(typesRoot, file))}?monaco-types&raw`;
7679
+ const url = `${toAtFS(resolve3(typesRoot, file))}?monaco-types&raw`;
7709
7680
  result += `addFile(import(${JSON.stringify(url)}), ${JSON.stringify(file)})
7710
7681
  `;
7711
7682
  }
7712
7683
  const deps = [...data.config.monacoTypesAdditionalPackages];
7713
7684
  if (data.config.monacoTypesSource === "local")
7714
- deps.push(...scanMonacoModules(data.slides.map((s) => s.source.raw).join()));
7685
+ deps.push(...data.features.monaco.types);
7715
7686
  function mapModuleNameToModule(moduleSpecifier) {
7716
7687
  if (moduleSpecifier.startsWith("node:"))
7717
7688
  return "node";
@@ -7724,7 +7695,7 @@ var templateMonacoTypes = {
7724
7695
  const moduleName = a.startsWith("@") ? `${a}/${b}` : a;
7725
7696
  return moduleName;
7726
7697
  }
7727
- for (const specifier of uniq2(deps)) {
7698
+ for (const specifier of uniq3(deps)) {
7728
7699
  if (specifier[0] === ".")
7729
7700
  continue;
7730
7701
  const moduleName = mapModuleNameToModule(specifier);
@@ -7965,6 +7936,7 @@ var templateTitleRenderer = {
7965
7936
  var templates = [
7966
7937
  templateShiki,
7967
7938
  templateMonacoTypes,
7939
+ templateMonacoRunDeps,
7968
7940
  templateConfigs,
7969
7941
  templateStyle,
7970
7942
  templateGlobalBottom,
@@ -7991,13 +7963,13 @@ var templateImportContextUtils = `import {
7991
7963
  } from "@slidev/client/context.ts"`.replace(/\n\s*/g, " ");
7992
7964
  var templateInitContext = `const { $slidev, $nav, $clicksContext, $clicks, $page, $renderContext, $frontmatter } = useSlideContext()`;
7993
7965
  function getBodyJson(req) {
7994
- return new Promise((resolve4, reject) => {
7966
+ return new Promise((resolve5, reject) => {
7995
7967
  let body = "";
7996
7968
  req.on("data", (chunk) => body += chunk);
7997
7969
  req.on("error", reject);
7998
7970
  req.on("end", () => {
7999
7971
  try {
8000
- resolve4(JSON.parse(body) || {});
7972
+ resolve5(JSON.parse(body) || {});
8001
7973
  } catch (e) {
8002
7974
  reject(e);
8003
7975
  }
@@ -8033,7 +8005,7 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8033
8005
  let _layouts_cache_time = 0;
8034
8006
  let _layouts_cache = {};
8035
8007
  let skipHmr = null;
8036
- const { data, clientRoot, userRoot, roots, mode } = options;
8008
+ const { data, clientRoot, roots, mode } = options;
8037
8009
  const templateCtx = {
8038
8010
  md,
8039
8011
  async getLayouts() {
@@ -8108,17 +8080,6 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8108
8080
  }
8109
8081
  next();
8110
8082
  });
8111
- const snippetsPath = path.resolve(userRoot, "snippets/__importer__.ts");
8112
- server.middlewares.use(async (req, res, next) => {
8113
- const match = req.url?.match(/^\/\@slidev\/resolve-id\?specifier=(.*)$/);
8114
- if (!match)
8115
- return next();
8116
- const [, specifier] = match;
8117
- const resolved = await server.pluginContainer.resolveId(specifier, snippetsPath);
8118
- res.statusCode = 200;
8119
- res.write(resolved?.id ?? "");
8120
- return res.end();
8121
- });
8122
8083
  },
8123
8084
  async handleHotUpdate(ctx) {
8124
8085
  if (!data.watchFiles.includes(ctx.file))
@@ -8151,14 +8112,7 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8151
8112
  for (let i = 0; i < length; i++) {
8152
8113
  const a = data.slides[i];
8153
8114
  const b = newData.slides[i];
8154
- if (!hmrPages.has(i) && a.content.trim() === b.content.trim() && a.title?.trim() === b.title?.trim() && equal(a.frontmatter, b.frontmatter) && Object.entries(a.snippetsUsed ?? {}).every(([file, oldContent]) => {
8155
- try {
8156
- const newContent = fs4.readFileSync(file, "utf-8");
8157
- return oldContent === newContent;
8158
- } catch {
8159
- return false;
8160
- }
8161
- })) {
8115
+ if (!hmrPages.has(i) && a.content.trim() === b.content.trim() && a.title?.trim() === b.title?.trim() && equal(a.frontmatter, b.frontmatter)) {
8162
8116
  if (a.note !== b.note) {
8163
8117
  ctx.server.hot.send(
8164
8118
  "slidev:update-note",
@@ -8183,12 +8137,20 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8183
8137
  Object.assign(data, newData);
8184
8138
  if (hmrPages.size > 0)
8185
8139
  moduleIds.add(templateTitleRendererMd.id);
8186
- const vueModules = Array.from(hmrPages).flatMap((i) => [
8187
- ctx.server.moduleGraph.getModuleById(`${VIRTUAL_SLIDE_PREFIX}${i + 1}.frontmatter`),
8188
- ctx.server.moduleGraph.getModuleById(`${VIRTUAL_SLIDE_PREFIX}${i + 1}.md`)
8189
- ]);
8140
+ const vueModules = Array.from(hmrPages).flatMap((i) => {
8141
+ const id = `${VIRTUAL_SLIDE_PREFIX}${i + 1}`;
8142
+ const frontmatter = ctx.server.moduleGraph.getModuleById(`${id}.frontmatter`);
8143
+ const main = ctx.server.moduleGraph.getModuleById(`${id}.md`);
8144
+ const styles = main ? [...main.clientImportedModules].find((m) => m.id?.startsWith(`${id}.md?vue&type=style`)) : void 0;
8145
+ return [
8146
+ frontmatter,
8147
+ main,
8148
+ styles
8149
+ ];
8150
+ });
8190
8151
  hmrPages.clear();
8191
8152
  const moduleEntries = [
8153
+ ...ctx.modules.filter((i) => i.id === templateMonacoRunDeps.id || i.id === templateMonacoTypes.id),
8192
8154
  ...vueModules,
8193
8155
  ...Array.from(moduleIds).map((id) => ctx.server.moduleGraph.getModuleById(id))
8194
8156
  ].filter(notNullish).filter((i) => !i.id?.startsWith("/@id/@vite-icons"));
@@ -8196,7 +8158,7 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8196
8158
  return moduleEntries;
8197
8159
  },
8198
8160
  resolveId(id) {
8199
- if (id.startsWith(VIRTUAL_SLIDE_PREFIX) || id.startsWith("/@slidev/"))
8161
+ if (id.startsWith("/@slidev/"))
8200
8162
  return id;
8201
8163
  return null;
8202
8164
  },
@@ -8204,7 +8166,7 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8204
8166
  const template = templates.find((i) => i.id === id);
8205
8167
  if (template) {
8206
8168
  return {
8207
- code: await template.getContent(options, templateCtx),
8169
+ code: await template.getContent(options, templateCtx, this),
8208
8170
  map: { mappings: "" }
8209
8171
  };
8210
8172
  }
@@ -8344,7 +8306,7 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8344
8306
  content: Array.isArray(keywords) ? keywords.join(", ") : keywords
8345
8307
  }
8346
8308
  }
8347
- ].filter(isTruthy2);
8309
+ ].filter(isTruthy);
8348
8310
  }
8349
8311
  }
8350
8312
  ];
@@ -8455,7 +8417,7 @@ ${code}`;
8455
8417
 
8456
8418
  // node/vite/markdown.ts
8457
8419
  import Markdown2 from "unplugin-vue-markdown/vite";
8458
- import { isTruthy as isTruthy3, slash } from "@antfu/utils";
8420
+ import { isTruthy as isTruthy2, slash as slash2 } from "@antfu/utils";
8459
8421
 
8460
8422
  // ../../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
8461
8423
  var SpecialCharacters;
@@ -8584,8 +8546,7 @@ function startsWithTodoMarkdown(token) {
8584
8546
 
8585
8547
  // node/vite/markdown.ts
8586
8548
  import MarkdownItMdc from "markdown-it-mdc";
8587
- import { SourceMapConsumer } from "source-map-js";
8588
- import MagicString from "magic-string";
8549
+ import MagicString from "magic-string-stack";
8589
8550
  import MarkdownItAttrs from "markdown-it-link-attributes";
8590
8551
  import MarkdownItFootnote from "markdown-it-footnote";
8591
8552
 
@@ -8746,6 +8707,24 @@ import * as htmlparser2 from "htmlparser2";
8746
8707
  function normalizeRangeStr(rangeStr = "") {
8747
8708
  return !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
8748
8709
  }
8710
+ function getCodeBlocks(md2) {
8711
+ const codeblocks = Array.from(md2.matchAll(/^```[\s\S]*?^```/mg)).map((m) => {
8712
+ const start = m.index;
8713
+ const end = m.index + m[0].length;
8714
+ const startLine = md2.slice(0, start).match(/\n/g)?.length || 0;
8715
+ const endLine = md2.slice(0, end).match(/\n/g)?.length || 0;
8716
+ return [start, end, startLine, endLine];
8717
+ });
8718
+ return {
8719
+ codeblocks,
8720
+ isInsideCodeblocks(idx) {
8721
+ return codeblocks.some(([s, e]) => s <= idx && idx <= e);
8722
+ },
8723
+ isLineInsideCodeblocks(line) {
8724
+ return codeblocks.some(([, , s, e]) => s <= line && line <= e);
8725
+ }
8726
+ };
8727
+ }
8749
8728
  function escapeVueInCode(md2) {
8750
8729
  return md2.replace(/{{/g, "&lbrace;&lbrace;");
8751
8730
  }
@@ -8848,11 +8827,28 @@ function markdownItPrism(markdownit, useroptions) {
8848
8827
  }
8849
8828
 
8850
8829
  // node/syntax/markdown-it/markdown-it-v-drag.ts
8851
- function markdownItVDrag(md2, sourceMapConsumers) {
8830
+ import { SourceMapConsumer } from "source-map-js";
8831
+ function markdownItVDrag(md2, markdownTransformMap) {
8852
8832
  const visited = /* @__PURE__ */ new WeakSet();
8833
+ const sourceMapConsumers = /* @__PURE__ */ new WeakMap();
8834
+ function getSourceMapConsumer(id) {
8835
+ const s = markdownTransformMap.get(id);
8836
+ if (!s)
8837
+ return void 0;
8838
+ let smc = sourceMapConsumers.get(s);
8839
+ if (smc)
8840
+ return smc;
8841
+ const sourceMap = s.generateMap();
8842
+ smc = new SourceMapConsumer({
8843
+ ...sourceMap,
8844
+ version: sourceMap.version.toString()
8845
+ });
8846
+ sourceMapConsumers.set(s, smc);
8847
+ return smc;
8848
+ }
8853
8849
  const _parse = md2.parse;
8854
8850
  md2.parse = function(src, env) {
8855
- const smc = sourceMapConsumers[env.id];
8851
+ const smc = getSourceMapConsumer(env.id);
8856
8852
  const toOriginalPos = smc ? (line) => smc.originalPositionFor({ line, column: 0 }).line : (line) => line;
8857
8853
  function toMarkdownSource(map, idx) {
8858
8854
  const [start, end] = map;
@@ -8879,13 +8875,10 @@ var reCodeBlock = /^```([\w'-]+?)(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?(.*?))?\n([\s
8879
8875
  function transformCodeWrapper(ctx) {
8880
8876
  ctx.s.replace(
8881
8877
  reCodeBlock,
8882
- (full, lang = "", rangeStr = "", options = "", attrs = "", code, index) => {
8883
- if (ctx.isIgnored(index))
8884
- return full;
8878
+ (full, lang = "", rangeStr = "", options = "", attrs = "", code) => {
8885
8879
  const ranges = normalizeRangeStr(rangeStr);
8886
8880
  code = code.trimEnd();
8887
8881
  options = options.trim() || "{}";
8888
- ctx.ignores.push([index, index + full.length]);
8889
8882
  return `
8890
8883
  <CodeBlockWrapper v-bind="${options}" :ranges='${JSON.stringify(ranges)}'>
8891
8884
 
@@ -8900,57 +8893,58 @@ ${code}
8900
8893
 
8901
8894
  // node/syntax/transform/magic-move.ts
8902
8895
  import { codeToKeyedTokens } from "shiki-magic-move/core";
8903
- import lz2 from "lz-string";
8896
+ import lz from "lz-string";
8904
8897
  var reMagicMoveBlock = /^````(?:md|markdown) magic-move(?:[ ]*(\{.*?\})?([^\n]*?))?\n([\s\S]+?)^````$/mg;
8905
- function transformMagicMove(ctx, shiki2, shikiOptions2) {
8906
- ctx.s.replace(
8907
- reMagicMoveBlock,
8908
- (full, options = "{}", _attrs = "", body, index) => {
8909
- if (!shiki2 || !shikiOptions2)
8910
- throw new Error("Shiki is required for Magic Move. You may need to set `highlighter: shiki` in your Slidev config.");
8911
- const matches = Array.from(body.matchAll(reCodeBlock));
8912
- if (!matches.length)
8913
- throw new Error("Magic Move block must contain at least one code block");
8914
- const ranges = matches.map((i) => normalizeRangeStr(i[2]));
8915
- const steps = matches.map(
8916
- (i) => codeToKeyedTokens(shiki2, i[5].trimEnd(), {
8917
- ...shikiOptions2,
8918
- lang: i[1]
8919
- })
8920
- );
8921
- const compressed = lz2.compressToBase64(JSON.stringify(steps));
8922
- ctx.ignores.push([index, index + full.length]);
8923
- return `<ShikiMagicMove v-bind="${options}" steps-lz="${compressed}" :step-ranges='${JSON.stringify(ranges)}' />`;
8924
- }
8925
- );
8898
+ function transformMagicMove(shiki, shikiOptions) {
8899
+ return (ctx) => {
8900
+ ctx.s.replace(
8901
+ reMagicMoveBlock,
8902
+ (full, options = "{}", _attrs = "", body) => {
8903
+ if (!shiki || !shikiOptions)
8904
+ throw new Error("Shiki is required for Magic Move. You may need to set `highlighter: shiki` in your Slidev config.");
8905
+ const matches = Array.from(body.matchAll(reCodeBlock));
8906
+ if (!matches.length)
8907
+ throw new Error("Magic Move block must contain at least one code block");
8908
+ const ranges = matches.map((i) => normalizeRangeStr(i[2]));
8909
+ const steps = matches.map(
8910
+ (i) => codeToKeyedTokens(shiki, i[5].trimEnd(), {
8911
+ ...shikiOptions,
8912
+ lang: i[1]
8913
+ })
8914
+ );
8915
+ const compressed = lz.compressToBase64(JSON.stringify(steps));
8916
+ return `<ShikiMagicMove v-bind="${options}" steps-lz="${compressed}" :step-ranges='${JSON.stringify(ranges)}' />`;
8917
+ }
8918
+ );
8919
+ };
8926
8920
  }
8927
8921
 
8928
8922
  // node/syntax/transform/mermaid.ts
8929
- import lz3 from "lz-string";
8923
+ import lz2 from "lz-string";
8930
8924
  function transformMermaid(ctx) {
8931
- ctx.s.replace(/^```mermaid\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", code = "", index) => {
8925
+ ctx.s.replace(/^```mermaid\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", code = "") => {
8932
8926
  code = code.trim();
8933
8927
  options = options.trim() || "{}";
8934
- const encoded = lz3.compressToBase64(code);
8935
- ctx.ignores.push([index, index + full.length]);
8928
+ const encoded = lz2.compressToBase64(code);
8936
8929
  return `<Mermaid code-lz="${encoded}" v-bind="${options}" />`;
8937
8930
  });
8938
8931
  }
8939
8932
 
8940
8933
  // node/syntax/transform/plant-uml.ts
8941
8934
  import { encode as encodePlantUml } from "plantuml-encoder";
8942
- function transformPlantUml(ctx, server) {
8943
- ctx.s.replace(/^```plantuml\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", content = "", index) => {
8935
+ function transformPlantUml(ctx) {
8936
+ const server = ctx.options.data.config.plantUmlServer;
8937
+ ctx.s.replace(/^```plantuml\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", content = "") => {
8944
8938
  const code = encodePlantUml(content.trim());
8945
8939
  options = options.trim() || "{}";
8946
- ctx.ignores.push([index, index + full.length]);
8947
8940
  return `<PlantUml :code="'${code}'" :server="'${server}'" v-bind="${options}" />`;
8948
8941
  });
8949
8942
  }
8950
8943
 
8951
8944
  // node/syntax/transform/snippet.ts
8952
8945
  import path2 from "node:path";
8953
- import fs5 from "fs-extra";
8946
+ import fs4 from "fs-extra";
8947
+ import { slash } from "@antfu/utils";
8954
8948
  function dedent(text) {
8955
8949
  const lines = text.split("\n");
8956
8950
  const minIndentLength = lines.reduce((acc, line) => {
@@ -9002,8 +8996,9 @@ function findRegion(lines, regionName) {
9002
8996
  }
9003
8997
  return null;
9004
8998
  }
9005
- function transformSnippet(ctx, options, id) {
9006
- const slideId = id.match(/(\d+)\.md$/)?.[1];
8999
+ function transformSnippet(ctx) {
9000
+ const options = ctx.options;
9001
+ const slideId = ctx.id.match(/(\d+)\.md$/)?.[1];
9007
9002
  if (!slideId)
9008
9003
  return;
9009
9004
  const data = options.data;
@@ -9013,13 +9008,15 @@ function transformSnippet(ctx, options, id) {
9013
9008
  /^<<< *(.+?)(#[\w-]+)? *(?: (\S+?))? *(\{.*)?$/mg,
9014
9009
  (full, filepath = "", regionName = "", lang = "", meta = "") => {
9015
9010
  const firstLine = `\`\`\`${lang || path2.extname(filepath).slice(1)} ${meta}`;
9016
- const src = /^\@[\/]/.test(filepath) ? path2.resolve(options.userRoot, filepath.slice(2)) : path2.resolve(dir, filepath);
9011
+ const src = slash(
9012
+ /^\@[\/]/.test(filepath) ? path2.resolve(options.userRoot, filepath.slice(2)) : path2.resolve(dir, filepath)
9013
+ );
9017
9014
  data.watchFiles.push(src);
9018
- const isAFile = fs5.statSync(src).isFile();
9019
- if (!fs5.existsSync(src) || !isAFile) {
9015
+ const isAFile = fs4.statSync(src).isFile();
9016
+ if (!fs4.existsSync(src) || !isAFile) {
9020
9017
  throw new Error(isAFile ? `Code snippet path not found: ${src}` : `Invalid code snippet option`);
9021
9018
  }
9022
- let content = fs5.readFileSync(src, "utf8");
9019
+ let content = fs4.readFileSync(src, "utf8");
9023
9020
  slideInfo.snippetsUsed ??= {};
9024
9021
  slideInfo.snippetsUsed[src] = content;
9025
9022
  if (regionName) {
@@ -9041,6 +9038,7 @@ ${content}
9041
9038
  // node/syntax/transform/slot-sugar.ts
9042
9039
  function transformSlotSugar(ctx) {
9043
9040
  const linesWithNewline = ctx.s.original.split(/(\r?\n)/g);
9041
+ const codeBlocks = getCodeBlocks(ctx.s.original);
9044
9042
  const lines = [];
9045
9043
  for (let i = 0; i < linesWithNewline.length; i += 2) {
9046
9044
  const line = linesWithNewline[i];
@@ -9052,7 +9050,7 @@ function transformSlotSugar(ctx) {
9052
9050
  lines.forEach((line) => {
9053
9051
  const start = offset;
9054
9052
  offset += line.length;
9055
- if (ctx.isIgnored(start))
9053
+ if (codeBlocks.isInsideCodeblocks(offset))
9056
9054
  return;
9057
9055
  const match = line.match(/^::\s*([\w\.\-\:]+)\s*::(\s*)?$/);
9058
9056
  if (match) {
@@ -9066,14 +9064,15 @@ function transformSlotSugar(ctx) {
9066
9064
  }
9067
9065
 
9068
9066
  // node/syntax/transform/in-page-css.ts
9069
- function transformPageCSS(ctx, id) {
9070
- const page = id.match(/(\d+)\.md$/)?.[1];
9067
+ function transformPageCSS(ctx) {
9068
+ const page = ctx.id.match(/(\d+)\.md$/)?.[1];
9071
9069
  if (!page)
9072
9070
  return;
9071
+ const codeBlocks = getCodeBlocks(ctx.s.original);
9073
9072
  ctx.s.replace(
9074
9073
  /(\n<style[^>]*?>)([\s\S]+?)(<\/style>)/g,
9075
9074
  (full, start, css, end, index) => {
9076
- if (ctx.isIgnored(index))
9075
+ if (codeBlocks.isInsideCodeblocks(index))
9077
9076
  return full;
9078
9077
  if (!start.includes("scoped"))
9079
9078
  start = start.replace("<style", "<style scoped");
@@ -9083,15 +9082,52 @@ ${css}${end}`;
9083
9082
  );
9084
9083
  }
9085
9084
 
9085
+ // node/syntax/transform/monaco.ts
9086
+ import lz3 from "lz-string";
9087
+ function transformMonaco(ctx) {
9088
+ const enabled = ctx.options.data.config.monaco === true || ctx.options.data.config.monaco === ctx.options.mode;
9089
+ if (!enabled) {
9090
+ ctx.s.replace(/{monaco([\w:,-]*)}/g, "");
9091
+ return;
9092
+ }
9093
+ ctx.s.replace(
9094
+ /^```(\w+?)\s*{monaco-diff}\s*?({.*?})?\s*?\n([\s\S]+?)^~~~\s*?\n([\s\S]+?)^```/mg,
9095
+ (full, lang = "ts", options = "{}", code, diff) => {
9096
+ lang = lang.trim();
9097
+ options = options.trim() || "{}";
9098
+ const encoded = lz3.compressToBase64(code);
9099
+ const encodedDiff = lz3.compressToBase64(diff);
9100
+ return `<Monaco code-lz="${encoded}" diff-lz="${encodedDiff}" lang="${lang}" v-bind="${options}" />`;
9101
+ }
9102
+ );
9103
+ ctx.s.replace(
9104
+ /^```(\w+?)\s*{monaco}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg,
9105
+ (full, lang = "ts", options = "{}", code) => {
9106
+ lang = lang.trim();
9107
+ options = options.trim() || "{}";
9108
+ const encoded = lz3.compressToBase64(code);
9109
+ return `<Monaco code-lz="${encoded}" lang="${lang}" v-bind="${options}" />`;
9110
+ }
9111
+ );
9112
+ ctx.s.replace(
9113
+ /^```(\w+?)\s*{monaco-run}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg,
9114
+ (full, lang = "ts", options = "{}", code) => {
9115
+ lang = lang.trim();
9116
+ options = options.trim() || "{}";
9117
+ const encoded = lz3.compressToBase64(code);
9118
+ return `<Monaco runnable code-lz="${encoded}" lang="${lang}" v-bind="${options}" />`;
9119
+ }
9120
+ );
9121
+ }
9122
+
9086
9123
  // node/syntax/transform/katex-wrapper.ts
9087
9124
  function transformKaTexWrapper(ctx) {
9088
9125
  ctx.s.replace(
9089
9126
  /^\$\$(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?\s*?)?\n([\s\S]+?)^\$\$/mg,
9090
- (full, rangeStr = "", options = "", code, index) => {
9127
+ (full, rangeStr = "", options = "", code) => {
9091
9128
  const ranges = !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
9092
9129
  code = code.trimEnd();
9093
9130
  options = options.trim() || "{}";
9094
- ctx.ignores.push([index, index + full.length]);
9095
9131
  return `<KaTexBlockWrapper v-bind="${options}" :ranges='${JSON.stringify(ranges)}'>
9096
9132
 
9097
9133
  $$
@@ -9104,63 +9140,25 @@ $$
9104
9140
  }
9105
9141
 
9106
9142
  // node/vite/markdown.ts
9107
- var shiki;
9108
- var shikiOptions;
9109
9143
  async function createMarkdownPlugin(options, { markdown: mdOptions }) {
9110
9144
  const { data: { config }, roots, mode, entry, clientRoot } = options;
9111
9145
  const setups = [];
9112
- const entryPath = slash(entry);
9146
+ const entryPath = slash2(entry);
9147
+ let shiki;
9148
+ let shikiOptions;
9113
9149
  if (config.highlighter === "shiki") {
9114
- const [
9115
- options2,
9116
- { getHighlighter, bundledLanguages },
9117
- markdownItShiki,
9118
- transformerTwoslash
9119
- ] = await Promise.all([
9120
- loadShikiSetups(clientRoot, roots),
9121
- import("shiki").then(({ getHighlighter: getHighlighter2, bundledLanguages: bundledLanguages2 }) => ({ bundledLanguages: bundledLanguages2, getHighlighter: getHighlighter2 })),
9122
- import("@shikijs/markdown-it/core").then(({ fromHighlighter }) => fromHighlighter),
9123
- import("@shikijs/vitepress-twoslash").then(({ transformerTwoslash: transformerTwoslash2 }) => transformerTwoslash2)
9124
- ]);
9125
- shikiOptions = options2;
9126
- shiki = await getHighlighter({
9127
- ...options2,
9128
- langs: options2.langs ?? Object.keys(bundledLanguages),
9129
- themes: "themes" in options2 ? Object.values(options2.themes) : [options2.theme]
9130
- });
9131
- const twoslashEnabled = config.twoslash === true || config.twoslash === mode;
9132
- const transformers = [
9133
- ...options2.transformers || [],
9134
- twoslashEnabled && transformerTwoslash({
9135
- explicitTrigger: true,
9136
- twoslashOptions: {
9137
- handbookOptions: {
9138
- noErrorValidation: true
9139
- }
9140
- }
9141
- }),
9142
- {
9143
- pre(pre) {
9144
- this.addClassToHast(pre, "slidev-code");
9145
- delete pre.properties.tabindex;
9146
- },
9147
- postprocess(code) {
9148
- return escapeVueInCode(code);
9149
- }
9150
- }
9151
- ].filter(isTruthy3);
9152
- const plugin = markdownItShiki(shiki, {
9153
- ...options2,
9154
- transformers
9155
- });
9156
- setups.push((md2) => md2.use(plugin));
9150
+ const result = await createMarkdownItShiki(clientRoot, roots, config, mode);
9151
+ shiki = result.shiki;
9152
+ shikiOptions = result.shikiOptions;
9153
+ setups.push((md2) => md2.use(result.plugin));
9157
9154
  } else {
9155
+ console.warn("[Slidev] Highlighter: Prism highlighter is deprecated, and will be removed in v0.50. Refer to https://github.com/slidevjs/slidev/issues/1390");
9158
9156
  setups.push((md2) => md2.use(markdownItPrism));
9159
9157
  }
9160
9158
  if (config.mdc)
9161
9159
  setups.push((md2) => md2.use(MarkdownItMdc));
9162
9160
  const KatexOptions = await loadSetups(options.clientRoot, roots, "katex.ts", {}, { strict: false }, false);
9163
- const sourceMapConsumers = {};
9161
+ const markdownTransformMap = /* @__PURE__ */ new Map();
9164
9162
  return Markdown2({
9165
9163
  include: [/\.md$/],
9166
9164
  wrapperClasses: "",
@@ -9182,10 +9180,11 @@ async function createMarkdownPlugin(options, { markdown: mdOptions }) {
9182
9180
  rel: "noopener"
9183
9181
  }
9184
9182
  });
9183
+ md2.use(MarkdownItEscapeInlineCode);
9185
9184
  md2.use(MarkdownItFootnote);
9186
9185
  md2.use(taskLists, { enabled: true, lineNumber: true, label: true });
9187
9186
  md2.use(math_plugin, KatexOptions);
9188
- md2.use(markdownItVDrag, sourceMapConsumers);
9187
+ md2.use(markdownItVDrag, markdownTransformMap);
9189
9188
  setups.forEach((i) => i(md2));
9190
9189
  mdOptions?.markdownItSetup?.(md2);
9191
9190
  },
@@ -9193,34 +9192,94 @@ async function createMarkdownPlugin(options, { markdown: mdOptions }) {
9193
9192
  before(code, id) {
9194
9193
  if (id === entryPath)
9195
9194
  return "";
9196
- const monacoEnabled = config.monaco === true || config.monaco === mode;
9197
9195
  const ctx = {
9198
9196
  s: new MagicString(code),
9199
- ignores: [],
9200
- isIgnored(index) {
9201
- return index < 0 || ctx.ignores.some(([start, end]) => start <= index && index < end);
9202
- }
9197
+ id,
9198
+ options
9203
9199
  };
9204
- transformSnippet(ctx, options, id);
9205
- if (config.highlighter === "shiki")
9206
- transformMagicMove(ctx, shiki, shikiOptions);
9207
- transformMermaid(ctx);
9208
- transformPlantUml(ctx, config.plantUmlServer);
9209
- transformMonaco(ctx, monacoEnabled);
9210
- transformCodeWrapper(ctx);
9211
- transformKaTexWrapper(ctx);
9212
- transformPageCSS(ctx, id);
9213
- transformSlotSugar(ctx);
9214
- const sourceMap = ctx.s.generateMap();
9215
- sourceMapConsumers[id] = new SourceMapConsumer({
9216
- ...sourceMap,
9217
- version: sourceMap.version.toString()
9218
- });
9200
+ applyMarkdownTransform(ctx, shiki, shikiOptions);
9201
+ markdownTransformMap.set(id, ctx.s);
9219
9202
  return ctx.s.toString();
9220
9203
  }
9221
9204
  }
9222
9205
  });
9223
9206
  }
9207
+ async function createMarkdownItShiki(clientRoot, roots, config, mode) {
9208
+ const [
9209
+ shikiOptions,
9210
+ { getHighlighter, bundledLanguages },
9211
+ markdownItShiki,
9212
+ transformerTwoslash
9213
+ ] = await Promise.all([
9214
+ loadShikiSetups(clientRoot, roots),
9215
+ import("shiki").then(({ getHighlighter: getHighlighter2, bundledLanguages: bundledLanguages2 }) => ({ bundledLanguages: bundledLanguages2, getHighlighter: getHighlighter2 })),
9216
+ import("@shikijs/markdown-it/core").then(({ fromHighlighter }) => fromHighlighter),
9217
+ import("@shikijs/vitepress-twoslash").then(({ transformerTwoslash: transformerTwoslash2 }) => transformerTwoslash2)
9218
+ ]);
9219
+ const shiki = await getHighlighter({
9220
+ ...shikiOptions,
9221
+ langs: shikiOptions.langs ?? Object.keys(bundledLanguages),
9222
+ themes: "themes" in shikiOptions ? Object.values(shikiOptions.themes) : [shikiOptions.theme]
9223
+ });
9224
+ const twoslashEnabled = config.twoslash === true || config.twoslash === mode;
9225
+ const transformers = [
9226
+ ...shikiOptions.transformers || [],
9227
+ twoslashEnabled && transformerTwoslash({
9228
+ explicitTrigger: true,
9229
+ twoslashOptions: {
9230
+ handbookOptions: {
9231
+ noErrorValidation: true
9232
+ }
9233
+ }
9234
+ }),
9235
+ {
9236
+ pre(pre) {
9237
+ this.addClassToHast(pre, "slidev-code");
9238
+ delete pre.properties.tabindex;
9239
+ },
9240
+ postprocess(code) {
9241
+ return escapeVueInCode(code);
9242
+ }
9243
+ }
9244
+ ].filter(isTruthy2);
9245
+ const plugin = markdownItShiki(shiki, {
9246
+ ...shikiOptions,
9247
+ transformers
9248
+ });
9249
+ return {
9250
+ shiki,
9251
+ shikiOptions,
9252
+ plugin
9253
+ };
9254
+ }
9255
+ function MarkdownItEscapeInlineCode(md2) {
9256
+ const codeInline = md2.renderer.rules.code_inline;
9257
+ md2.renderer.rules.code_inline = (tokens, idx, options, env, self) => {
9258
+ const result = codeInline(tokens, idx, options, env, self);
9259
+ return result.replace(/^<code/, "<code v-pre");
9260
+ };
9261
+ }
9262
+ function applyMarkdownTransform(ctx, shiki, shikiOptions) {
9263
+ const transformers = [
9264
+ transformSnippet,
9265
+ ctx.options.data.config.highlighter ? transformMagicMove(shiki, shikiOptions) : void 0,
9266
+ transformMermaid,
9267
+ transformPlantUml,
9268
+ transformMonaco,
9269
+ transformCodeWrapper,
9270
+ transformKaTexWrapper,
9271
+ transformPageCSS,
9272
+ transformSlotSugar
9273
+ ];
9274
+ for (const transformer of transformers) {
9275
+ if (!transformer)
9276
+ continue;
9277
+ transformer(ctx);
9278
+ if (!ctx.s.isEmpty())
9279
+ ctx.s.commit();
9280
+ }
9281
+ return ctx;
9282
+ }
9224
9283
 
9225
9284
  // node/vite/compilerFlagsVue.ts
9226
9285
  import { objectEntries } from "@antfu/utils";
@@ -9245,9 +9304,9 @@ function createVueCompilerFlagsPlugin(options) {
9245
9304
  }
9246
9305
 
9247
9306
  // node/vite/monacoTypes.ts
9248
- import fs6 from "node:fs/promises";
9249
- import { dirname as dirname2, resolve as resolve3 } from "node:path";
9250
- import { slash as slash2 } from "@antfu/utils";
9307
+ import fs5 from "node:fs/promises";
9308
+ import { dirname as dirname2, resolve as resolve4 } from "node:path";
9309
+ import { slash as slash3 } from "@antfu/utils";
9251
9310
  import fg4 from "fast-glob";
9252
9311
  import { findDepPkgJsonPath } from "vitefu";
9253
9312
  function createMonacoTypesLoader({ userRoot }) {
@@ -9271,11 +9330,11 @@ function createMonacoTypesLoader({ userRoot }) {
9271
9330
  if (!pkgJsonPath)
9272
9331
  throw new Error(`Package "${pkg}" not found in "${importer}"`);
9273
9332
  const root = dirname2(pkgJsonPath);
9274
- const pkgJson = JSON.parse(await fs6.readFile(pkgJsonPath, "utf-8"));
9333
+ const pkgJson = JSON.parse(await fs5.readFile(pkgJsonPath, "utf-8"));
9275
9334
  const deps = pkgJson.dependencies ?? {};
9276
9335
  return [
9277
- `import "/@slidev-monaco-types/load?root=${slash2(root)}&name=${pkgJson.name}"`,
9278
- ...Object.keys(deps).map((dep) => `import "/@slidev-monaco-types/resolve?pkg=${dep}&importer=${slash2(root)}"`)
9336
+ `import "/@slidev-monaco-types/load?root=${slash3(root)}&name=${pkgJson.name}"`,
9337
+ ...Object.keys(deps).map((dep) => `import "/@slidev-monaco-types/resolve?pkg=${dep}&importer=${slash3(root)}"`)
9279
9338
  ].join("\n");
9280
9339
  }
9281
9340
  const matchLoad = id.match(/^\/\@slidev-monaco-types\/load\?root=(.*?)&name=(.*)$/);
@@ -9298,7 +9357,7 @@ function createMonacoTypesLoader({ userRoot }) {
9298
9357
  return "";
9299
9358
  return [
9300
9359
  'import { addFile } from "@slidev/client/setup/monaco.ts"',
9301
- ...files.map((file) => `addFile(import(${JSON.stringify(`${toAtFS(resolve3(root, file))}?monaco-types&raw`)}), ${JSON.stringify(`node_modules/${name}/${file}`)})`)
9360
+ ...files.map((file) => `addFile(import(${JSON.stringify(`${toAtFS(resolve4(root, file))}?monaco-types&raw`)}), ${JSON.stringify(`node_modules/${name}/${file}`)})`)
9302
9361
  ].join("\n");
9303
9362
  }
9304
9363
  }
@@ -9344,7 +9403,7 @@ async function createVuePlugin(options, pluginOptions) {
9344
9403
  vuejsx: vuejsxOptions = {}
9345
9404
  } = pluginOptions;
9346
9405
  const VuePlugin = Vue({
9347
- include: [/\.vue$/, /\.md$/],
9406
+ include: [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/, /\.md$/, /\.md\?vue/],
9348
9407
  exclude: [],
9349
9408
  template: {
9350
9409
  compilerOptions: {
package/dist/cli.mjs CHANGED
@@ -6,8 +6,8 @@ import {
6
6
  resolveOptions,
7
7
  resolveTheme,
8
8
  version
9
- } from "./chunk-KUKH6IFA.mjs";
10
- import "./chunk-Y6VNORK4.mjs";
9
+ } from "./chunk-DRELQPK4.mjs";
10
+ import "./chunk-NZM6E5T7.mjs";
11
11
  import {
12
12
  loadSetups
13
13
  } from "./chunk-LOUKLO2C.mjs";
@@ -326,7 +326,7 @@ cli.command(
326
326
  }).strict().help(),
327
327
  async (args) => {
328
328
  const { entry, theme, watch, base, download, out, inspect } = args;
329
- const { build } = await import("./build-IFALC6GJ.mjs");
329
+ const { build } = await import("./build-ULWOL6YC.mjs");
330
330
  for (const entryFile of entry) {
331
331
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
332
332
  if (download && !options.data.config.download)
package/dist/index.mjs CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createServer,
3
3
  parser,
4
4
  resolveOptions
5
- } from "./chunk-KUKH6IFA.mjs";
5
+ } from "./chunk-DRELQPK4.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
- } from "./chunk-Y6VNORK4.mjs";
8
+ } from "./chunk-NZM6E5T7.mjs";
9
9
  import "./chunk-LOUKLO2C.mjs";
10
10
  import "./chunk-AQQIBD5X.mjs";
11
11
  import "./chunk-BXO7ZPPU.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.49.0-beta.3",
3
+ "version": "0.49.0-beta.4",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -51,8 +51,8 @@
51
51
  "@shikijs/markdown-it": "^1.3.0",
52
52
  "@shikijs/twoslash": "^1.3.0",
53
53
  "@shikijs/vitepress-twoslash": "^1.3.0",
54
- "@unocss/extractor-mdc": "^0.59.2",
55
- "@unocss/reset": "^0.59.2",
54
+ "@unocss/extractor-mdc": "^0.59.3",
55
+ "@unocss/reset": "^0.59.3",
56
56
  "@vitejs/plugin-vue": "^5.0.4",
57
57
  "@vitejs/plugin-vue-jsx": "^3.1.0",
58
58
  "chokidar": "^3.6.0",
@@ -73,6 +73,7 @@
73
73
  "local-pkg": "^0.5.0",
74
74
  "lz-string": "^1.5.0",
75
75
  "magic-string": "^0.30.9",
76
+ "magic-string-stack": "^0.1.0",
76
77
  "markdown-it": "^14.1.0",
77
78
  "markdown-it-footnote": "^4.0.0",
78
79
  "markdown-it-link-attributes": "^4.0.1",
@@ -90,27 +91,27 @@
90
91
  "resolve-global": "^2.0.0",
91
92
  "semver": "^7.6.0",
92
93
  "shiki": "^1.3.0",
93
- "shiki-magic-move": "^0.3.5",
94
+ "shiki-magic-move": "^0.3.6",
94
95
  "sirv": "^2.0.4",
95
96
  "source-map-js": "^1.2.0",
96
97
  "typescript": "^5.4.5",
97
- "unocss": "^0.59.2",
98
+ "unocss": "^0.59.3",
98
99
  "unplugin-icons": "^0.18.5",
99
100
  "unplugin-vue-components": "^0.26.0",
100
- "unplugin-vue-markdown": "^0.26.0",
101
+ "unplugin-vue-markdown": "^0.26.1",
101
102
  "untun": "^0.1.3",
102
103
  "uqr": "^0.1.2",
103
- "vite": "^5.2.8",
104
+ "vite": "^5.2.9",
104
105
  "vite-plugin-inspect": "^0.8.3",
105
106
  "vite-plugin-remote-assets": "^0.4.1",
106
107
  "vite-plugin-static-copy": "^1.0.2",
107
108
  "vite-plugin-vue-server-ref": "^0.4.2",
108
109
  "vitefu": "^0.2.5",
109
- "vue": "^3.4.21",
110
+ "vue": "^3.4.22",
110
111
  "yargs": "^17.7.2",
111
- "@slidev/client": "0.49.0-beta.3",
112
- "@slidev/types": "0.49.0-beta.3",
113
- "@slidev/parser": "0.49.0-beta.3"
112
+ "@slidev/client": "0.49.0-beta.4",
113
+ "@slidev/parser": "0.49.0-beta.4",
114
+ "@slidev/types": "0.49.0-beta.4"
114
115
  },
115
116
  "devDependencies": {
116
117
  "@hedgedoc/markdown-it-plugins": "^2.1.4",