@slidev/cli 0.40.2 → 0.40.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.
@@ -23,6 +23,10 @@ var __copyProps = (to, from, except, desc) => {
23
23
  return to;
24
24
  };
25
25
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
30
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
31
  mod
28
32
  ));
@@ -7,10 +7,10 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkUJ5GHVIIjs = require('./chunk-UJ5GHVII.js');
10
+ var _chunkGE7W2DBEjs = require('./chunk-GE7W2DBE.js');
11
11
 
12
12
  // ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
13
- var require_fast_deep_equal = _chunkUJ5GHVIIjs.__commonJS.call(void 0, {
13
+ var require_fast_deep_equal = _chunkGE7W2DBEjs.__commonJS.call(void 0, {
14
14
  "../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
15
15
  "use strict";
16
16
  module.exports = function equal2(a, b) {
@@ -81,11 +81,11 @@ ${(((_a = index.match(/<head>([\s\S]*?)<\/head>/im)) == null ? void 0 : _a[1]) |
81
81
  ${(((_b = index.match(/<body>([\s\S]*?)<\/body>/im)) == null ? void 0 : _b[1]) || "").trim()}`;
82
82
  }
83
83
  if (data.features.tweet)
84
- body += '\n<script async src="https://platform.twitter.com/widgets.js"><\/script>';
84
+ body += '\n<script async src="https://platform.twitter.com/widgets.js"></script>';
85
85
  if (data.config.fonts.webfonts.length && data.config.fonts.provider !== "none")
86
86
  head += `
87
- <link rel="stylesheet" href="${_chunkUJ5GHVIIjs.generateGoogleFontsUrl.call(void 0, data.config.fonts)}" type="text/css">`;
88
- main = main.replace("__ENTRY__", _chunkUJ5GHVIIjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
87
+ <link rel="stylesheet" href="${_chunkGE7W2DBEjs.generateGoogleFontsUrl.call(void 0, data.config.fonts)}" type="text/css">`;
88
+ main = main.replace("__ENTRY__", _chunkGE7W2DBEjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
89
89
  return main;
90
90
  }
91
91
  async function mergeViteConfigs({ addonRoots, themeRoots }, viteConfig, config, command) {
@@ -186,9 +186,9 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
186
186
  config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
187
187
  });
188
188
  config2.scanOptions.include.push(`!${_utils.slash.call(void 0, _path.resolve.call(void 0, userRoot, "node_modules"))}`);
189
- config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkUJ5GHVIIjs.resolveImportPath.call(void 0, "monaco-editor/package.json", true)));
190
- config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkUJ5GHVIIjs.resolveImportPath.call(void 0, "katex/package.json", true)));
191
- config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkUJ5GHVIIjs.resolveImportPath.call(void 0, "prettier/package.json", true)));
189
+ config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkGE7W2DBEjs.resolveImportPath.call(void 0, "monaco-editor/package.json", true)));
190
+ config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkGE7W2DBEjs.resolveImportPath.call(void 0, "katex/package.json", true)));
191
+ config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkGE7W2DBEjs.resolveImportPath.call(void 0, "prettier/package.json", true)));
192
192
  },
193
193
  ...windiOptions
194
194
  }
