@slidev/cli 0.35.2 → 0.35.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.
@@ -25,7 +25,10 @@ var __copyProps = (to, from, except, desc) => {
25
25
  }
26
26
  return to;
27
27
  };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
29
32
  var __accessCheck = (obj, member, msg) => {
30
33
  if (!member.has(obj))
31
34
  throw TypeError("Cannot " + msg);
@@ -55,12 +58,12 @@ var __privateWrapper = (obj, member, setter, getter) => {
55
58
  };
56
59
  };
57
60
 
58
- // ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.7.4/node_modules/tsup/assets/esm_shims.js
61
+ // ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.2/node_modules/tsup/assets/esm_shims.js
59
62
  import { fileURLToPath } from "url";
60
63
  import path from "path";
61
64
  var getFilename, getDirname, __dirname, __filename;
62
65
  var init_esm_shims = __esm({
63
- "../../node_modules/.pnpm/tsup@5.12.9_typescript@4.7.4/node_modules/tsup/assets/esm_shims.js"() {
66
+ "../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.2/node_modules/tsup/assets/esm_shims.js"() {
64
67
  getFilename = () => fileURLToPath(import.meta.url);
65
68
  getDirname = () => path.dirname(getFilename());
66
69
  __dirname = /* @__PURE__ */ getDirname();
@@ -115,10 +118,12 @@ function resolveGlobalImportPath(importName) {
115
118
  throw new Error(`Failed to resolve global package "${importName}"`);
116
119
  }
117
120
  function stringifyMarkdownTokens(tokens) {
118
- return tokens.map((token) => {
119
- var _a;
120
- return (_a = token.children) == null ? void 0 : _a.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ");
121
- }).filter(Boolean).join(" ");
121
+ return tokens.map(
122
+ (token) => {
123
+ var _a;
124
+ return (_a = token.children) == null ? void 0 : _a.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ");
125
+ }
126
+ ).filter(Boolean).join(" ");
122
127
  }
123
128
  function generateGoogleFontsUrl(options) {
124
129
  const weights = options.weights.flatMap((i) => options.italic ? [`0,${i}`, `1,${i}`] : [`${i}`]).sort().join(";");
@@ -25,7 +25,10 @@ var __copyProps = (to, from, except, desc) => {
25
25
  }
26
26
  return to;
27
27
  };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
29
32
  var __accessCheck = (obj, member, msg) => {
30
33
  if (!member.has(obj))
31
34
  throw TypeError("Cannot " + msg);
@@ -55,9 +58,9 @@ var __privateWrapper = (obj, member, setter, getter) => {
55
58
  };
56
59
  };
57
60
 
58
- // ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.7.4/node_modules/tsup/assets/cjs_shims.js
61
+ // ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.2/node_modules/tsup/assets/cjs_shims.js
59
62
  var init_cjs_shims = __esm({
60
- "../../node_modules/.pnpm/tsup@5.12.9_typescript@4.7.4/node_modules/tsup/assets/cjs_shims.js"() {
63
+ "../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.2/node_modules/tsup/assets/cjs_shims.js"() {
61
64
  }
62
65
  });
63
66
 
@@ -108,10 +111,12 @@ function resolveGlobalImportPath(importName) {
108
111
  throw new Error(`Failed to resolve global package "${importName}"`);
109
112
  }
110
113
  function stringifyMarkdownTokens(tokens) {
111
- return tokens.map((token) => {
112
- var _a;
113
- return (_a = token.children) == null ? void 0 : _a.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ");
114
- }).filter(Boolean).join(" ");
114
+ return tokens.map(
115
+ (token) => {
116
+ var _a;
117
+ return (_a = token.children) == null ? void 0 : _a.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ");
118
+ }
119
+ ).filter(Boolean).join(" ");
115
120
  }
116
121
  function generateGoogleFontsUrl(options) {
117
122
  const weights = options.weights.flatMap((i) => options.italic ? [`0,${i}`, `1,${i}`] : [`${i}`]).sort().join(";");
@@ -9,7 +9,7 @@ import {
9
9
  resolveImportPath,
10
10
  stringifyMarkdownTokens,
11
11
  toAtFS
12
- } from "./chunk-GVA336JI.mjs";
12
+ } from "./chunk-57E5R3IA.mjs";
13
13
 
14
14
  // ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
15
15
  var require_fast_deep_equal = __commonJS({
@@ -165,38 +165,40 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
165
165
  if (config.default)
166
166
  config = config.default;
167
167
  config = await loadSetups(roots, "windicss.ts", {}, config, true);
168
- return WindiCSS({
169
- configFiles: [configFile],
170
- config,
171
- onConfigResolved(config2) {
172
- if (!config2.theme)
173
- config2.theme = {};
174
- if (!config2.theme.extend)
175
- config2.theme.extend = {};
176
- if (!config2.theme.extend.fontFamily)
177
- config2.theme.extend.fontFamily = {};
178
- const fontFamily = config2.theme.extend.fontFamily;
179
- fontFamily.sans || (fontFamily.sans = data.config.fonts.sans.join(","));
180
- fontFamily.mono || (fontFamily.mono = data.config.fonts.mono.join(","));
181
- fontFamily.serif || (fontFamily.serif = data.config.fonts.serif.join(","));
182
- return config2;
183
- },
184
- onOptionsResolved(config2) {
185
- themeRoots.forEach((i) => {
186
- config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
187
- config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
188
- });
189
- addonRoots.forEach((i) => {
190
- config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
191
- config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
192
- });
193
- config2.scanOptions.include.push(`!${slash(resolve2(userRoot, "node_modules"))}`);
194
- config2.scanOptions.exclude.push(dirname(resolveImportPath("monaco-editor/package.json", true)));
195
- config2.scanOptions.exclude.push(dirname(resolveImportPath("katex/package.json", true)));
196
- config2.scanOptions.exclude.push(dirname(resolveImportPath("prettier/package.json", true)));
197
- },
198
- ...windiOptions
199
- });
168
+ return WindiCSS(
169
+ {
170
+ configFiles: [configFile],
171
+ config,
172
+ onConfigResolved(config2) {
173
+ if (!config2.theme)
174
+ config2.theme = {};
175
+ if (!config2.theme.extend)
176
+ config2.theme.extend = {};
177
+ if (!config2.theme.extend.fontFamily)
178
+ config2.theme.extend.fontFamily = {};
179
+ const fontFamily = config2.theme.extend.fontFamily;
180
+ fontFamily.sans || (fontFamily.sans = data.config.fonts.sans.join(","));
181
+ fontFamily.mono || (fontFamily.mono = data.config.fonts.mono.join(","));
182
+ fontFamily.serif || (fontFamily.serif = data.config.fonts.serif.join(","));
183
+ return config2;
184
+ },
185
+ onOptionsResolved(config2) {
186
+ themeRoots.forEach((i) => {
187
+ config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
188
+ config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
189
+ });
190
+ addonRoots.forEach((i) => {
191
+ config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
192
+ config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
193
+ });
194
+ config2.scanOptions.include.push(`!${slash(resolve2(userRoot, "node_modules"))}`);
195
+ config2.scanOptions.exclude.push(dirname(resolveImportPath("monaco-editor/package.json", true)));
196
+ config2.scanOptions.exclude.push(dirname(resolveImportPath("katex/package.json", true)));
197
+ config2.scanOptions.exclude.push(dirname(resolveImportPath("prettier/package.json", true)));
198
+ },
199
+ ...windiOptions
200
+ }
201
+ );
200
202
  }
201
203
 
202
204
  // node/plugins/preset.ts
@@ -239,7 +241,7 @@ async function loadDrawings(options) {
239
241
  }));
240
242
  return obj;
241
243
  }
242
- async function writeDarwings(options, drawing) {
244
+ async function writeDrawings(options, drawing) {
243
245
  const dir = resolveDrawingsDir(options);
244
246
  if (!dir)
245
247
  return;
@@ -247,14 +249,16 @@ async function writeDarwings(options, drawing) {
247
249
  const height = Math.round(width / options.data.config.aspectRatio);
248
250
  const SVG_HEAD = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`;
249
251
  await fs2.ensureDir(dir);
250
- return Promise.all(Object.entries(drawing).map(async ([key, value]) => {
251
- if (!value)
252
- return;
253
- const svg = `${SVG_HEAD}
252
+ return Promise.all(
253
+ Object.entries(drawing).map(async ([key, value]) => {
254
+ if (!value)
255
+ return;
256
+ const svg = `${SVG_HEAD}
254
257
  ${value}
255
258
  </svg>`;
256
- await fs2.writeFile(join2(dir, `${key}.svg`), svg, "utf-8");
257
- }));
259
+ await fs2.writeFile(join2(dir, `${key}.svg`), svg, "utf-8");
260
+ })
261
+ );
258
262
  }
259
263
 
260
264
  // node/plugins/extendConfig.ts
@@ -269,28 +273,28 @@ var dependencies = {
269
273
  "@antfu/utils": "^0.5.2",
270
274
  "@slidev/parser": "workspace:*",
271
275
  "@slidev/types": "workspace:*",
272
- "@unocss/reset": "^0.45.1",
273
- "@vueuse/core": "^9.0.1",
274
- "@vueuse/head": "^0.7.8",
275
- "@vueuse/math": "^9.0.1",
276
+ "@unocss/reset": "^0.45.14",
277
+ "@vueuse/core": "^9.1.1",
278
+ "@vueuse/head": "^0.7.9",
279
+ "@vueuse/math": "^9.1.1",
276
280
  "@vueuse/motion": "^2.0.0-beta.18",
277
281
  codemirror: "^5.65.5",
278
- defu: "^6.0.0",
279
- drauu: "^0.3.0",
282
+ defu: "^6.1.0",
283
+ drauu: "^0.3.1",
280
284
  "file-saver": "^2.0.5",
281
285
  "js-base64": "^3.7.2",
282
286
  "js-yaml": "^4.1.0",
283
- katex: "^0.16.0",
284
- mermaid: "^9.1.3",
287
+ katex: "^0.16.2",
288
+ mermaid: "^9.1.6",
285
289
  "monaco-editor": "^0.33.0",
286
290
  nanoid: "^4.0.0",
287
291
  prettier: "^2.7.1",
288
292
  recordrtc: "^5.6.2",
289
293
  resolve: "^1.22.1",
290
- unocss: "^0.45.1",
294
+ unocss: "^0.45.14",
291
295
  "vite-plugin-windicss": "^1.8.7",
292
- vue: "^3.2.37",
293
- "vue-router": "^4.1.3",
296
+ vue: "^3.2.38",
297
+ "vue-router": "^4.1.5",
294
298
  "vue-starport": "^0.3.0",
295
299
  windicss: "^3.5.6"
296
300
  };
@@ -342,6 +346,9 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
342
346
  var EXCLUDE = [
343
347
  "@slidev/shared",
344
348
  "@slidev/types",
349
+ "@slidev/client",
350
+ "@slidev/client/constants",
351
+ "@slidev/client/logic/dark",
345
352
  "@vueuse/core",
346
353
  "@vueuse/shared",
347
354
  "@unocss/reset",
@@ -552,22 +559,24 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
552
559
  Object.assign(data, newData);
553
560
  if (hmrPages.size > 0)
554
561
  moduleIds.add("/@slidev/titles.md");
555
- const vueModules = (await Promise.all(Array.from(hmrPages).map(async (i) => {
556
- var _a2;
557
- const file = `${slidePrefix}${i + 1}.md`;
558
- try {
559
- const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
560
- return await VuePlugin.handleHotUpdate({
561
- ...ctx,
562
- modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
563
- file,
564
- read() {
565
- return md2;
566
- }
567
- });
568
- } catch {
569
- }
570
- }))).flatMap((i) => i || []);
562
+ const vueModules = (await Promise.all(
563
+ Array.from(hmrPages).map(async (i) => {
564
+ var _a2;
565
+ const file = `${slidePrefix}${i + 1}.md`;
566
+ try {
567
+ const md2 = await transformMarkdown(await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file), i, newData);
568
+ return await VuePlugin.handleHotUpdate({
569
+ ...ctx,
570
+ modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
571
+ file,
572
+ read() {
573
+ return md2;
574
+ }
575
+ });
576
+ } catch {
577
+ }
578
+ })
579
+ )).flatMap((i) => i || []);
571
580
  hmrPages.clear();
572
581
  const moduleEntries = [
573
582
  ...vueModules,
@@ -817,11 +826,22 @@ defineProps<{ no: number | string }>()`);
817
826
  if (data.features.katex)
818
827
  imports.push(`import "${toAtFS(resolveImportPath("katex/dist/katex.min.css", true))}"`);
819
828
  if (data.config.css === "unocss") {
820
- imports.unshift('import "@unocss/reset/tailwind.css"', 'import "uno:preflights.css"', 'import "uno:typography.css"', 'import "uno:shortcuts.css"');
829
+ imports.unshift(
830
+ 'import "@unocss/reset/tailwind.css"',
831
+ 'import "uno:preflights.css"',
832
+ 'import "uno:typography.css"',
833
+ 'import "uno:shortcuts.css"'
834
+ );
821
835
  imports.push('import "uno.css"');
822
836
  } else {
823
- imports.unshift('import "virtual:windi-components.css"', 'import "virtual:windi-base.css"');
824
- imports.push('import "virtual:windi-utilities.css"', 'import "virtual:windi-devtools"');
837
+ imports.unshift(
838
+ 'import "virtual:windi-components.css"',
839
+ 'import "virtual:windi-base.css"'
840
+ );
841
+ imports.push(
842
+ 'import "virtual:windi-utilities.css"',
843
+ 'import "virtual:windi-devtools"'
844
+ );
825
845
  }
826
846
  return imports.join("\n");
827
847
  }
@@ -830,10 +850,13 @@ defineProps<{ no: number | string }>()`);
830
850
  }
831
851
  async function generateLayouts() {
832
852
  const imports = [];
833
- const layouts = objectMap(await getLayouts(), (k, v) => {
834
- imports.push(`import __layout_${k} from "${toAtFS(v)}"`);
835
- return [k, `__layout_${k}`];
836
- });
853
+ const layouts = objectMap(
854
+ await getLayouts(),
855
+ (k, v) => {
856
+ imports.push(`import __layout_${k} from "${toAtFS(v)}"`);
857
+ return [k, `__layout_${k}`];
858
+ }
859
+ );
837
860
  return [
838
861
  imports.join("\n"),
839
862
  `export default {
@@ -1015,8 +1038,14 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
1015
1038
  fn += "()";
1016
1039
  awaitFn += "()";
1017
1040
  }
1018
- injections.push(`// ${path}`, fn);
1019
- asyncInjections.push(`// ${path}`, awaitFn);
1041
+ injections.push(
1042
+ `// ${path}`,
1043
+ fn
1044
+ );
1045
+ asyncInjections.push(
1046
+ `// ${path}`,
1047
+ awaitFn
1048
+ );
1020
1049
  });
1021
1050
  code = code.replace("/* __imports__ */", imports.join("\n"));
1022
1051
  code = code.replace("/* __injections__ */", injections.join("\n"));
@@ -1294,7 +1323,9 @@ var MarkdownItShiki = (markdownit, options = {}) => {
1294
1323
  const light = _highlighter.codeToHtml(trimmed, { lang: lang || "text", theme: darkModeThemes.light }).replace('<pre class="shiki"', '<pre class="slidev-code shiki shiki-light"');
1295
1324
  return escapeVueInCode(`<pre class="shiki-container">${dark}${light}</pre>`);
1296
1325
  } else {
1297
- return escapeVueInCode(_highlighter.codeToHtml(code, { lang: lang || "text" }).replace('<pre class="shiki"', '<pre class="slidev-code shiki"'));
1326
+ return escapeVueInCode(
1327
+ _highlighter.codeToHtml(code, { lang: lang || "text" }).replace('<pre class="shiki"', '<pre class="slidev-code shiki"')
1328
+ );
1298
1329
  }
1299
1330
  };
