@slidev/cli 0.32.4 → 0.33.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,7 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
3
 
4
- var _chunkKFVTOCEDjs = require('./chunk-KFVTOCED.js');
4
+
5
+ var _chunkUNBXPUSGjs = require('./chunk-UNBXPUSG.js');
5
6
 
6
7
 
7
8
 
@@ -655,13 +656,13 @@ async function build(options, viteConfig = {}) {
655
656
  let originalIndexHTML;
656
657
  if (_fsextra2.default.existsSync(indexPath))
657
658
  originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
658
- await _fsextra2.default.writeFile(indexPath, await _chunkKFVTOCEDjs.getIndexHtml.call(void 0, options), "utf-8");
659
+ await _fsextra2.default.writeFile(indexPath, await _chunkUNBXPUSGjs.getIndexHtml.call(void 0, options), "utf-8");
659
660
  let config = void 0;
660
661
  try {
661
- const inlineConfig = _vite.mergeConfig.call(void 0, viteConfig, {
662
+ const inlineConfig = await _chunkUNBXPUSGjs.mergeViteConfigs.call(void 0, options, viteConfig, {
662
663
  root: options.userRoot,
663
664
  plugins: [
664
- await _chunkKFVTOCEDjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
665
+ await _chunkUNBXPUSGjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
665
666
  {
666
667
  name: "resolve-config",
667
668
  configResolved(_config) {
@@ -672,14 +673,14 @@ async function build(options, viteConfig = {}) {
672
673
  build: {
673
674
  chunkSizeWarningLimit: 2e3
674
675
  }
675
- });
676
+ }, "build");
676
677
  await _vite.build.call(void 0, inlineConfig);
677
678
  if (options.data.features.monaco) {
678
679
  if (options.data.config.monaco === "dev") {
679
680
  console.log(_kolorist.yellow.call(void 0, " Monaco is disabled in the build, to enabled it, set `monaco: true` in the frontmatter"));
680
681
  } else {
681
682
  console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
682
- await _vite.build.call(void 0, _vite.mergeConfig.call(void 0, inlineConfig, {
683
+ await _vite.build.call(void 0, await _chunkUNBXPUSGjs.mergeViteConfigs.call(void 0, options, inlineConfig, {
683
684
  root: _path.join.call(void 0, options.clientRoot, "iframes/monaco"),
684
685
  base: `${config.base}iframes/monaco/`,
685
686
  build: {
@@ -696,7 +697,7 @@ async function build(options, viteConfig = {}) {
696
697
  }
697
698
  }
698
699
  }
699
- }));
700
+ }, "build"));
700
701
  }
701
702
  }
702
703
  } finally {
@@ -725,13 +726,14 @@ async function build(options, viteConfig = {}) {
725
726
  server.listen(port);
726
727
  await exportSlides({
727
728
  port,
729
+ slides: options.data.slides,
728
730
  total: options.data.slides.length,
729
731
  format: "pdf",
730
732
  output: _path.join.call(void 0, outDir, outFilename),
731
733
  base: config.base,
732
734
  dark: options.data.config.colorSchema === "dark",
733
- width: 1920,
734
- height: Math.round(1920 / options.data.config.aspectRatio),
735
+ width: options.data.config.canvasWidth,
736
+ height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
735
737
  routerMode: options.data.config.routerMode
736
738
  });
737
739
  server.close();
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
- getIndexHtml
4
- } from "./chunk-CNNMHD67.mjs";
3
+ getIndexHtml,
4
+ mergeViteConfigs
5
+ } from "./chunk-C7GPMAIX.mjs";
5
6
  import {
6
7
  __require,
7
8
  __spreadValues,
@@ -14,7 +15,7 @@ init_esm_shims();
14
15
  import { join as join3, resolve as resolve3 } from "path";
15
16
  import http from "http";
16
17
  import fs2 from "fs-extra";
17
- import { mergeConfig, resolveConfig, build as viteBuild } from "vite";
18
+ import { resolveConfig, build as viteBuild } from "vite";
18
19
  import connect from "connect";
19
20
 
20
21
  // ../../node_modules/.pnpm/sirv@2.0.2/node_modules/sirv/build.mjs
@@ -658,7 +659,7 @@ async function build(options, viteConfig = {}) {
658
659
  await fs2.writeFile(indexPath, await getIndexHtml(options), "utf-8");
659
660
  let config = void 0;
660
661
  try {
661
- const inlineConfig = mergeConfig(viteConfig, {
662
+ const inlineConfig = await mergeViteConfigs(options, viteConfig, {
662
663
  root: options.userRoot,
663
664
  plugins: [
664
665
  await ViteSlidevPlugin(options, pluginOptions),
@@ -672,14 +673,14 @@ async function build(options, viteConfig = {}) {
672
673
  build: {
673
674
  chunkSizeWarningLimit: 2e3
674
675
  }
675
- });
676
+ }, "build");
676
677
  await viteBuild(inlineConfig);
677
678
  if (options.data.features.monaco) {
678
679
  if (options.data.config.monaco === "dev") {
679
680
  console.log(yellow(" Monaco is disabled in the build, to enabled it, set `monaco: true` in the frontmatter"));
680
681
  } else {
681
682
  console.log(blue(" building for Monaco...\n"));
682
- await viteBuild(mergeConfig(inlineConfig, {
683
+ await viteBuild(await mergeViteConfigs(options, inlineConfig, {
683
684
  root: join3(options.clientRoot, "iframes/monaco"),
684
685
  base: `${config.base}iframes/monaco/`,
685
686
  build: {
@@ -696,7 +697,7 @@ async function build(options, viteConfig = {}) {
696
697
  }
697
698
  }
698
699
  }
699
- }));
700
+ }, "build"));
700
701
  }
701
702
  }
702
703
  } finally {
@@ -725,13 +726,14 @@ async function build(options, viteConfig = {}) {
725
726
  server.listen(port);
726
727
  await exportSlides({
727
728
  port,
729
+ slides: options.data.slides,
728
730
  total: options.data.slides.length,
729
731
  format: "pdf",
730
732
  output: join3(outDir, outFilename),
731
733
  base: config.base,
732
734
  dark: options.data.config.colorSchema === "dark",
733
- width: 1920,
734
- height: Math.round(1920 / options.data.config.aspectRatio),
735
+ width: options.data.config.canvasWidth,
736
+ height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
735
737
  routerMode: options.data.config.routerMode
736
738
  });
737
739
  server.close();
@@ -64,6 +64,7 @@ init_esm_shims();
64
64
  import { existsSync, promises as fs } from "fs";
65
65
  import { join } from "path";
66
66
  import { uniq } from "@antfu/utils";
67
+ import { loadConfigFromFile, mergeConfig } from "vite";
67
68
  async function getIndexHtml({ clientRoot, themeRoots, data, userRoot }) {
68
69
  var _a, _b;
69
70
  let main = await fs.readFile(join(clientRoot, "index.html"), "utf-8");
@@ -92,6 +93,25 @@ ${(((_b = index.match(/<body>([\s\S]*?)<\/body>/im)) == null ? void 0 : _b[1]) |
92
93
  main = main.replace("__ENTRY__", toAtFS(join(clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
93
94
  return main;
94
95
  }
96
+ async function mergeViteConfigs({ addonRoots, themeRoots }, viteConfig, config, command) {
97
+ const configEnv = {
98
+ mode: "development",
99
+ command
100
+ };
101
+ const files = uniq([
102
+ ...themeRoots,
103
+ ...addonRoots
104
+ ]).map((i) => join(i, "vite.config.ts"));
105
+ for await (const file of files) {
106
+ if (!existsSync(file))
107
+ continue;
108
+ const viteConfig2 = await loadConfigFromFile(configEnv, file);
109
+ if (!(viteConfig2 == null ? void 0 : viteConfig2.config))
110
+ continue;
111
+ config = mergeConfig(config, viteConfig2.config);
112
+ }
113
+ return mergeConfig(viteConfig, config);
114
+ }
95
115
 
96
116
  // node/plugins/windicss.ts
97
117
  init_esm_shims();
@@ -165,12 +185,12 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
165
185
  },
166
186
  onOptionsResolved(config2) {
167
187
  themeRoots.forEach((i) => {
168
- config2.scanOptions.include.push(`${i}/components/*.{vue,ts}`);
169
- config2.scanOptions.include.push(`${i}/layouts/*.{vue,ts}`);
188
+ config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
189
+ config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
170
190
  });
171
191
  addonRoots.forEach((i) => {
172
- config2.scanOptions.include.push(`${i}/components/*.{vue,ts}`);
173
- config2.scanOptions.include.push(`${i}/layouts/*.{vue,ts}`);
192
+ config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
193
+ config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
174
194
  });
175
195
  config2.scanOptions.include.push(`!${slash(resolve2(userRoot, "node_modules"))}`);
176
196
  config2.scanOptions.exclude.push(dirname(resolveImportPath("monaco-editor/package.json", true)));
@@ -239,7 +259,7 @@ ${value}
239
259
  // node/plugins/extendConfig.ts
240
260
  init_esm_shims();
241
261
  import { dirname as dirname4, join as join4 } from "path";
242
- import { mergeConfig } from "vite";
262
+ import { mergeConfig as mergeConfig2 } from "vite";
243
263
  import isInstalledGlobally from "is-installed-globally";
244
264
  import { uniq as uniq3 } from "@antfu/utils";
245
265
 
@@ -370,7 +390,7 @@ function createConfigPlugin(options) {
370
390
  injection.root = options.cliRoot;
371
391
  injection.resolve.alias.vue = `${resolveImportPath("vue/dist/vue.esm-browser.js", true)}`;
372
392
  }
373
- return mergeConfig(config, injection);
393
+ return mergeConfig2(config, injection);
374
394
  },
375
395
  configureServer(server) {
376
396
  return () => {
@@ -734,7 +754,7 @@ defineProps<{ no: number | string }>()`);
734
754
  clientRoot
735
755
  ]);
736
756
  for (const root of roots2) {
737
- const layoutPaths = await fg2("layouts/*.{vue,ts}", {
757
+ const layoutPaths = await fg2("layouts/**/*.{vue,ts}", {
738
758
  cwd: root,
739
759
  absolute: true
740
760
  });
@@ -807,16 +827,11 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
807
827
  return void 0;
808
828
  imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
809
829
  const additions = {
810
- slide: {
811
- start: i.start,
812
- end: i.end,
813
- note: i.note,
830
+ slide: __spreadProps(__spreadValues({}, prepareSlideInfo(i)), {
814
831
  filepath: ((_b = i.source) == null ? void 0 : _b.filepath) || entry,
815
832
  id: idx,
816
- no,
817
- title: i.title,
818
- level: i.level
819
- },
833
+ no
834
+ }),
820
835
  __clicksElements: [],
821
836
  __preloaded: false
822
837
  };
@@ -1550,6 +1565,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1550
1565
 
1551
1566
  export {
1552
1567
  getIndexHtml,
1568
+ mergeViteConfigs,
1553
1569
  require_fast_deep_equal,
1554
1570
  createWindiCSSPlugin,
1555
1571
  ViteSlidevPlugin
@@ -1,6 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkKFVTOCEDjs = require('./chunk-KFVTOCED.js');
3
+
4
+ var _chunkUNBXPUSGjs = require('./chunk-UNBXPUSG.js');
4
5
 
5
6
 
6
7
 
@@ -2382,16 +2383,16 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2382
2383
  const rawConfig = await _vite.resolveConfig.call(void 0, {}, "serve");
2383
2384
  const pluginOptions = rawConfig.slidev || {};
2384
2385
  process.env.EDITOR = process.env.EDITOR || "code";
2385
- const server = await _vite.createServer.call(void 0, _vite.mergeConfig.call(void 0, viteConfig, {
2386
+ const server = await _vite.createServer.call(void 0, await _chunkUNBXPUSGjs.mergeViteConfigs.call(void 0, options, viteConfig, {
2386
2387
  optimizeDeps: {
2387
2388
  entries: [
2388
2389
  _path.join.call(void 0, options.clientRoot, "main.ts")
2389
2390
  ]
2390
2391
  },
2391
2392
  plugins: [
2392
- await _chunkKFVTOCEDjs.ViteSlidevPlugin.call(void 0, options, pluginOptions, serverOptions)
2393
+ await _chunkUNBXPUSGjs.ViteSlidevPlugin.call(void 0, options, pluginOptions, serverOptions)
2393
2394
  ]
2394
- }));
2395
+ }, "serve"));
2395
2396
  return server;
2396
2397
  }
2397
2398
 
@@ -2400,7 +2401,7 @@ _chunkFFZLS6QKjs.init_cjs_shims.call(void 0, );
2400
2401
  var _fs = require('@slidev/parser/fs'); var parser = _interopRequireWildcard(_fs);
2401
2402
 
2402
2403
  // package.json
2403
- var version = "0.32.4";
2404
+ var version = "0.33.0";
2404
2405
 
2405
2406
  // node/themes.ts
2406
2407
  _chunkFFZLS6QKjs.init_cjs_shims.call(void 0, );
@@ -1,6 +1,7 @@
1
1
  import {
2
- ViteSlidevPlugin
3
- } from "./chunk-CNNMHD67.mjs";
2
+ ViteSlidevPlugin,
3
+ mergeViteConfigs
4
+ } from "./chunk-C7GPMAIX.mjs";
4
5
  import {
5
6
  __commonJS,
6
7
  __dirname,
@@ -2378,12 +2379,12 @@ var require_semver2 = __commonJS({
2378
2379
  // node/server.ts
2379
2380
  init_esm_shims();
2380
2381
  import { join } from "path";
2381
- import { createServer as createViteServer, mergeConfig, resolveConfig } from "vite";
2382
+ import { createServer as createViteServer, resolveConfig } from "vite";
2382
2383
  async function createServer(options, viteConfig = {}, serverOptions = {}) {
2383
2384
  const rawConfig = await resolveConfig({}, "serve");
2384
2385
  const pluginOptions = rawConfig.slidev || {};
2385
2386
  process.env.EDITOR = process.env.EDITOR || "code";
2386
- const server = await createViteServer(mergeConfig(viteConfig, {
2387
+ const server = await createViteServer(await mergeViteConfigs(options, viteConfig, {
2387
2388
  optimizeDeps: {
2388
2389
  entries: [
2389
2390
  join(options.clientRoot, "main.ts")
@@ -2392,7 +2393,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2392
2393
  plugins: [
2393
2394
  await ViteSlidevPlugin(options, pluginOptions, serverOptions)
2394
2395
  ]
2395
- }));
2396
+ }, "serve"));
2396
2397
  return server;
2397
2398
  }
2398
2399
 
@@ -2401,7 +2402,7 @@ init_esm_shims();
2401
2402
  import * as parser from "@slidev/parser/fs";
2402
2403
 
2403
2404
  // package.json
2404
- var version = "0.32.4";
2405
+ var version = "0.33.0";
2405
2406
 
2406
2407
  // node/themes.ts
2407
2408
  init_esm_shims();
@@ -63,6 +63,7 @@ _chunkFFZLS6QKjs.init_cjs_shims.call(void 0, );
63
63
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
64
64
  var _path = require('path');
65
65
  var _utils = require('@antfu/utils');
66
+ var _vite = require('vite');
66
67
  async function getIndexHtml({ clientRoot, themeRoots, data, userRoot }) {
67
68
  var _a, _b;
68
69
  let main = await _fs.promises.readFile(_path.join.call(void 0, clientRoot, "index.html"), "utf-8");
@@ -91,6 +92,25 @@ ${(((_b = index.match(/<body>([\s\S]*?)<\/body>/im)) == null ? void 0 : _b[1]) |
91
92
  main = main.replace("__ENTRY__", _chunkFFZLS6QKjs.toAtFS.call(void 0, _path.join.call(void 0, clientRoot, "main.ts"))).replace("<!-- head -->", head).replace("<!-- body -->", body);
92
93
  return main;
93
94
  }
95
+ async function mergeViteConfigs({ addonRoots, themeRoots }, viteConfig, config, command) {
96
+ const configEnv = {
97
+ mode: "development",
98
+ command
99
+ };
100
+ const files = _utils.uniq.call(void 0, [
101
+ ...themeRoots,
102
+ ...addonRoots
103
+ ]).map((i) => _path.join.call(void 0, i, "vite.config.ts"));
104
+ for await (const file of files) {
105
+ if (!_fs.existsSync.call(void 0, file))
106
+ continue;
107
+ const viteConfig2 = await _vite.loadConfigFromFile.call(void 0, configEnv, file);
108
+ if (!(viteConfig2 == null ? void 0 : viteConfig2.config))
109
+ continue;
110
+ config = _vite.mergeConfig.call(void 0, config, viteConfig2.config);
111
+ }
112
+ return _vite.mergeConfig.call(void 0, viteConfig, config);
113
+ }
94
114
 
95
115
  // node/plugins/windicss.ts
96
116
  _chunkFFZLS6QKjs.init_cjs_shims.call(void 0, );
@@ -164,12 +184,12 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
164
184
  },
165
185
  onOptionsResolved(config2) {
166
186
  themeRoots.forEach((i) => {
167
- config2.scanOptions.include.push(`${i}/components/*.{vue,ts}`);
168
- config2.scanOptions.include.push(`${i}/layouts/*.{vue,ts}`);
187
+ config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
188
+ config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
169
189
  });
170
190
  addonRoots.forEach((i) => {
171
- config2.scanOptions.include.push(`${i}/components/*.{vue,ts}`);
172
- config2.scanOptions.include.push(`${i}/layouts/*.{vue,ts}`);
191
+ config2.scanOptions.include.push(`${i}/components/**/*.{vue,ts}`);
192
+ config2.scanOptions.include.push(`${i}/layouts/**/*.{vue,ts}`);
173
193
  });
174
194
  config2.scanOptions.include.push(`!${_utils.slash.call(void 0, _path.resolve.call(void 0, userRoot, "node_modules"))}`);
175
195
  config2.scanOptions.exclude.push(_path.dirname.call(void 0, _chunkFFZLS6QKjs.resolveImportPath.call(void 0, "monaco-editor/package.json", true)));
@@ -182,9 +202,9 @@ async function createWindiCSSPlugin({ themeRoots, addonRoots, clientRoot, userRo
182
202
  // node/plugins/preset.ts
183
203
  _chunkFFZLS6QKjs.init_cjs_shims.call(void 0, );
184
204
  var _pluginvue = require('@vitejs/plugin-vue'); var _pluginvue2 = _interopRequireDefault(_pluginvue);
185
- var _vite = require('unplugin-icons/vite'); var _vite2 = _interopRequireDefault(_vite);
205
+ var _vite3 = require('unplugin-icons/vite'); var _vite4 = _interopRequireDefault(_vite3);
186
206
  var _resolver = require('unplugin-icons/resolver'); var _resolver2 = _interopRequireDefault(_resolver);
187
- var _vite3 = require('unplugin-vue-components/vite'); var _vite4 = _interopRequireDefault(_vite3);
207
+ var _vite5 = require('unplugin-vue-components/vite'); var _vite6 = _interopRequireDefault(_vite5);
188
208
  var _vitepluginremoteassets = require('vite-plugin-remote-assets'); var _vitepluginremoteassets2 = _interopRequireDefault(_vitepluginremoteassets);
189
209
  var _vitepluginvueserverref = require('vite-plugin-vue-server-ref'); var _vitepluginvueserverref2 = _interopRequireDefault(_vitepluginvueserverref);
190
210
 
@@ -238,7 +258,7 @@ ${value}
238
258
  // node/plugins/extendConfig.ts
239
259
  _chunkFFZLS6QKjs.init_cjs_shims.call(void 0, );
240
260
 
241
- var _vite5 = require('vite');
261
+
242
262
  var _isinstalledglobally = require('is-installed-globally'); var _isinstalledglobally2 = _interopRequireDefault(_isinstalledglobally);
243
263
 
244
264
 
@@ -369,7 +389,7 @@ function createConfigPlugin(options) {
369
389
  injection.root = options.cliRoot;
370
390
  injection.resolve.alias.vue = `${_chunkFFZLS6QKjs.resolveImportPath.call(void 0, "vue/dist/vue.esm-browser.js", true)}`;
371
391
  }
372
- return _vite5.mergeConfig.call(void 0, config, injection);
392
+ return _vite.mergeConfig.call(void 0, config, injection);
373
393
  },
374
394
  configureServer(server) {
375
395
  return () => {
@@ -733,7 +753,7 @@ defineProps<{ no: number | string }>()`);
733
753
  clientRoot
734
754
  ]);
735
755
  for (const root of roots2) {
736
- const layoutPaths = await _fastglob2.default.call(void 0, "layouts/*.{vue,ts}", {
756
+ const layoutPaths = await _fastglob2.default.call(void 0, "layouts/**/*.{vue,ts}", {
737
757
  cwd: root,
738
758
  absolute: true
739
759
  });
@@ -806,16 +826,11 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
806
826
  return void 0;
807
827
  imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
808
828
  const additions = {
809
- slide: {
810
- start: i.start,
811
- end: i.end,
812
- note: i.note,
829
+ slide: _chunkFFZLS6QKjs.__spreadProps.call(void 0, _chunkFFZLS6QKjs.__spreadValues.call(void 0, {}, prepareSlideInfo(i)), {
813
830
  filepath: ((_b = i.source) == null ? void 0 : _b.filepath) || entry,
814
831
  id: idx,
815
- no,
816
- title: i.title,
817
- level: i.level
818
- },
832
+ no
833
+ }),
819
834
  __clicksElements: [],
820
835
  __preloaded: false
821
836
  };
@@ -907,7 +922,7 @@ function createMonacoTypesLoader() {
907
922
  const match = id.match(/^\/\@slidev-monaco-types\/(.*)$/);
908
923
  if (match) {
909
924
  const pkg = match[1];
910
- const info = _vite5.resolvePackageData.call(void 0, pkg, process.cwd());
925
+ const info = _vite.resolvePackageData.call(void 0, pkg, process.cwd());
911
926
  if (!info)
912
927
  return;
913
928
  const typePath = info.data.types || info.data.typings;
@@ -1488,7 +1503,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1488
1503
  MarkdownPlugin,
1489
1504
  VuePlugin,
1490
1505
  createSlidesLoader(options, pluginOptions, serverOptions, VuePlugin, MarkdownPlugin),
1491
- _vite4.default.call(void 0, _chunkFFZLS6QKjs.__spreadValues.call(void 0, {
1506
+ _vite6.default.call(void 0, _chunkFFZLS6QKjs.__spreadValues.call(void 0, {
1492
1507
  extensions: ["vue", "md", "ts"],
1493
1508
  dirs: [
1494
1509
  `${clientRoot}/builtin`,
@@ -1507,7 +1522,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1507
1522
  })
1508
1523
  ]
1509
1524
  }, componentsOptions)),
1510
- _vite2.default.call(void 0, _chunkFFZLS6QKjs.__spreadValues.call(void 0, {
1525
+ _vite4.default.call(void 0, _chunkFFZLS6QKjs.__spreadValues.call(void 0, {
1511
1526
  defaultClass: "slidev-icon",
1512
1527
  autoInstall: true
1513
1528
  }, iconsOptions)),
@@ -1552,4 +1567,5 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1552
1567
 
1553
1568
 
1554
1569
 
1555
- exports.getIndexHtml = getIndexHtml; exports.require_fast_deep_equal = require_fast_deep_equal; exports.createWindiCSSPlugin = createWindiCSSPlugin; exports.ViteSlidevPlugin = ViteSlidevPlugin;
1570
+
1571
+ exports.getIndexHtml = getIndexHtml; exports.mergeViteConfigs = mergeViteConfigs; exports.require_fast_deep_equal = require_fast_deep_equal; exports.createWindiCSSPlugin = createWindiCSSPlugin; exports.ViteSlidevPlugin = ViteSlidevPlugin;
package/dist/cli.js CHANGED
@@ -6,10 +6,10 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkERHEJGU7js = require('./chunk-ERHEJGU7.js');
9
+ var _chunkJQEMHC65js = require('./chunk-JQEMHC65.js');
10
10
 
11
11
 
12
- var _chunkKFVTOCEDjs = require('./chunk-KFVTOCED.js');
12
+ var _chunkUNBXPUSGjs = require('./chunk-UNBXPUSG.js');
13
13
 
14
14
 
15
15
 
@@ -18,7 +18,7 @@ var _chunkFFZLS6QKjs = require('./chunk-FFZLS6QK.js');
18
18
 
19
19
  // node/cli.ts
20
20
  _chunkFFZLS6QKjs.init_cjs_shims.call(void 0, );
21
- var import_fast_deep_equal = _chunkFFZLS6QKjs.__toESM.call(void 0, _chunkKFVTOCEDjs.require_fast_deep_equal.call(void 0, ));
21
+ var import_fast_deep_equal = _chunkFFZLS6QKjs.__toESM.call(void 0, _chunkUNBXPUSGjs.require_fast_deep_equal.call(void 0, ));
22
22
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
23
23
  var _net = require('net'); var _net2 = _interopRequireDefault(_net);
24
24
  var _os = require('os'); var _os2 = _interopRequireDefault(_os);
@@ -36,7 +36,7 @@ var CONFIG_RESTART_FIELDS = [
36
36
  "routerMode",
37
37
  "fonts"
38
38
  ];
39
- var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkERHEJGU7js.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
39
+ var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkJQEMHC65js.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
40
40
  cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOptions(args).option("port", {
41
41
  alias: "p",
42
42
  type: "number",
@@ -79,9 +79,9 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
79
79
  async function initServer() {
80
80
  if (server)
81
81
  await server.close();
82
- const options = await _chunkERHEJGU7js.resolveOptions.call(void 0, { entry, remote, theme }, "dev");
82
+ const options = await _chunkJQEMHC65js.resolveOptions.call(void 0, { entry, remote, theme }, "dev");
83
83
  port = userPort || await findFreePort(3030);
84
- server = await _chunkERHEJGU7js.createServer.call(void 0, options, {
84
+ server = await _chunkJQEMHC65js.createServer.call(void 0, options, {
85
85
  server: {
86
86
  port,
87
87
  strictPort: true,
@@ -92,7 +92,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
92
92
  logLevel: log
93
93
  }, {
94
94
  onDataReload(newData, data) {
95
- if (!theme && _chunkERHEJGU7js.resolveThemeName.call(void 0, newData.config.theme) !== _chunkERHEJGU7js.resolveThemeName.call(void 0, data.config.theme)) {
95
+ if (!theme && _chunkJQEMHC65js.resolveThemeName.call(void 0, newData.config.theme) !== _chunkJQEMHC65js.resolveThemeName.call(void 0, data.config.theme)) {
96
96
  console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
97
97
  initServer();
98
98
  } else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
@@ -168,8 +168,8 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
168
168
  type: "boolean",
169
169
  describe: "allow download as PDF"
170
170
  }).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
171
- const { build } = await Promise.resolve().then(() => _chunkFFZLS6QKjs.__toESM.call(void 0, _chunkFFZLS6QKjs.__require.call(void 0, "./build-SKQZLTIO.js")));
172
- const options = await _chunkERHEJGU7js.resolveOptions.call(void 0, { entry, theme }, "build");
171
+ const { build } = await Promise.resolve().then(() => _chunkFFZLS6QKjs.__toESM.call(void 0, _chunkFFZLS6QKjs.__require.call(void 0, "./build-JMQRM5SA.js")));
172
+ const options = await _chunkJQEMHC65js.resolveOptions.call(void 0, { entry, theme }, "build");
173
173
  if (download && !options.data.config.download)
174
174
  options.data.config.download = download;
175
175
  printInfo(options);
@@ -182,26 +182,26 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
182
182
  });
183
183
  });
184
184
  cli.command("format [entry]", "Format the markdown file", (args) => commonOptions(args).strict().help(), async ({ entry }) => {
185
- const data = await _chunkERHEJGU7js.parser.load(entry);
186
- _chunkERHEJGU7js.parser.prettify(data);
187
- await _chunkERHEJGU7js.parser.save(data);
185
+ const data = await _chunkJQEMHC65js.parser.load(entry);
186
+ _chunkJQEMHC65js.parser.prettify(data);
187
+ await _chunkJQEMHC65js.parser.save(data);
188
188
  });
189
189
  cli.command("theme [subcommand]", "Theme related operations", (command) => {
190
190
  return command.command("eject", "Eject current theme into local file system", (args) => commonOptions(args).option("dir", {
191
191
  type: "string",
192
192
  default: "theme"
193
193
  }), async ({ entry, dir, theme: themeInput }) => {
194
- const data = await _chunkERHEJGU7js.parser.load(entry);
195
- const theme = _chunkERHEJGU7js.resolveThemeName.call(void 0, themeInput || data.config.theme);
194
+ const data = await _chunkJQEMHC65js.parser.load(entry);
195
+ const theme = _chunkJQEMHC65js.resolveThemeName.call(void 0, themeInput || data.config.theme);
196
196
  if (theme === "none") {
197
197
  console.error('Can not eject theme "none"');
198
198
  process.exit(1);
199
199
  }
200
- if (_chunkERHEJGU7js.isPath.call(void 0, theme)) {
200
+ if (_chunkJQEMHC65js.isPath.call(void 0, theme)) {
201
201
  console.error("Theme is already ejected");
202
202
  process.exit(1);
203
203
  }
204
- const roots = _chunkERHEJGU7js.getThemeRoots.call(void 0, theme, entry);
204
+ const roots = _chunkJQEMHC65js.getThemeRoots.call(void 0, theme, entry);
205
205
  if (!roots.length) {
206
206
  console.error(`Does not found theme "${theme}"`);
207
207
  process.exit(1);
@@ -213,7 +213,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
213
213
  const dirPath = `./${dir}`;
214
214
  data.slides[0].frontmatter.theme = dirPath;
215
215
  data.slides[0].raw = null;
216
- await _chunkERHEJGU7js.parser.save(data);
216
+ await _chunkJQEMHC65js.parser.save(data);
217
217
  console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
218
218
  });
219
219
  }, () => {
@@ -257,15 +257,15 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
257
257
  process.env.NODE_ENV = "production";
258
258
  const { exportSlides } = await Promise.resolve().then(() => _chunkFFZLS6QKjs.__toESM.call(void 0, _chunkFFZLS6QKjs.__require.call(void 0, "./export-LOKLMK66.js")));
259
259
  const port = await findFreePort(12445);
260
- const options = await _chunkERHEJGU7js.resolveOptions.call(void 0, { entry, theme }, "build");
260
+ const options = await _chunkJQEMHC65js.resolveOptions.call(void 0, { entry, theme }, "build");
261
261
  output = output || options.data.config.exportFilename || `${_path2.default.basename(entry, ".md")}-export`;
262
- const server = await _chunkERHEJGU7js.createServer.call(void 0, options, {
262
+ const server = await _chunkJQEMHC65js.createServer.call(void 0, options, {
263
263
  server: { port },
264
264
  clearScreen: false
265
265
  });
266
266
  await server.listen(port);
267
267
  printInfo(options);
268
- _chunkERHEJGU7js.parser.filterDisabled(options.data);
268
+ _chunkJQEMHC65js.parser.filterDisabled(options.data);
269
269
  const width = options.data.config.canvasWidth;
270
270
  const height = Math.round(width / options.data.config.aspectRatio);
271
271
  output = await exportSlides({
@@ -303,7 +303,7 @@ function printInfo(options, port, remote) {
303
303
  console.log();
304
304
  console.log();
305
305
  console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
306
- console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkERHEJGU7js.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
306
+ console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkJQEMHC65js.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
307
307
  console.log();
308
308
  console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
309
309
  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));
@@ -316,7 +316,7 @@ function printInfo(options, port, remote) {
316
316
  console.log(`${_kolorist.dim.call(void 0, " private slide show ")} > ${_kolorist.cyan.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}/${query}`)}`);
317
317
  console.log(`${_kolorist.dim.call(void 0, " presenter mode ")} > ${_kolorist.blue.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}${presenterPath}`)}`);
318
318
  if (remote !== void 0) {
319
- Object.values(_os2.default.networkInterfaces()).forEach((v) => (v || []).filter((details) => details.family === "IPv4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
319
+ Object.values(_os2.default.networkInterfaces()).forEach((v) => (v || []).filter((details) => String(details.family).slice(-1) === "4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
320
320
  console.log(`${_kolorist.dim.call(void 0, " remote control ")} > ${_kolorist.blue.call(void 0, `http://${address}:${port}${presenterPath}`)}`);
321
321
  }));
322
322
  } else {
package/dist/cli.mjs CHANGED
@@ -6,10 +6,10 @@ import {
6
6
  resolveOptions,
7
7
  resolveThemeName,
8
8
  version
9
- } from "./chunk-STSGOSM4.mjs";
9
+ } from "./chunk-ORQ3SHUX.mjs";
10
10
  import {
11
11
  require_fast_deep_equal
12
- } from "./chunk-CNNMHD67.mjs";
12
+ } from "./chunk-C7GPMAIX.mjs";
13
13
  import {
14
14
  __dirname,
15
15
  __require,
@@ -169,7 +169,7 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
169
169
  type: "boolean",
170
170
  describe: "allow download as PDF"
171
171
  }).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
172
- const { build } = await Promise.resolve().then(() => __toESM(__require("./build-O7J6JH7N.mjs")));
172
+ const { build } = await Promise.resolve().then(() => __toESM(__require("./build-P4Q57V2J.mjs")));
173
173
  const options = await resolveOptions({ entry, theme }, "build");
174
174
  if (download && !options.data.config.download)
175
175
  options.data.config.download = download;
@@ -317,7 +317,7 @@ function printInfo(options, port, remote) {
317
317
  console.log(`${dim(" private slide show ")} > ${cyan(`http://localhost:${bold(port)}/${query}`)}`);
318
318
  console.log(`${dim(" presenter mode ")} > ${blue(`http://localhost:${bold(port)}${presenterPath}`)}`);
319
319
  if (remote !== void 0) {
320
- Object.values(os.networkInterfaces()).forEach((v) => (v || []).filter((details) => details.family === "IPv4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
320
+ Object.values(os.networkInterfaces()).forEach((v) => (v || []).filter((details) => String(details.family).slice(-1) === "4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
321
321
  console.log(`${dim(" remote control ")} > ${blue(`http://${address}:${port}${presenterPath}`)}`);
322
322
  }));
323
323
  } else {
package/dist/index.js CHANGED
@@ -9,11 +9,11 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkERHEJGU7js = require('./chunk-ERHEJGU7.js');
12
+ var _chunkJQEMHC65js = require('./chunk-JQEMHC65.js');
13
13
 
14
14
 
15
15
 
16
- var _chunkKFVTOCEDjs = require('./chunk-KFVTOCED.js');
16
+ var _chunkUNBXPUSGjs = require('./chunk-UNBXPUSG.js');
17
17
 
18
18
 
19
19
  var _chunkFFZLS6QKjs = require('./chunk-FFZLS6QK.js');
@@ -36,4 +36,4 @@ _chunkFFZLS6QKjs.init_cjs_shims.call(void 0, );
36
36
 
37
37
 
38
38
 
39
- exports.ViteSlidevPlugin = _chunkKFVTOCEDjs.ViteSlidevPlugin; exports.createServer = _chunkERHEJGU7js.createServer; exports.createWindiCSSPlugin = _chunkKFVTOCEDjs.createWindiCSSPlugin; exports.getAddonRoots = _chunkERHEJGU7js.getAddonRoots; exports.getCLIRoot = _chunkERHEJGU7js.getCLIRoot; exports.getClientRoot = _chunkERHEJGU7js.getClientRoot; exports.getRoot = _chunkERHEJGU7js.getRoot; exports.getThemeRoots = _chunkERHEJGU7js.getThemeRoots; exports.getUserRoot = _chunkERHEJGU7js.getUserRoot; exports.isPath = _chunkERHEJGU7js.isPath; exports.parser = _chunkERHEJGU7js.parser; exports.resolveOptions = _chunkERHEJGU7js.resolveOptions;
39
+ exports.ViteSlidevPlugin = _chunkUNBXPUSGjs.ViteSlidevPlugin; exports.createServer = _chunkJQEMHC65js.createServer; exports.createWindiCSSPlugin = _chunkUNBXPUSGjs.createWindiCSSPlugin; exports.getAddonRoots = _chunkJQEMHC65js.getAddonRoots; exports.getCLIRoot = _chunkJQEMHC65js.getCLIRoot; exports.getClientRoot = _chunkJQEMHC65js.getClientRoot; exports.getRoot = _chunkJQEMHC65js.getRoot; exports.getThemeRoots = _chunkJQEMHC65js.getThemeRoots; exports.getUserRoot = _chunkJQEMHC65js.getUserRoot; exports.isPath = _chunkJQEMHC65js.isPath; exports.parser = _chunkJQEMHC65js.parser; exports.resolveOptions = _chunkJQEMHC65js.resolveOptions;
package/dist/index.mjs CHANGED
@@ -9,11 +9,11 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-STSGOSM4.mjs";
12
+ } from "./chunk-ORQ3SHUX.mjs";
13
13
  import {
14
14
  ViteSlidevPlugin,
15
15
  createWindiCSSPlugin
16
- } from "./chunk-CNNMHD67.mjs";
16
+ } from "./chunk-C7GPMAIX.mjs";
17
17
  import {
18
18
  init_esm_shims
19
19
  } from "./chunk-ZWCVPYOA.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.32.4",
3
+ "version": "0.33.0",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -45,9 +45,9 @@
45
45
  "@antfu/utils": "^0.5.2",
46
46
  "@iconify-json/carbon": "^1.1.5",
47
47
  "@iconify-json/ph": "^1.1.1",
48
- "@slidev/client": "0.32.4",
49
- "@slidev/parser": "0.32.4",
50
- "@slidev/types": "0.32.4",
48
+ "@slidev/client": "0.33.0",
49
+ "@slidev/parser": "0.33.0",
50
+ "@slidev/types": "0.33.0",
51
51
  "@vitejs/plugin-vue": "^2.3.3",
52
52
  "@vue/compiler-sfc": "^3.2.36",
53
53
  "cli-progress": "^3.11.1",
@@ -79,7 +79,7 @@
79
79
  "unplugin-icons": "^0.14.3",
80
80
  "unplugin-vue-components": "^0.19.6",
81
81
  "vite": "^2.9.9",
82
- "vite-plugin-md": "^0.14.0",
82
+ "vite-plugin-md": "^0.13.1",
83
83
  "vite-plugin-remote-assets": "^0.2.2",
84
84
  "vite-plugin-vue-server-ref": "^0.2.4",
85
85
  "vite-plugin-windicss": "^1.8.4",