@@ -269,25 +269,25 @@ var dependencies = {
269
269
  "@antfu/utils": "^0.7.2",
270
270
  "@slidev/parser": "workspace:*",
271
271
  "@slidev/types": "workspace:*",
272
- "@unocss/reset": "^0.49.4",
273
- "@vueuse/core": "^9.12.0",
274
- "@vueuse/head": "^1.0.24",
275
- "@vueuse/math": "^9.12.0",
272
+ "@unocss/reset": "^0.50.6",
273
+ "@vueuse/core": "^9.13.0",
274
+ "@vueuse/head": "^1.1.23",
275
+ "@vueuse/math": "^9.13.0",
276
276
  "@vueuse/motion": "^2.0.0-beta.27",
277
277
  codemirror: "^5.65.5",
278
278
  defu: "^6.1.2",
279
279
  drauu: "^0.3.2",
280
280
  "file-saver": "^2.0.5",
281
- "js-base64": "^3.7.4",
281
+ "js-base64": "^3.7.5",
282
282
  "js-yaml": "^4.1.0",
283
283
  katex: "^0.16.4",
284
- mermaid: "^9.3.0",
284
+ mermaid: "^9.4.3",
285
285
  "monaco-editor": "^0.33.0",
286
- nanoid: "^4.0.0",
287
- prettier: "^2.8.3",
286
+ nanoid: "^4.0.1",
287
+ prettier: "^2.8.6",
288
288
  recordrtc: "^5.6.2",
289
289
  resolve: "^1.22.1",
290
- unocss: "^0.49.4",
290
+ unocss: "^0.50.6",
291
291
  "vite-plugin-windicss": "^1.8.10",
292
292
  vue: "^3.2.47",
293
293
  "vue-router": "^4.1.6",
@@ -299,7 +299,14 @@ var dependencies = {
299
299
 
300
300
 
301
301
  var ROOT_FILES = [
302
+ // '.git',
303
+ // https://pnpm.js.org/workspaces/
302
304
  "pnpm-workspace.yaml"
305
+ // https://rushjs.io/pages/advanced/config_files/
306
+ // 'rush.json',
307
+ // https://nx.dev/latest/react/getting-started/nx-setup
308
+ // 'workspace.json',
309
+ // 'nx.json'
303
310
  ];
304
311
  function hasWorkspacePackageJSON(root) {
305
312
  const path = _path.join.call(void 0, root, "package.json");
@@ -361,7 +368,7 @@ function createConfigPlugin(options) {
361
368
  define: getDefine(options),
362
369
  resolve: {
363
370
  alias: {
364
- "@slidev/client/": `${_chunkUJ5GHVIIjs.toAtFS.call(void 0, options.clientRoot)}/`
371
+ "@slidev/client/": `${_chunkGE7W2DBEjs.toAtFS.call(void 0, options.clientRoot)}/`
365
372
  },
366
373
  dedupe: ["vue"]
367
374
  },
@@ -396,16 +403,16 @@ function createConfigPlugin(options) {
396
403
  allow: _utils.uniq.call(void 0, [
397
404
  searchForWorkspaceRoot(options.userRoot),
398
405
  searchForWorkspaceRoot(options.cliRoot),
399
- ..._isinstalledglobally2.default ? [_path.dirname.call(void 0, _chunkUJ5GHVIIjs.resolveGlobalImportPath.call(void 0, "@slidev/client/package.json")), _path.dirname.call(void 0, _chunkUJ5GHVIIjs.resolveGlobalImportPath.call(void 0, "katex/package.json"))] : []
406
+ ..._isinstalledglobally2.default ? [_path.dirname.call(void 0, _chunkGE7W2DBEjs.resolveGlobalImportPath.call(void 0, "@slidev/client/package.json")), _path.dirname.call(void 0, _chunkGE7W2DBEjs.resolveGlobalImportPath.call(void 0, "katex/package.json"))] : []
400
407
  ])
401
408
  }
402
- }
409
+ },
410
+ publicDir: _path.join.call(void 0, options.userRoot, "public")
403
411
  };
404
412
  if (_isinstalledglobally2.default) {
405
413
  injection.cacheDir = _path.join.call(void 0, options.cliRoot, "node_modules/.vite");
406
- injection.publicDir = _path.join.call(void 0, options.userRoot, "public");
407
414
  injection.root = options.cliRoot;
408
- injection.resolve.alias.vue = `${_chunkUJ5GHVIIjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
415
+ injection.resolve.alias.vue = `${_chunkGE7W2DBEjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
409
416
  }
410
417
  return _vite.mergeConfig.call(void 0, config, injection);
411
418
  },
@@ -427,7 +434,7 @@ function createConfigPlugin(options) {
427
434
  function getDefine(options) {
428
435
  return {
429
436
  __DEV__: options.mode === "dev" ? "true" : "false",
430
- __SLIDEV_CLIENT_ROOT__: JSON.stringify(_chunkUJ5GHVIIjs.toAtFS.call(void 0, options.clientRoot)),
437
+ __SLIDEV_CLIENT_ROOT__: JSON.stringify(_chunkGE7W2DBEjs.toAtFS.call(void 0, options.clientRoot)),
431
438
  __SLIDEV_HASH_ROUTE__: JSON.stringify(options.data.config.routerMode === "hash"),
432
439
  __SLIDEV_FEATURE_DRAWINGS__: JSON.stringify(options.data.config.drawings.enabled === true || options.data.config.drawings.enabled === options.mode),
433
440
  __SLIDEV_FEATURE_DRAWINGS_PERSIST__: JSON.stringify(!!options.data.config.drawings.persist === true),
@@ -438,7 +445,7 @@ function getDefine(options) {
438
445
  }
439
446
 
440
447
  // node/plugins/loaders.ts
441
- var import_fast_deep_equal = _chunkUJ5GHVIIjs.__toESM.call(void 0, require_fast_deep_equal());
448
+ var import_fast_deep_equal = _chunkGE7W2DBEjs.__toESM.call(void 0, require_fast_deep_equal());
442
449
 
443
450
 
444
451
 
@@ -520,6 +527,7 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
520
527
  var _a, _b, _c;
521
528
  if (!data.entries.some((i) => _utils.slash.call(void 0, i) === ctx.file))
522
529
  return;
530
+ await ctx.read();
523
531
  const newData = await parser.load(entry, data.themeMeta);
524
532
  const moduleIds = /* @__PURE__ */ new Set();
525
533
  if (data.slides.length !== newData.slides.length) {
@@ -706,7 +714,7 @@ ${title}
706
714
  delete frontmatter.title;
707
715
  const imports = [
708
716
  'import { inject as vueInject } from "vue"',
709
- `import InjectedLayout from "${_chunkUJ5GHVIIjs.toAtFS.call(void 0, layouts[layoutName])}"`,
717
+ `import InjectedLayout from "${_chunkGE7W2DBEjs.toAtFS.call(void 0, layouts[layoutName])}"`,
710
718
  'import { injectionSlidevContext } from "@slidev/client/constants"',
711
719
  `const frontmatter = ${JSON.stringify(frontmatter)}`,
712
720
  "const $slidev = vueInject(injectionSlidevContext)"
@@ -744,7 +752,7 @@ ${imports.join("\n")}
744
752
  if (matchExport) {
745
753
  const exportIndex = (matchExport.index || 0) + matchExport[0].length;
746
754
  let component = code.slice(exportIndex);
747
- component = component.slice(0, component.indexOf("<\/script>"));
755
+ component = component.slice(0, component.indexOf("</script>"));
748
756
  const scriptIndex = (matchScript.index || 0) + matchScript[0].length;
749
757
  const provideImport = '\nimport { injectionSlidevContext } from "@slidev/client/constants"\n';
750
758
  code = `${code.slice(0, scriptIndex)}${provideImport}${code.slice(scriptIndex)}`;
@@ -774,7 +782,7 @@ ${code.slice(injectIndex)}`;
774
782
  }
775
783
  return `<script setup>
776
784
  ${imports.join("\n")}
777
- <\/script>
785
+ </script>
778
786
  ${code}`;
779
787
  }
780
788
  function transformTitles(code) {
@@ -811,10 +819,10 @@ defineProps<{ no: number | string }>()`);
811
819
  }
812
820
  async function generateUserStyles() {
813
821
  const imports = [
814
- `import "${_chunkUJ5GHVIIjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/vars.css"))}"`,
815
- `import "${_chunkUJ5GHVIIjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/index.css"))}"`,
816
- `import "${_chunkUJ5GHVIIjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/code.css"))}"`,
817
- `import "${_chunkUJ5GHVIIjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/transitions.css"))}"`
822
+ `import "${_chunkGE7W2DBEjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/vars.css"))}"`,
823
+ `import "${_chunkGE7W2DBEjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/index.css"))}"`,
824
+ `import "${_chunkGE7W2DBEjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/code.css"))}"`,
825
+ `import "${_chunkGE7W2DBEjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "styles/transitions.css"))}"`
818
826
  ];
819
827
  const roots2 = _utils.uniq.call(void 0, [
820
828
  ...themeRoots,
@@ -831,13 +839,13 @@ defineProps<{ no: number | string }>()`);
831
839
  ];
832
840
  for (const style of styles) {
833
841
  if (_fsextra.existsSync.call(void 0, style)) {
834
- imports.push(`import "${_chunkUJ5GHVIIjs.toAtFS.call(void 0, style)}"`);
842
+ imports.push(`import "${_chunkGE7W2DBEjs.toAtFS.call(void 0, style)}"`);
835
843
  continue;
836
844
  }
837
845
  }
838
846
  }
839
847
  if (data.features.katex)
840
- imports.push(`import "${_chunkUJ5GHVIIjs.toAtFS.call(void 0, _chunkUJ5GHVIIjs.resolveImportPath.call(void 0, "katex/dist/katex.min.css", true))}"`);
848
+ imports.push(`import "${_chunkGE7W2DBEjs.toAtFS.call(void 0, _chunkGE7W2DBEjs.resolveImportPath.call(void 0, "katex/dist/katex.min.css", true))}"`);
841
849
  if (data.config.css === "unocss") {
842
850
  imports.unshift(
843
851
  'import "@unocss/reset/tailwind.css"',
@@ -851,10 +859,9 @@ defineProps<{ no: number | string }>()`);
851
859
  'import "virtual:windi-components.css"',
852
860
  'import "virtual:windi-base.css"'
853
861
  );
854
- imports.push(
855
- 'import "virtual:windi-utilities.css"',
856
- 'import "virtual:windi-devtools"'
857
- );
862
+ imports.push('import "virtual:windi-utilities.css"');
863
+ if (process.env.NODE_ENV !== "production")
864
+ imports.push('import "virtual:windi-devtools"');
858
865
  }
859
866
  return imports.join("\n");
860
867
  }
@@ -866,7 +873,7 @@ defineProps<{ no: number | string }>()`);
866
873
  const layouts = _utils.objectMap.call(void 0,
867
874
  await getLayouts(),
868
875
  (k, v) => {
869
- imports.push(`import __layout_${k} from "${_chunkUJ5GHVIIjs.toAtFS.call(void 0, v)}"`);
876
+ imports.push(`import __layout_${k} from "${_chunkGE7W2DBEjs.toAtFS.call(void 0, v)}"`);
870
877
  return [k, `__layout_${k}`];
871
878
  }
872
879
  );
@@ -915,7 +922,7 @@ ${routes.join(",\n")}
915
922
  const config = { ...data.config, remote };
916
923
  if (_utils.isString.call(void 0, config.title)) {
917
924
  const tokens = md.parseInline(config.title, {});
918
- config.title = _chunkUJ5GHVIIjs.stringifyMarkdownTokens.call(void 0, tokens);
925
+ config.title = _chunkGE7W2DBEjs.stringifyMarkdownTokens.call(void 0, tokens);
919
926
  }
920
927
  if (_utils.isString.call(void 0, config.info))
921
928
  config.info = md.render(config.info);
@@ -936,7 +943,7 @@ ${routes.join(",\n")}
936
943
  ];
937
944
  }
938
945
  }).filter((i) => _fsextra2.default.existsSync(i));
939
- const imports = components.map((i, idx) => `import __n${idx} from '${_chunkUJ5GHVIIjs.toAtFS.call(void 0, i)}'`).join("\n");
946
+ const imports = components.map((i, idx) => `import __n${idx} from '${_chunkGE7W2DBEjs.toAtFS.call(void 0, i)}'`).join("\n");
940
947
  const render = components.map((i, idx) => `h(__n${idx})`).join(",");
941
948
  return `
942
949
  ${imports}
@@ -955,7 +962,7 @@ export default {
955
962
  _path.join.call(void 0, root, "CustomNavControls.vue")
956
963
  ];
957
964
  }).filter((i) => _fsextra2.default.existsSync(i));
958
- const imports = components.map((i, idx) => `import __n${idx} from '${_chunkUJ5GHVIIjs.toAtFS.call(void 0, i)}'`).join("\n");
965
+ const imports = components.map((i, idx) => `import __n${idx} from '${_chunkGE7W2DBEjs.toAtFS.call(void 0, i)}'`).join("\n");
959
966
  const render = components.map((i, idx) => `h(__n${idx})`).join(",");
960
967
  return `
961
968
  ${imports}
@@ -1028,7 +1035,7 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
1028
1035
  setups.forEach((path, idx) => {
1029
1036
  if (!_fs.existsSync.call(void 0, path))
1030
1037
  return;
1031
- imports.push(`import __n${idx} from '${_chunkUJ5GHVIIjs.toAtFS.call(void 0, path)}'`);
1038
+ imports.push(`import __n${idx} from '${_chunkGE7W2DBEjs.toAtFS.call(void 0, path)}'`);
1032
1039
  let fn = `:AWAIT:__n${idx}`;
1033
1040
  if (/\binjection_return\b/g.test(code))
1034
1041
  fn = `injection_return = ${fn}`;
@@ -1076,7 +1083,8 @@ function isValidDelim(state, pos) {
1076
1083
  let can_close = true;
1077
1084
  const prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;
1078
1085
  const nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;
1079
- if (prevChar === 32 || prevChar === 9 || nextChar >= 48 && nextChar <= 57)
1086
+ if (prevChar === 32 || prevChar === 9 || /* \t */
1087
+ nextChar >= 48 && nextChar <= 57)
1080
1088
  can_close = false;
1081
1089
  if (nextChar === 32 || nextChar === 9)
1082
1090
  can_open = false;
@@ -1237,7 +1245,7 @@ function loadPrismLang(lang) {
1237
1245
  }
1238
1246
  function loadPrismPlugin(name) {
1239
1247
  try {
1240
- _chunkUJ5GHVIIjs.__require.call(void 0, `prismjs/plugins/${name}/prism-${name}`);
1248
+ _chunkGE7W2DBEjs.__require.call(void 0, `prismjs/plugins/${name}/prism-${name}`);
1241
1249
  } catch (e) {
1242
1250
  throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`);
1243
1251
  }
