@slidev/cli 0.48.0-beta.21 → 0.48.0-beta.22

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-NSAYO3FG.mjs";
5
+ } from "./chunk-ADTW2LD4.mjs";
6
6
  import "./chunk-O6TYYGU6.mjs";
7
7
  import "./chunk-CV7OWJOF.mjs";
8
8
 
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-CV7OWJOF.mjs";
8
8
 
9
9
  // package.json
10
- var version = "0.48.0-beta.21";
10
+ var version = "0.48.0-beta.22";
11
11
 
12
12
  // node/common.ts
13
13
  import { existsSync, promises as fs } from "node:fs";
@@ -146,7 +146,7 @@ import { uniq } from "@antfu/utils";
146
146
  // ../client/package.json
147
147
  var dependencies = {
148
148
  "@antfu/utils": "^0.7.7",
149
- "@iconify-json/carbon": "^1.1.30",
149
+ "@iconify-json/carbon": "^1.1.31",
150
150
  "@iconify-json/ph": "^1.1.11",
151
151
  "@iconify-json/svg-spinners": "^1.1.2",
152
152
  "@shikijs/monaco": "^1.1.7",
@@ -155,7 +155,7 @@ var dependencies = {
155
155
  "@slidev/rough-notation": "^0.1.0",
156
156
  "@slidev/types": "workspace:*",
157
157
  "@typescript/ata": "^0.9.4",
158
- "@unhead/vue": "^1.8.10",
158
+ "@unhead/vue": "^1.8.11",
159
159
  "@unocss/reset": "^0.58.5",
160
160
  "@vueuse/core": "^10.9.0",
161
161
  "@vueuse/math": "^10.9.0",
@@ -173,7 +173,7 @@ var dependencies = {
173
173
  prettier: "^3.2.5",
174
174
  recordrtc: "^5.6.2",
175
175
  shiki: "^1.1.7",
176
- "shiki-magic-move": "^0.1.0",
176
+ "shiki-magic-move": "^0.3.0",
177
177
  typescript: "^5.3.3",
178
178
  unocss: "^0.58.5",
179
179
  vue: "^3.4.21",
@@ -183,12 +183,19 @@ var dependencies = {
183
183
  // node/plugins/extendConfig.ts
184
184
  var INCLUDE = [
185
185
  ...Object.keys(dependencies),
186
+ // CodeMirror
186
187
  "codemirror/mode/javascript/javascript",
187
188
  "codemirror/mode/css/css",
188
189
  "codemirror/mode/markdown/markdown",
189
190
  "codemirror/mode/xml/xml",
190
191
  "codemirror/mode/htmlmixed/htmlmixed",
191
- "codemirror/addon/display/placeholder"
192
+ "codemirror/addon/display/placeholder",
193
+ // Monaco
194
+ "monaco-editor/esm/vs/editor/standalone/browser/standaloneServices",
195
+ "monaco-editor/esm/vs/platform/contextview/browser/contextViewService",
196
+ "monaco-editor/esm/vs/platform/instantiation/common/descriptors",
197
+ // Others
198
+ "shiki-magic-move/vue"
192
199
  ];
193
200
  var EXCLUDE = [
194
201
  "@slidev/shared",
@@ -458,7 +465,7 @@ function startsWithTodoMarkdown(token) {
458
465
  // node/plugins/markdown.ts
459
466
  import { encode as encodePlantUml } from "plantuml-encoder";
460
467
  import Mdc from "markdown-it-mdc";
461
- import { codeToKeyedTokens, createMagicMoveMachine } from "shiki-magic-move/core";
468
+ import { codeToKeyedTokens } from "shiki-magic-move/core";
462
469
  import mila from "markdown-it-link-attributes";
463
470
  import mif from "markdown-it-footnote";
464
471
  import lz from "lz-string";
@@ -979,30 +986,26 @@ function transformSlotSugar(md2) {
979
986
  lines[lines.length - 1] += "\n\n</template>";
980
987
  return lines.join("\n");
981
988
  }
982
- var reMagicMoveBlock = /^````(?:md|markdown) magic-move(?:[ ]*?({.*?})?([^\n]*?))?\n([\s\S]+?)^````$/mg;
989
+ var reMagicMoveBlock = /^````(?:md|markdown) magic-move(?:[ ]*(\{.*?\})?([^\n]*?))?\n([\s\S]+?)^````$/mg;
983
990
  var reCodeBlock = /^```(\w+?)(?:\s*{([\d\w*,\|-]+)}\s*?({.*?})?(.*?))?\n([\s\S]+?)^```$/mg;
984
991
  function transformMagicMove(md2, shiki2, shikiOptions2) {
985
992
  return md2.replace(
986
993
  reMagicMoveBlock,
987
- (full, _options = "", _attrs = "", body) => {
994
+ (full, options = "{}", _attrs = "", body) => {
988
995
  if (!shiki2 || !shikiOptions2)
989
996
  throw new Error("Shiki is required for Magic Move. You may need to set `highlighter: shiki` in your Slidev config.");
990
997
  const matches = Array.from(body.matchAll(reCodeBlock));
991
998
  if (!matches.length)
992
999
  throw new Error("Magic Move block must contain at least one code block");
993
- const langs = new Set(matches.map((i) => i[1]));
994
- if (langs.size > 1)
995
- throw new Error(`Magic Move block must contain code blocks with the same language, got ${Array.from(langs).join(", ")}`);
996
- const lang = Array.from(langs)[0];
997
- const magicMove = createMagicMoveMachine(
998
- (code) => codeToKeyedTokens(shiki2, code, {
1000
+ const ranges = matches.map((i) => normalizeRangeStr(i[2]));
1001
+ const steps = matches.map(
1002
+ (i) => codeToKeyedTokens(shiki2, i[5].trimEnd(), {
999
1003
  ...shikiOptions2,
1000
- lang
1004
+ lang: i[1]
1001
1005
  })
1002
1006
  );
1003
- const steps = matches.map((i) => magicMove.commit((i[5] || "").trimEnd()));
1004
1007
  const compressed = lz.compressToBase64(JSON.stringify(steps));
1005
- return `<ShikiMagicMove steps-lz="${compressed}" />`;
1008
+ return `<ShikiMagicMove v-bind="${options}" steps-lz="${compressed}" :step-ranges='${JSON.stringify(ranges)}' />`;
1006
1009
  }
1007
1010
  );
1008
1011
  }
@@ -1010,7 +1013,7 @@ function transformHighlighter(md2) {
1010
1013
  return md2.replace(
1011
1014
  reCodeBlock,
1012
1015
  (full, lang = "", rangeStr = "", options = "", attrs = "", code) => {
1013
- const ranges = !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
1016
+ const ranges = normalizeRangeStr(rangeStr);
1014
1017
  code = code.trimEnd();
1015
1018
  options = options.trim() || "{}";
1016
1019
  return `
@@ -1024,6 +1027,9 @@ ${code}
1024
1027
  }
1025
1028
  );
1026
1029
  }
1030
+ function normalizeRangeStr(rangeStr = "") {
1031
+ return !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
1032
+ }
1027
1033
  function getCodeBlocks(md2) {
1028
1034
  const codeblocks = Array.from(md2.matchAll(/^```[\s\S]*?^```/mg)).map((m) => {
1029
1035
  const start = m.index;
@@ -1174,7 +1180,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode, userRoot },
1174
1180
  if (!match)
1175
1181
  return next();
1176
1182
  const [, no, type] = match;
1177
- const idx = Number.parseInt(no);
1183
+ const idx = Number.parseInt(no) - 1;
1178
1184
  if (type === "json" && req.method === "GET") {
1179
1185
  res.write(JSON.stringify(withRenderedNote(data.slides[idx])));
1180
1186
  return res.end();
@@ -1697,16 +1703,11 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
1697
1703
  `const data = [
1698
1704
  ${slides.join(",\n")}
1699
1705
  ]`,
1700
- `export const slides = shallowRef([...data])`,
1701
- `let oldRef = slides`,
1702
- `export function update(old) {`,
1703
- ` oldRef = old`,
1704
- ` old.value = data`,
1705
- `}`,
1706
+ `import.meta.hot.data.slides ??= shallowRef()`,
1707
+ `import.meta.hot.data.slides.value = data`,
1708
+ `export const slides = import.meta.hot.data.slides`,
1706
1709
  `if (import.meta.hot) {`,
1707
- ` import.meta.hot.accept(({ update }) => {`,
1708
- ` update(oldRef)`,
1709
- ` })`,
1710
+ ` import.meta.hot.accept()`,
1710
1711
  `}`
1711
1712
  ].join("\n");
1712
1713
  }
@@ -3,7 +3,7 @@ import {
3
3
  checkEngine,
4
4
  mergeViteConfigs,
5
5
  version
6
- } from "./chunk-NSAYO3FG.mjs";
6
+ } from "./chunk-ADTW2LD4.mjs";
7
7
  import {
8
8
  createResolver,
9
9
  getRoots,
package/dist/cli.mjs CHANGED
@@ -5,10 +5,10 @@ import {
5
5
  resolveAddons,
6
6
  resolveOptions,
7
7
  resolveTheme
8
- } from "./chunk-AUSTPPCJ.mjs";
8
+ } from "./chunk-BUGWF6XJ.mjs";
9
9
  import {
10
10
  version
11
- } from "./chunk-NSAYO3FG.mjs";
11
+ } from "./chunk-ADTW2LD4.mjs";
12
12
  import {
13
13
  loadSetups
14
14
  } from "./chunk-O6TYYGU6.mjs";
@@ -276,7 +276,7 @@ cli.command(
276
276
  }).strict().help(),
277
277
  async (args) => {
278
278
  const { entry, theme, watch, base, download, out, inspect } = args;
279
- const { build } = await import("./build-LAWVABFK.mjs");
279
+ const { build } = await import("./build-LKM3MI3R.mjs");
280
280
  for (const entryFile of entry) {
281
281
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
282
282
  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-AUSTPPCJ.mjs";
5
+ } from "./chunk-BUGWF6XJ.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
- } from "./chunk-NSAYO3FG.mjs";
8
+ } from "./chunk-ADTW2LD4.mjs";
9
9
  import "./chunk-O6TYYGU6.mjs";
10
10
  import "./chunk-CV7OWJOF.mjs";
11
11
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.48.0-beta.21",
3
+ "version": "0.48.0-beta.22",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@antfu/ni": "^0.21.12",
46
46
  "@antfu/utils": "^0.7.7",
47
- "@iconify-json/carbon": "^1.1.30",
47
+ "@iconify-json/carbon": "^1.1.31",
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",
@@ -88,7 +88,7 @@
88
88
  "resolve-global": "^2.0.0",
89
89
  "semver": "^7.6.0",
90
90
  "shiki": "^1.1.7",
91
- "shiki-magic-move": "^0.1.0",
91
+ "shiki-magic-move": "^0.3.0",
92
92
  "sirv": "^2.0.4",
93
93
  "typescript": "^5.3.3",
94
94
  "unocss": "^0.58.5",
@@ -105,9 +105,9 @@
105
105
  "vitefu": "^0.2.5",
106
106
  "vue": "^3.4.21",
107
107
  "yargs": "^17.7.2",
108
- "@slidev/parser": "0.48.0-beta.21",
109
- "@slidev/client": "0.48.0-beta.21",
110
- "@slidev/types": "0.48.0-beta.21"
108
+ "@slidev/types": "0.48.0-beta.22",
109
+ "@slidev/parser": "0.48.0-beta.22",
110
+ "@slidev/client": "0.48.0-beta.22"
111
111
  },
112
112
  "devDependencies": {
113
113
  "@hedgedoc/markdown-it-plugins": "^2.1.4",