1300
1331
  };
@@ -1432,14 +1463,17 @@ function transformPageCSS(md2, id) {
1432
1463
  if (!page)
1433
1464
  return md2;
1434
1465
  const { isInsideCodeblocks } = getCodeBlocks(md2);
1435
- const result = md2.replace(/(\n<style[^>]*?>)([\s\S]+?)(<\/style>)/g, (full, start, css, end, index) => {
1436
- if (index < 0 || isInsideCodeblocks(index))
1437
- return full;
1438
- if (!start.includes("scoped"))
1439
- start = start.replace("<style", "<style scoped");
1440
- return `${start}
1466
+ const result = md2.replace(
1467
+ /(\n<style[^>]*?>)([\s\S]+?)(<\/style>)/g,
1468
+ (full, start, css, end, index) => {
1469
+ if (index < 0 || isInsideCodeblocks(index))
1470
+ return full;
1471
+ if (!start.includes("scoped"))
1472
+ start = start.replace("<style", "<style scoped");
1473
+ return `${start}
1441
1474
  ${css}${end}`;
1442
- });
1475
+ }
1476
+ );
1443
1477
  return result;
1444
1478
  }
1445
1479
  function transformMermaid(md2) {
@@ -1630,7 +1664,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1630
1664
  if (!options.data.config.drawings.persist)
1631
1665
  return;
1632
1666
  if (key === "drawings")
1633
- writeDarwings(options, patch != null ? patch : data);
1667
+ writeDrawings(options, patch != null ? patch : data);
1634
1668
  }
1635
1669
  }),
1636
1670
  createConfigPlugin(options),