@@ -1394,6 +1402,13 @@ async function createMarkdownPlugin({ data: { config }, roots, mode, entry }, {
1394
1402
  });
1395
1403
  }
1396
1404
  function transformMarkdownMonaco(md2) {
1405
+ md2 = md2.replace(/^```(\w+?)\s*{monaco-diff}\s*?({.*?})?\s*?\n([\s\S]+?)^~~~\s*?\n([\s\S]+?)^```/mg, (full, lang = "ts", options = "{}", code, diff) => {
1406
+ lang = lang.trim();
1407
+ options = options.trim() || "{}";
1408
+ const encoded = base64.encode(code, true);
1409
+ const encodedDiff = base64.encode(diff, true);
1410
+ return `<Monaco :code="'${encoded}'" :diff="'${encodedDiff}'" lang="${lang}" v-bind="${options}" />`;
1411
+ });
1397
1412
  md2 = md2.replace(/^```(\w+?)\s*{monaco}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg, (full, lang = "ts", options = "{}", code) => {
1398
1413
  lang = lang.trim();
1399
1414
  options = options.trim() || "{}";
@@ -1553,6 +1568,7 @@ async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, u
1553
1568
 
1554
1569
  // node/plugins/preset.ts
1555
1570
  var customElements = /* @__PURE__ */ new Set([
1571
+ // katex
1556
1572
  "annotation",
1557
1573
  "math",
1558
1574
  "menclose",
@@ -1683,7 +1699,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1683
1699
  dev: true,
1684
1700
  build: true
1685
1701
  }) : null,
1686
- config.css === "unocss" ? await createUnocssPlugin(options, pluginOptions) : await createWindiCSSPlugin(options, pluginOptions)
1702
+ config.css === "none" ? null : config.css === "unocss" ? await createUnocssPlugin(options, pluginOptions) : await createWindiCSSPlugin(options, pluginOptions)
1687
1703
  ].flat().filter(_utils.notNullish);
1688
1704
  }
1689
1705
 
@@ -23,6 +23,10 @@ var __copyProps = (to, from, except, desc) => {
23
23
  return to;
24
24
  };
25
25
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
30
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
31
  mod
28
32
  ));
package/dist/cli.d.ts CHANGED
@@ -1 +1,2 @@
1
1
 
2
+ export { }
package/dist/cli.js CHANGED
@@ -9,17 +9,17 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkRRNUXVEAjs = require('./chunk-RRNUXVEA.js');
12
+ var _chunkCKLR5LMVjs = require('./chunk-CKLR5LMV.js');
13
13
 
14
14
 
15
15
 
16
- var _chunkQU6XIJOBjs = require('./chunk-QU6XIJOB.js');
16
+ var _chunkFT5Y6KDWjs = require('./chunk-FT5Y6KDW.js');
17
17
 
18
18
 
19
- var _chunkUJ5GHVIIjs = require('./chunk-UJ5GHVII.js');
19
+ var _chunkGE7W2DBEjs = require('./chunk-GE7W2DBE.js');
20
20
 
21
21
  // node/cli.ts
22
- var import_fast_deep_equal = _chunkUJ5GHVIIjs.__toESM.call(void 0, _chunkQU6XIJOBjs.require_fast_deep_equal.call(void 0, ));
22
+ var import_fast_deep_equal = _chunkGE7W2DBEjs.__toESM.call(void 0, _chunkFT5Y6KDWjs.require_fast_deep_equal.call(void 0, ));
23
23
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
24
24
  var _os = require('os'); var _os2 = _interopRequireDefault(_os);
25
25
  var _child_process = require('child_process');
@@ -42,15 +42,18 @@ var CONFIG_RESTART_FIELDS = [
42
42
  ];
43
43
  _fs.injectPreparserExtensionLoader.call(void 0, async (headmatter, filepath) => {
44
44
  const addons = _nullishCoalesce((headmatter == null ? void 0 : headmatter.addons), () => ( []));
45
- const roots = [
46
- _chunkRRNUXVEAjs.getUserRoot.call(void 0, {}).userRoot,
47
- ..._chunkRRNUXVEAjs.getAddonRoots.call(void 0, addons, ""),
48
- _chunkRRNUXVEAjs.getClientRoot.call(void 0, )
49
- ];
45
+ const roots = (
46
+ /* uniq */
47
+ [
48
+ _chunkCKLR5LMVjs.getUserRoot.call(void 0, {}).userRoot,
49
+ ..._chunkCKLR5LMVjs.getAddonRoots.call(void 0, addons, ""),
50
+ _chunkCKLR5LMVjs.getClientRoot.call(void 0, )
51
+ ]
52
+ );
50
53
  const mergeArrays = (a, b) => a.concat(b);
51
- return await _chunkQU6XIJOBjs.loadSetups.call(void 0, roots, "preparser.ts", { filepath, headmatter }, [], false, mergeArrays);
54
+ return await _chunkFT5Y6KDWjs.loadSetups.call(void 0, roots, "preparser.ts", { filepath, headmatter }, [], false, mergeArrays);
52
55
  });
53
- var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkRRNUXVEAjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
56
+ var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkCKLR5LMVjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
54
57
  cli.command(
55
58
  "* [entry]",
56
59
  "Start a local server for Slidev",
@@ -106,9 +109,9 @@ cli.command(
106
109
  async function initServer() {
107
110
  if (server)
108
111
  await server.close();
109
- const options = await _chunkRRNUXVEAjs.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
112
+ const options = await _chunkCKLR5LMVjs.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
110
113
  port = userPort || await findFreePort(3030);
111
- server = await _chunkRRNUXVEAjs.createServer.call(void 0,
114
+ server = await _chunkCKLR5LMVjs.createServer.call(void 0,
112
115
  options,
113
116
  {
114
117
  server: {
@@ -122,7 +125,7 @@ cli.command(
122
125
  },
123
126
  {
124
127
  onDataReload(newData, data) {
125
- if (!theme && _chunkRRNUXVEAjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunkRRNUXVEAjs.resolveThemeName.call(void 0, data.config.theme)) {
128
+ if (!theme && _chunkCKLR5LMVjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunkCKLR5LMVjs.resolveThemeName.call(void 0, data.config.theme)) {
126
129
  console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
127
130
  initServer();
128
131
  } else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
@@ -215,7 +218,7 @@ ${_kolorist.dim.call(void 0, " QR Code for remote control: ")}
215
218
  }
216
219
  );
217
220
  cli.command(
218
- "build [entry]",
221
+ "build [entry..]",
219
222
  "Build hostable SPA",
220
223
  (args) => exportOptions(commonOptions(args)).option("watch", {
221
224
  alias: "w",
@@ -240,28 +243,32 @@ cli.command(
240
243
  }).strict().help(),
241
244
  async (args) => {
242
245
  const { entry, theme, watch, base, download, out, inspect } = args;
243
- const { build } = await Promise.resolve().then(() => require("./build-L4S5TZG4.js"));
244
- const options = await _chunkRRNUXVEAjs.resolveOptions.call(void 0, { entry, theme, inspect }, "build");
245
- if (download && !options.data.config.download)
246
- options.data.config.download = download;
247
- printInfo(options);
248
- await build(options, {
249
- base,
250
- build: {
251
- watch: watch ? {} : void 0,
252
- outDir: out
253
- }
254
- }, args);
246
+ const { build } = await Promise.resolve().then(() => require("./build-HVQ7GG2W.js"));
247
+ for (const entryFile of entry) {
248
+ const options = await _chunkCKLR5LMVjs.resolveOptions.call(void 0, { entry: entryFile, theme, inspect }, "build");
249
+ if (download && !options.data.config.download)
250
+ options.data.config.download = download;
251
+ printInfo(options);
252
+ await build(options, {
253
+ base,
254
+ build: {
255
+ watch: watch ? {} : void 0,
256
+ outDir: entry.length === 1 ? out : _path2.default.join(out, _path2.default.basename(entryFile, ".md"))
257
+ }
258
+ }, { ...args, entry: entryFile });
259
+ }
255
260
  }
256
261
  );
257
262
  cli.command(
258
- "format [entry]",
263
+ "format [entry..]",
259
264
  "Format the markdown file",
260
265
  (args) => commonOptions(args).strict().help(),
261
266
  async ({ entry }) => {
262
- const data = await _chunkRRNUXVEAjs.parser.load(entry);
263
- _chunkRRNUXVEAjs.parser.prettify(data);
264
- await _chunkRRNUXVEAjs.parser.save(data);
267
+ for (const entryFile of entry) {
268
+ const data = await _chunkCKLR5LMVjs.parser.load(entryFile);
269
+ _chunkCKLR5LMVjs.parser.prettify(data);
270
+ await _chunkCKLR5LMVjs.parser.save(data);
271
+ }
265
272
  }
266
273
  );
267
274
  cli.command(
@@ -276,17 +283,17 @@ cli.command(
276
283
  default: "theme"
277
284
  }),
278
285
  async ({ entry, dir, theme: themeInput }) => {
279
- const data = await _chunkRRNUXVEAjs.parser.load(entry);
280
- const theme = _chunkRRNUXVEAjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
286
+ const data = await _chunkCKLR5LMVjs.parser.load(entry);
287
+ const theme = _chunkCKLR5LMVjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
281
288
  if (theme === "none") {
282
289
  console.error('Cannot eject theme "none"');
283
290
  process.exit(1);
284
291
  }
285
- if (_chunkRRNUXVEAjs.isPath.call(void 0, theme)) {
292
+ if (_chunkCKLR5LMVjs.isPath.call(void 0, theme)) {
286
293
  console.error("Theme is already ejected");
287
294
  process.exit(1);
288
295
  }
289
- const roots = _chunkRRNUXVEAjs.getThemeRoots.call(void 0, theme, entry);
296
+ const roots = _chunkCKLR5LMVjs.getThemeRoots.call(void 0, theme, entry);
290
297
  if (!roots.length) {
291
298
  console.error(`Could not find theme "${theme}"`);
292
299
  process.exit(1);
@@ -298,7 +305,7 @@ cli.command(
298
305
  const dirPath = `./${dir}`;
299
306
  data.slides[0].frontmatter.theme = dirPath;
300
307
  data.slides[0].raw = null;
301
- await _chunkRRNUXVEAjs.parser.save(data);
308
+ await _chunkCKLR5LMVjs.parser.save(data);
302
309
  console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
303
310
  }
304
311
  );
@@ -309,37 +316,39 @@ cli.command(
309
316
  }
310
317
  );
311
318
  cli.command(
312
- "export [entry]",
319
+ "export [entry..]",
313
320
  "Export slides to PDF",
314
321
  (args) => exportOptions(commonOptions(args)).strict().help(),
315
322
  async (args) => {
316
323
  const { entry, theme } = args;
317
324
  process.env.NODE_ENV = "production";
318
- const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-BRPXINGP.js"));
325
+ const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-INNI35CW.js"));
319
326
  const port = await findFreePort(12445);
320
- const options = await _chunkRRNUXVEAjs.resolveOptions.call(void 0, { entry, theme }, "export");
321
- const server = await _chunkRRNUXVEAjs.createServer.call(void 0,
322
- options,
323
- {
324
- server: { port },
325
- clearScreen: false
326
- }
327
- );
328
- await server.listen(port);
329
- printInfo(options);
330
- _chunkRRNUXVEAjs.parser.filterDisabled(options.data);
331
- const output = await exportSlides({
332
- port,
333
- ...getExportOptions(args, options)
334
- });
335
- console.log(`${_kolorist.green.call(void 0, " \u2713 ")}${_kolorist.dim.call(void 0, "exported to ")}./${output}
327
+ for (const entryFile of entry) {
328
+ const options = await _chunkCKLR5LMVjs.resolveOptions.call(void 0, { entry: entryFile, theme }, "export");
329
+ const server = await _chunkCKLR5LMVjs.createServer.call(void 0,
330
+ options,
331
+ {
332
+ server: { port },
333
+ clearScreen: false
334
+ }
335
+ );
336
+ await server.listen(port);
337
+ printInfo(options);
338
+ _chunkCKLR5LMVjs.parser.filterDisabled(options.data);
339
+ const result = await exportSlides({
340
+ port,
341
+ ...getExportOptions({ ...args, entry: entryFile }, options)
342
+ });
343
+ console.log(`${_kolorist.green.call(void 0, " \u2713 ")}${_kolorist.dim.call(void 0, "exported to ")}./${result}
336
344
  `);
337
- server.close();
345
+ server.close();
346
+ }
338
347
  process.exit(0);
339
348
  }
340
349
  );
