@slidev/cli 0.27.16 → 0.28.0

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.
@@ -1,20 +1,23 @@
1
1
  import {
2
2
  __commonJS,
3
+ __filename,
3
4
  __require,
4
5
  __spreadProps,
5
6
  __spreadValues,
6
7
  __toModule,
7
8
  generateGoogleFontsUrl,
9
+ init_esm_shims,
8
10
  resolveGlobalImportPath,
9
11
  resolveImportPath,
10
12
  stringifyMarkdownTokens,
11
13
  toAtFS
12
- } from "./chunk-QQD2JVXL.mjs";
14
+ } from "./chunk-OXQUV4ZP.mjs";
13
15
 
14
16
  // ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
15
17
  var require_fast_deep_equal = __commonJS({
16
18
  "../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
17
19
  "use strict";
20
+ init_esm_shims();
18
21
  module.exports = function equal2(a, b) {
19
22
  if (a === b)
20
23
  return true;
@@ -57,7 +60,8 @@ var require_fast_deep_equal = __commonJS({
57
60
  });
58
61
 
59
62
  // node/common.ts
60
- import { promises as fs, existsSync } from "fs";
63
+ init_esm_shims();
64
+ import { existsSync, promises as fs } from "fs";
61
65
  import { join } from "path";
62
66
  import { uniq } from "@antfu/utils";
63
67
  async function getIndexHtml({ clientRoot, themeRoots, data, userRoot }) {
@@ -90,13 +94,15 @@ ${(((_b = index.match(/<body>([\s\S]*?)<\/body>/im)) == null ? void 0 : _b[1]) |
90
94
  }
91
95
 
92
96
  // node/plugins/windicss.ts
93
- import { resolve as resolve2, dirname } from "path";
97
+ init_esm_shims();
98
+ import { dirname, resolve as resolve2 } from "path";
94
99
  import { existsSync as existsSync3 } from "fs";
95
100
  import { slash, uniq as uniq2 } from "@antfu/utils";
96
101
  import WindiCSS, { defaultConfigureFiles } from "vite-plugin-windicss";
97
102
  import jiti2 from "jiti";
98
103
 
99
104
  // node/plugins/setupNode.ts
105
+ init_esm_shims();
100
106
  import { resolve } from "path";
101
107
  import { existsSync as existsSync2 } from "fs-extra";
102
108
  import { isObject } from "@antfu/utils";
@@ -170,6 +176,7 @@ async function createWindiCSSPlugin({ themeRoots, clientRoot, userRoot, roots, d
170
176
  }
171
177
 
172
178
  // node/plugins/preset.ts
179
+ init_esm_shims();
173
180
  import Vue from "@vitejs/plugin-vue";
174
181
  import Icons from "unplugin-icons/vite";
175
182
  import IconsResolver from "unplugin-icons/resolver";
@@ -179,7 +186,8 @@ import ServerRef from "vite-plugin-vue-server-ref";
179
186
  import { notNullish as notNullish2 } from "@antfu/utils";
180
187
 
181
188
  // node/drawings.ts
182
- import { dirname as dirname2, resolve as resolve3, join as join2, basename } from "path";
189
+ init_esm_shims();
190
+ import { basename, dirname as dirname2, join as join2, resolve as resolve3 } from "path";
183
191
  import fs2 from "fs-extra";
184
192
  import fg from "fast-glob";
185
193
  function resolveDrawingsDir(options) {
@@ -224,6 +232,7 @@ ${value}
224
232
  }
225
233
 
226
234
  // node/plugins/extendConfig.ts
235
+ init_esm_shims();
227
236
  import { dirname as dirname4, join as join4 } from "path";
228
237
  import { mergeConfig } from "vite";
229
238
  import isInstalledGlobally from "is-installed-globally";
@@ -231,31 +240,32 @@ import { uniq as uniq3 } from "@antfu/utils";
231
240
 
232
241
  // ../client/package.json
233
242
  var dependencies = {
234
- "@antfu/utils": "^0.3.0",
243
+ "@antfu/utils": "^0.4.0",
235
244
  "@slidev/parser": "workspace:*",
236
245
  "@slidev/types": "workspace:*",
237
- "@vueuse/core": "^6.6.2",
238
- "@vueuse/head": "^0.6.0",
239
- "@vueuse/motion": "^2.0.0-beta.4",
240
- codemirror: "^5.63.3",
246
+ "@vueuse/core": "^7.5.3",
247
+ "@vueuse/head": "^0.7.4",
248
+ "@vueuse/motion": "^2.0.0-beta.9",
249
+ codemirror: "^5.65.0",
241
250
  drauu: "^0.2.1",
242
251
  "file-saver": "^2.0.5",
243
252
  "js-base64": "^3.7.2",
244
253
  "js-yaml": "^4.1.0",
245
- katex: "^0.13.18",
254
+ katex: "^0.15.2",
246
255
  mermaid: "8.13.0",
247
- "monaco-editor": "^0.29.1",
248
- nanoid: "^3.1.30",
249
- prettier: "^2.4.1",
256
+ "monaco-editor": "^0.31.1",
257
+ nanoid: "^3.1.32",
258
+ prettier: "^2.5.1",
250
259
  recordrtc: "^5.6.2",
251
- resolve: "^1.20.0",
252
- "vite-plugin-windicss": "^1.4.12",
253
- vue: "^3.2.20",
260
+ resolve: "^1.21.0",
261
+ "vite-plugin-windicss": "^1.6.2",
262
+ vue: "^3.2.26",
254
263
  "vue-router": "^4.0.12",
255
- windicss: "^3.1.9"
264
+ windicss: "^3.4.2"
256
265
  };
257
266
 
258
267
  // node/vite/searchRoot.ts
268
+ init_esm_shims();
259
269
  import fs3 from "fs";
260
270
  import { dirname as dirname3, join as join3 } from "path";
261
271
  var ROOT_FILES = [
@@ -380,6 +390,7 @@ function getDefine(options) {
380
390
  }
381
391
 
382
392
  // node/plugins/loaders.ts
393
+ init_esm_shims();
383
394
  var import_fast_deep_equal = __toModule(require_fast_deep_equal());
384
395
  import { basename as basename2, join as join5 } from "path";
385
396
  import { isString, notNullish, objectMap, range, slash as slash2, uniq as uniq4 } from "@antfu/utils";
@@ -387,12 +398,7 @@ import fg2 from "fast-glob";
387
398
  import fs4, { existsSync as existsSync4 } from "fs-extra";
388
399
  import Markdown from "markdown-it";
389
400
  import mila from "markdown-it-link-attributes";
390
- import {
391
- load,
392
- save,
393
- saveExternalSlide,
394
- scanMonacoModules
395
- } from "@slidev/parser/fs";
401
+ import * as parser from "@slidev/parser/fs";
396
402
  var regexId = /^\/\@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
397
403
  var regexIdQuery = /(\d+?)\.(md|json)$/;
398
404
  function getBodyJson(req) {
@@ -423,7 +429,7 @@ function prepareSlideInfo(data) {
423
429
  }
424
430
  function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roots }, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin) {
425
431
  const slidePrefix = "/@slidev/slides/";
426
- const hmrPages = new Set();
432
+ const hmrPages = /* @__PURE__ */ new Set();
427
433
  let server;
428
434
  let _layouts_cache_time = 0;
429
435
  let _layouts_cache = {};
@@ -450,10 +456,10 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
450
456
  hmrPages.add(idx);
451
457
  if (slide.source) {
452
458
  Object.assign(slide.source, body);
453
- await saveExternalSlide(slide.source);
459
+ await parser.saveExternalSlide(slide.source);
454
460
  } else {
455
461
  Object.assign(slide, body);
456
- await save(data, entry);
462
+ await parser.save(data, entry);
457
463
  }
458
464
  res.statusCode = 200;
459
465
  res.write(JSON.stringify(prepareSlideInfo(slide)));
@@ -466,8 +472,8 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRoot, roo
466
472
  var _a;
467
473
  if (!data.entries.some((i) => slash2(i) === ctx.file))
468
474
  return;
469
- const newData = await load(entry, data.themeMeta);
470
- const moduleIds = new Set();
475
+ const newData = await parser.load(entry, data.themeMeta);
476
+ const moduleIds = /* @__PURE__ */ new Set();
471
477
  if (data.slides.length !== newData.slides.length) {
472
478
  moduleIds.add("/@slidev/routes");
473
479
  range(newData.slides.length).map((i) => hmrPages.add(i));
@@ -668,7 +674,7 @@ ${code.slice(injectB)}`;
668
674
  return imports.join("\n");
669
675
  }
670
676
  async function generateMonacoTypes() {
671
- return `void 0; ${scanMonacoModules(data.raw).map((i) => `import('/@slidev-monaco-types/${i}')`).join("\n")}`;
677
+ return `void 0; ${parser.scanMonacoModules(data.raw).map((i) => `import('/@slidev-monaco-types/${i}')`).join("\n")}`;
672
678
  }
673
679
  async function generateLayouts() {
674
680
  const imports = [];
@@ -701,7 +707,9 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
701
707
  note: i.note,
702
708
  filepath: ((_b = i.source) == null ? void 0 : _b.filepath) || entry,
703
709
  id: idx,
704
- no
710
+ no,
711
+ title: i.title,
712
+ level: i.level
705
713
  },
706
714
  __clicksElements: [],
707
715
  __preloaded: false
@@ -758,6 +766,7 @@ export default {
758
766
  }
759
767
 
760
768
  // node/plugins/monacoTransform.ts
769
+ init_esm_shims();
761
770
  import { join as join6 } from "path";
762
771
  import { slash as slash3 } from "@antfu/utils";
763
772
  import { resolvePackageData } from "vite";
@@ -791,6 +800,7 @@ function createMonacoTypesLoader() {
791
800
  }
792
801
 
793
802
  // node/plugins/setupClient.ts
803
+ init_esm_shims();
794
804
  import { existsSync as existsSync5 } from "fs";
795
805
  import { join as join7, resolve as resolve4 } from "path";
796
806
  import { slash as slash4, uniq as uniq5 } from "@antfu/utils";
@@ -840,15 +850,17 @@ function createClientSetupPlugin({ clientRoot, themeRoots, userRoot }) {
840
850
  }
841
851
 
842
852
  // node/plugins/markdown.ts
853
+ init_esm_shims();
843
854
  import Markdown2 from "vite-plugin-md";
844
- import base64 from "js-base64";
855
+ import * as base64 from "js-base64";
845
856
  import { slash as slash5 } from "@antfu/utils";
846
857
  import mila2 from "markdown-it-link-attributes";
847
858
  import mif from "markdown-it-footnote";
848
859
  import * as Shiki from "shiki";
849
- import { encode } from "plantuml-encoder";
860
+ import { encode as encode2 } from "plantuml-encoder";
850
861
 
851
862
  // node/plugins/markdown-it-katex.ts
863
+ init_esm_shims();
852
864
  import katex from "katex";
853
865
  function isValidDelim(state, pos) {
854
866
  const max = state.posMax;
@@ -995,6 +1007,7 @@ function math_plugin(md2, options) {
995
1007
  }
996
1008
 
997
1009
  // node/plugins/markdown-it-prism.ts
1010
+ init_esm_shims();
998
1011
  import Prism from "prismjs";
999
1012
  import loadLanguages from "prismjs/components/";
1000
1013
  var DEFAULTS = {
@@ -1057,6 +1070,7 @@ function markdownItPrism(markdownit, useroptions) {
1057
1070
  }
1058
1071
 
1059
1072
  // node/plugins/markdown-it-shiki.ts
1073
+ init_esm_shims();
1060
1074
  function getThemeName(theme) {
1061
1075
  if (typeof theme === "string")
1062
1076
  return theme;
@@ -1124,7 +1138,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
1124
1138
  } else {
1125
1139
  setups.push((md2) => md2.use(markdownItPrism));
1126
1140
  }
1127
- const KatexOptions2 = await loadSetups(roots, "katex.ts", {}, { strict: false }, false);
1141
+ const KatexOptions = await loadSetups(roots, "katex.ts", {}, { strict: false }, false);
1128
1142
  return Markdown2(__spreadProps(__spreadValues({
1129
1143
  wrapperClasses: "",
1130
1144
  headEnabled: false,
@@ -1145,7 +1159,7 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
1145
1159
  }
1146
1160
  });
1147
1161
  md2.use(mif);
1148
- md2.use(math_plugin, KatexOptions2);
1162
+ md2.use(math_plugin, KatexOptions);
1149
1163
  setups.forEach((i) => i(md2));
1150
1164
  (_a = mdOptions == null ? void 0 : mdOptions.markdownItSetup) == null ? void 0 : _a.call(mdOptions, md2);
1151
1165
  },
@@ -1184,7 +1198,7 @@ function transformSlotSugar(md2) {
1184
1198
  lines.forEach((line, idx) => {
1185
1199
  if (isLineInsideCodeblocks(idx))
1186
1200
  return;
1187
- const match = line.trimRight().match(/^::\s*(\w+)\s*::$/);
1201
+ const match = line.trimEnd().match(/^::\s*(\w+)\s*::$/);
1188
1202
  if (match) {
1189
1203
  lines[idx] = `${prevSlot ? "\n\n</template>\n" : "\n"}<template v-slot:${match[1]}="slotProps">
1190
1204
  `;
@@ -1256,7 +1270,7 @@ function transformMermaid(md2) {
1256
1270
  }
1257
1271
  function transformPlantUml(md2, server) {
1258
1272
  return md2.replace(/^```plantuml\s*?({.*?})?\n([\s\S]+?)\n```/mg, (full, options = "", content = "") => {
1259
- const code = encode(content.trim());
1273
+ const code = encode2(content.trim());
1260
1274
  options = options.trim() || "{}";
1261
1275
  return `<PlantUml :code="'${code}'" :server="'${server}'" v-bind="${options}" />`;
1262
1276
  });
@@ -1266,6 +1280,7 @@ function escapeVueInCode(md2) {
1266
1280
  }
1267
1281
 
1268
1282
  // node/plugins/patchTransform.ts
1283
+ init_esm_shims();
1269
1284
  import { objectEntries } from "@antfu/utils";
1270
1285
  function createFixPlugins(options) {
1271
1286
  const define = objectEntries(getDefine(options));
@@ -1286,7 +1301,7 @@ function createFixPlugins(options) {
1286
1301
  }
1287
1302
 
1288
1303
  // node/plugins/preset.ts
1289
- var customElements = new Set([
1304
+ var customElements = /* @__PURE__ */ new Set([
1290
1305
  "annotation",
1291
1306
  "math",
1292
1307
  "mrow",
@@ -35,6 +35,11 @@ var __esm = (fn, res) => function __init() {
35
35
  var __commonJS = (cb, mod) => function __require2() {
36
36
  return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
37
37
  };
38
+ var __export = (target, all) => {
39
+ __markAsModule(target);
40
+ for (var name in all)
41
+ __defProp(target, name, { get: all[name], enumerable: true });
42
+ };
38
43
  var __reExport = (target, module, desc) => {
39
44
  if (module && typeof module === "object" || typeof module === "function") {
40
45
  for (let key of __getOwnPropNames(module))
@@ -47,11 +52,9 @@ var __toModule = (module) => {
47
52
  return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
48
53
  };
49
54
 
50
- // ../../node_modules/.pnpm/tsup@5.4.2_typescript@4.4.4/node_modules/tsup/assets/cjs_shims.js
51
- var importMetaUrlShim;
55
+ // ../../node_modules/.pnpm/tsup@5.11.11_typescript@4.5.4/node_modules/tsup/assets/cjs_shims.js
52
56
  var init_cjs_shims = __esm({
53
- "../../node_modules/.pnpm/tsup@5.4.2_typescript@4.4.4/node_modules/tsup/assets/cjs_shims.js"() {
54
- importMetaUrlShim = typeof document === "undefined" ? new (__require("url")).URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
57
+ "../../node_modules/.pnpm/tsup@5.11.11_typescript@4.5.4/node_modules/tsup/assets/cjs_shims.js"() {
55
58
  }
56
59
  });
57
60
 
@@ -125,4 +128,5 @@ function generateGoogleFontsUrl(options) {
125
128
 
126
129
 
127
130
 
128
- exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__require = __require; exports.__commonJS = __commonJS; exports.__toModule = __toModule; exports.init_cjs_shims = init_cjs_shims; exports.toAtFS = toAtFS; exports.resolveImportPath = resolveImportPath; exports.resolveGlobalImportPath = resolveGlobalImportPath; exports.stringifyMarkdownTokens = stringifyMarkdownTokens; exports.generateGoogleFontsUrl = generateGoogleFontsUrl;
131
+
132
+ exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__require = __require; exports.__commonJS = __commonJS; exports.__export = __export; exports.__toModule = __toModule; exports.init_cjs_shims = init_cjs_shims; exports.toAtFS = toAtFS; exports.resolveImportPath = resolveImportPath; exports.resolveGlobalImportPath = resolveGlobalImportPath; exports.stringifyMarkdownTokens = stringifyMarkdownTokens; exports.generateGoogleFontsUrl = generateGoogleFontsUrl;