341
350
  cli.command(
342
- "export-notes [entry]",
351
+ "export-notes [entry..]",
343
352
  "Export slide notes to PDF",
344
353
  (args) => args.positional("entry", {
345
354
  default: "slides.md",
@@ -359,29 +368,29 @@ cli.command(
359
368
  timeout
360
369
  }) => {
361
370
  process.env.NODE_ENV = "production";
362
- const { exportNotes } = await Promise.resolve().then(() => require("./export-BRPXINGP.js"));
371
+ const { exportNotes } = await Promise.resolve().then(() => require("./export-INNI35CW.js"));
363
372
  const port = await findFreePort(12445);
364
- const options = await _chunkRRNUXVEAjs.resolveOptions.call(void 0, { entry }, "export");
365
- if (!output)
366
- output = options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${_path2.default.basename(entry, ".md")}-export-notes`;
367
- const server = await _chunkRRNUXVEAjs.createServer.call(void 0,
368
- options,
369
- {
370
- server: { port },
371
- clearScreen: false
372
- }
373
- );
374
- await server.listen(port);
375
- printInfo(options);
376
- _chunkRRNUXVEAjs.parser.filterDisabled(options.data);
377
- output = await exportNotes({
378
- port,
379
- output,
380
- timeout
381
- });
382
- console.log(`${_kolorist.green.call(void 0, " \u2713 ")}${_kolorist.dim.call(void 0, "exported to ")}./${output}
373
+ for (const entryFile of entry) {
374
+ const options = await _chunkCKLR5LMVjs.resolveOptions.call(void 0, { entry: entryFile }, "export");
375
+ const server = await _chunkCKLR5LMVjs.createServer.call(void 0,
376
+ options,
377
+ {
378
+ server: { port },
379
+ clearScreen: false
380
+ }
381
+ );
382
+ await server.listen(port);
383
+ printInfo(options);
384
+ _chunkCKLR5LMVjs.parser.filterDisabled(options.data);
385
+ const result = await exportNotes({
386
+ port,
387
+ output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${_path2.default.basename(entryFile, ".md")}-export-notes`),
388
+ timeout
389
+ });
390
+ console.log(`${_kolorist.green.call(void 0, " \u2713 ")}${_kolorist.dim.call(void 0, "exported to ")}./${result}
383
391
  `);
384
- server.close();
392
+ server.close();
393
+ }
385
394
  process.exit(0);
386
395
  }
387
396
  );
@@ -433,7 +442,7 @@ function printInfo(options, port, remote, tunnelUrl) {
433
442
  console.log();
434
443
  console.log();
435
444
  console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
436
- console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkRRNUXVEAjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
445
+ console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkCKLR5LMVjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
437
446
  console.log();
438
447
  console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
439
448
  console.log(_kolorist.dim.call(void 0, " entry ") + _kolorist.dim.call(void 0, _path2.default.dirname(options.entry) + _path2.default.sep) + _path2.default.basename(options.entry));