@slidev/cli 0.35.6 → 0.36.2

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.
@@ -9,7 +9,7 @@ import {
9
9
  resolveImportPath,
10
10
  stringifyMarkdownTokens,
11
11
  toAtFS
12
- } from "./chunk-57E5R3IA.mjs";
12
+ } from "./chunk-IAMILGBS.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({
@@ -211,6 +211,7 @@ import Components from "unplugin-vue-components/vite";
211
211
  import RemoteAssets, { DefaultRules } from "vite-plugin-remote-assets";
212
212
  import ServerRef from "vite-plugin-vue-server-ref";
213
213
  import { notNullish as notNullish2 } from "@antfu/utils";
214
+ import Inspect from "vite-plugin-inspect";
214
215
 
215
216
  // node/drawings.ts
216
217
  init_esm_shims();
@@ -218,7 +219,10 @@ import { basename, dirname as dirname2, join as join2, resolve as resolve3 } fro
218
219
  import fs2 from "fs-extra";
219
220
  import fg from "fast-glob";
220
221
  function resolveDrawingsDir(options) {
221
- return options.data.config.drawings.persist ? resolve3(dirname2(options.entry), options.data.config.drawings.persist) : void 0;
222
+ return options.data.config.drawings.persist ? resolve3(
223
+ dirname2(options.entry),
224
+ options.data.config.drawings.persist
225
+ ) : void 0;
222
226
  }
223
227
  async function loadDrawings(options) {
224
228
  const dir = resolveDrawingsDir(options);
@@ -273,11 +277,11 @@ var dependencies = {
273
277
  "@antfu/utils": "^0.5.2",
274
278
  "@slidev/parser": "workspace:*",
275
279
  "@slidev/types": "workspace:*",
276
- "@unocss/reset": "^0.45.14",
277
- "@vueuse/core": "^9.1.1",
278
- "@vueuse/head": "^0.7.9",
279
- "@vueuse/math": "^9.1.1",
280
- "@vueuse/motion": "^2.0.0-beta.18",
280
+ "@unocss/reset": "^0.45.20",
281
+ "@vueuse/core": "^9.2.0",
282
+ "@vueuse/head": "^0.7.10",
283
+ "@vueuse/math": "^9.2.0",
284
+ "@vueuse/motion": "^2.0.0-beta.22",
281
285
  codemirror: "^5.65.5",
282
286
  defu: "^6.1.0",
283
287
  drauu: "^0.3.1",
@@ -291,9 +295,9 @@ var dependencies = {
291
295
  prettier: "^2.7.1",
292
296
  recordrtc: "^5.6.2",
293
297
  resolve: "^1.22.1",
294
- unocss: "^0.45.14",
295
- "vite-plugin-windicss": "^1.8.7",
296
- vue: "^3.2.38",
298
+ unocss: "^0.45.20",
299
+ "vite-plugin-windicss": "^1.8.8",
300
+ vue: "^3.2.39",
297
301
  "vue-router": "^4.1.5",
298
302
  "vue-starport": "^0.3.0",
299
303
  windicss: "^3.5.6"
@@ -564,8 +568,9 @@ function createSlidesLoader({ data, entry, clientRoot, themeRoots, addonRoots, u
564
568
  var _a2;
565
569
  const file = `${slidePrefix}${i + 1}.md`;
566
570
  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({
571
+ const md2 = await transformMarkdown((await MarkdownPlugin.transform((_a2 = newData.slides[i]) == null ? void 0 : _a2.content, file)).code, i, newData);
572
+ const handleHotUpdate = "handler" in VuePlugin.handleHotUpdate ? VuePlugin.handleHotUpdate.handler : VuePlugin.handleHotUpdate;
573
+ return await handleHotUpdate({
569
574
  ...ctx,
570
575
  modules: Array.from(ctx.server.moduleGraph.getModulesByFile(file) || []),
571
576
  file,
@@ -1002,10 +1007,13 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
1002
1007
  enforce: "pre",
1003
1008
  async transform(code, id) {
1004
1009
  if (id.startsWith(setupEntry)) {
1010
+ let getInjections2 = function(isAwait = false, isChained = false) {
1011
+ return injections.join("\n").replace(/:AWAIT:/g, isAwait ? "await " : "").replace(/(,\s*)?:LAST:/g, isChained ? "$1injection_return" : "");
1012
+ };
1013
+ var getInjections = getInjections2;
1005
1014
  const name = id.slice(setupEntry.length + 1);
1006
1015
  const imports = [];
1007
1016
  const injections = [];
1008
- const asyncInjections = [];
1009
1017
  const setups = uniq5([
1010
1018
  ...themeRoots,
1011
1019
  ...addonRoots,
@@ -1015,41 +1023,28 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
1015
1023
  if (!existsSync5(path))
1016
1024
  return;
1017
1025
  imports.push(`import __n${idx} from '${toAtFS(path)}'`);
1018
- let fn = `__n${idx}`;
1019
- let awaitFn = `await __n${idx}`;
1020
- if (/\binjection_return\b/g.test(code)) {
1026
+ let fn = `:AWAIT:__n${idx}`;
1027
+ if (/\binjection_return\b/g.test(code))
1021
1028
  fn = `injection_return = ${fn}`;
1022
- awaitFn = `injection_return = ${awaitFn}`;
1023
- }
1024
1029
  if (/\binjection_arg\b/g.test(code)) {
1025
1030
  fn += "(";
1026
- awaitFn += "(";
1027
1031
  const matches = Array.from(code.matchAll(/\binjection_arg(_\d+)?\b/g));
1028
1032
  const dedupedMatches = Array.from(new Set(matches.map((m) => m[0])));
1029
- dedupedMatches.forEach((key, index) => {
1030
- const isLast = index === dedupedMatches.length - 1;
1031
- const arg = key + (isLast ? "" : ",");
1032
- fn += arg;
1033
- awaitFn += arg;
1034
- });
1035
- fn += ")";
1036
- awaitFn += ")";
1033
+ fn += dedupedMatches.join(", ");
1034
+ fn += ", :LAST:)";
1037
1035
  } else {
1038
- fn += "()";
1039
- awaitFn += "()";
1036
+ fn += "(:LAST:)";
1040
1037
  }
1041
1038
  injections.push(
1042
1039
  `// ${path}`,
1043
1040
  fn
1044
1041
  );
1045
- asyncInjections.push(
1046
- `// ${path}`,
1047
- awaitFn
1048
- );
1049
1042
  });
1050
1043
  code = code.replace("/* __imports__ */", imports.join("\n"));
1051
- code = code.replace("/* __injections__ */", injections.join("\n"));
1052
- code = code.replace("/* __async_injections__ */", asyncInjections.join("\n"));
1044
+ code = code.replace("/* __injections__ */", getInjections2());
1045
+ code = code.replace("/* __async_injections__ */", getInjections2(true));
1046
+ code = code.replace("/* __chained_injections__ */", getInjections2(false, true));
1047
+ code = code.replace("/* __chained_async_injections__ */", getInjections2(true, true));
1053
1048
  return code;
1054
1049
  }
1055
1050
  return null;
@@ -1505,11 +1500,13 @@ function createFixPlugins(options) {
1505
1500
  name: "slidev:flags",
1506
1501
  enforce: "pre",
1507
1502
  transform(code, id) {
1508
- if (id.endsWith(".vue")) {
1503
+ if (id.match(/\.vue($|\?)/)) {
1504
+ const original = code;
1509
1505
  define.forEach(([from, to]) => {
1510
1506
  code = code.replace(new RegExp(from, "g"), to);
1511
1507
  });
1512
- return code;
1508
+ if (original !== code)
1509
+ return code;
1513
1510
  }
1514
1511
  }
1515
1512
  }
@@ -1670,7 +1667,11 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
1670
1667
  createConfigPlugin(options),
1671
1668
  createClientSetupPlugin(options),
1672
1669
  createMonacoTypesLoader(),
1673
- createFixPlugins(options)
1670
+ createFixPlugins(options),
1671
+ options.inspect ? Inspect({
1672
+ dev: true,
1673
+ build: true
1674
+ }) : null
1674
1675
  ].flat().filter(notNullish2);
1675
1676
  }
1676
1677
 
@@ -58,12 +58,12 @@ var __privateWrapper = (obj, member, setter, getter) => {
58
58
  };
59
59
  };
60
60
 
61
- // ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.2/node_modules/tsup/assets/esm_shims.js
61
+ // ../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.3/node_modules/tsup/assets/esm_shims.js
62
62
  import { fileURLToPath } from "url";
63
63
  import path from "path";
64
64
  var getFilename, getDirname, __dirname, __filename;
65
65
  var init_esm_shims = __esm({
66
- "../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.2/node_modules/tsup/assets/esm_shims.js"() {
66
+ "../../node_modules/.pnpm/tsup@5.12.9_typescript@4.8.3/node_modules/tsup/assets/esm_shims.js"() {
67
67
  getFilename = () => fileURLToPath(import.meta.url);
68
68
  getDirname = () => path.dirname(getFilename());
69
69
  __dirname = /* @__PURE__ */ getDirname();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-IY7QSYZ2.mjs";
4
+ } from "./chunk-GVIE4JZ6.mjs";
5
5
  import {
6
6
  __commonJS,
7
7
  __dirname,
@@ -13,7 +13,7 @@ import {
13
13
  init_esm_shims,
14
14
  packageExists,
15
15
  resolveImportPath
16
- } from "./chunk-57E5R3IA.mjs";
16
+ } from "./chunk-IAMILGBS.mjs";
17
17
 
18
18
  // ../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/internal/constants.js
19
19
  var require_constants = __commonJS({
@@ -2383,7 +2383,7 @@ init_esm_shims();
2383
2383
  import { join } from "path";
2384
2384
  import { createServer as createViteServer, resolveConfig } from "vite";
2385
2385
  async function createServer(options, viteConfig = {}, serverOptions = {}) {
2386
- const rawConfig = await resolveConfig({}, "serve");
2386
+ const rawConfig = await resolveConfig({}, "serve", options.entry);
2387
2387
  const pluginOptions = rawConfig.slidev || {};
2388
2388
  process.env.EDITOR = process.env.EDITOR || "code";
2389
2389
  const server = await createViteServer(
@@ -2411,7 +2411,7 @@ init_esm_shims();
2411
2411
  import * as parser from "@slidev/parser/fs";
2412
2412
 
2413
2413
  // package.json
2414
- var version = "0.35.6";
2414
+ var version = "0.36.2";
2415
2415
 
2416
2416
  // node/themes.ts
2417
2417
  init_esm_shims();
@@ -9634,7 +9634,7 @@ function getUserRoot(options) {
9634
9634
  return { entry: fullEntry, userRoot: dirname(fullEntry) };
9635
9635
  }
9636
9636
  async function resolveOptions(options, mode2, promptForInstallation = true) {
9637
- const { remote } = options;
9637
+ const { remote, inspect } = options;
9638
9638
  const {
9639
9639
  entry,
9640
9640
  userRoot
@@ -9660,7 +9660,7 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
9660
9660
  const themeMeta = await getThemeMeta(theme, join2(themeRoots[0], "package.json"));
9661
9661
  data.themeMeta = themeMeta;
9662
9662
  if (themeMeta)
9663
- data.config = parser.resolveConfig(data.headmatter, themeMeta);
9663
+ data.config = parser.resolveConfig(data.headmatter, themeMeta, options.entry);
9664
9664
  }
9665
9665
  debug({
9666
9666
  config: data.config,
@@ -9686,7 +9686,8 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
9686
9686
  themeRoots,
9687
9687
  addonRoots,
9688
9688
  roots,
9689
- remote
9689
+ remote,
9690
+ inspect
9690
9691
  };
9691
9692
  }
9692
9693
 
package/dist/cli.js CHANGED
@@ -6,19 +6,19 @@
6
6
 
7
7
 
8
8
 
9
- var _chunk4UR3M5JDjs = require('./chunk-4UR3M5JD.js');
9
+ var _chunkF44MX6U6js = require('./chunk-F44MX6U6.js');
10
10
 
11
11
 
12
- var _chunkYUXTNPKAjs = require('./chunk-YUXTNPKA.js');
12
+ var _chunkDAM7DDLQjs = require('./chunk-DAM7DDLQ.js');
13
13
 
14
14
 
15
15
 
16
16
 
17
- var _chunkAW7KQET4js = require('./chunk-AW7KQET4.js');
17
+ var _chunk74QPSS6Tjs = require('./chunk-74QPSS6T.js');
18
18
 
19
19
  // node/cli.ts
20
- _chunkAW7KQET4js.init_cjs_shims.call(void 0, );
21
- var import_fast_deep_equal = _chunkAW7KQET4js.__toESM.call(void 0, _chunkYUXTNPKAjs.require_fast_deep_equal.call(void 0, ));
20
+ _chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
21
+ var import_fast_deep_equal = _chunk74QPSS6Tjs.__toESM.call(void 0, _chunkDAM7DDLQjs.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);
@@ -38,7 +38,7 @@ var CONFIG_RESTART_FIELDS = [
38
38
  "fonts",
39
39
  "css"
40
40
  ];
41
- var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunk4UR3M5JDjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
41
+ var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkF44MX6U6js.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
42
42
  cli.command(
43
43
  "* [entry]",
44
44
  "Start a local server for Slidev",
@@ -59,13 +59,17 @@ cli.command(
59
59
  type: "string",
60
60
  choices: ["error", "warn", "info", "silent"],
61
61
  describe: "log level"
62
+ }).option("inspect", {
63
+ default: false,
64
+ type: "boolean",
65
+ describe: "enable the inspect plugin for debugging"
62
66
  }).option("force", {
63
67
  alias: "f",
64
68
  default: false,
65
69
  type: "boolean",
66
70
  describe: "force the optimizer to ignore the cache and re-bundle "
67
71
  }).strict().help(),
68
- async ({ entry, theme, port: userPort, open, log, remote, force }) => {
72
+ async ({ entry, theme, port: userPort, open, log, remote, force, inspect }) => {
69
73
  if (!_fsextra2.default.existsSync(entry) && !entry.endsWith(".md"))
70
74
  entry = `${entry}.md`;
71
75
  if (!_fsextra2.default.existsSync(entry)) {
@@ -85,9 +89,9 @@ cli.command(
85
89
  async function initServer() {
86
90
  if (server)
87
91
  await server.close();
88
- const options = await _chunk4UR3M5JDjs.resolveOptions.call(void 0, { entry, remote, theme }, "dev");
92
+ const options = await _chunkF44MX6U6js.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
89
93
  port = userPort || await findFreePort(3030);
90
- server = await _chunk4UR3M5JDjs.createServer.call(void 0,
94
+ server = await _chunkF44MX6U6js.createServer.call(void 0,
91
95
  options,
92
96
  {
93
97
  server: {
@@ -101,7 +105,7 @@ cli.command(
101
105
  },
102
106
  {
103
107
  onDataReload(newData, data) {
104
- if (!theme && _chunk4UR3M5JDjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunk4UR3M5JDjs.resolveThemeName.call(void 0, data.config.theme)) {
108
+ if (!theme && _chunkF44MX6U6js.resolveThemeName.call(void 0, newData.config.theme) !== _chunkF44MX6U6js.resolveThemeName.call(void 0, data.config.theme)) {
105
109
  console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
106
110
  initServer();
107
111
  } else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
@@ -181,10 +185,14 @@ cli.command(
181
185
  alias: "d",
182
186
  type: "boolean",
183
187
  describe: "allow download as PDF"
188
+ }).option("inspect", {
189
+ default: false,
190
+ type: "boolean",
191
+ describe: "enable the inspect plugin for debugging"
184
192
  }).strict().help(),
185
- async ({ entry, theme, watch, base, download, out }) => {
186
- const { build } = await Promise.resolve().then(() => _chunkAW7KQET4js.__toESM.call(void 0, _chunkAW7KQET4js.__require.call(void 0, "./build-3OBKYP4E.js")));
187
- const options = await _chunk4UR3M5JDjs.resolveOptions.call(void 0, { entry, theme }, "build");
193
+ async ({ entry, theme, watch, base, download, out, inspect }) => {
194
+ const { build } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "./build-SW7IIFF4.js")));
195
+ const options = await _chunkF44MX6U6js.resolveOptions.call(void 0, { entry, theme, inspect }, "build");
188
196
  if (download && !options.data.config.download)
189
197
  options.data.config.download = download;
190
198
  printInfo(options);
@@ -202,9 +210,9 @@ cli.command(
202
210
  "Format the markdown file",
203
211
  (args) => commonOptions(args).strict().help(),
204
212
  async ({ entry }) => {
205
- const data = await _chunk4UR3M5JDjs.parser.load(entry);
206
- _chunk4UR3M5JDjs.parser.prettify(data);
207
- await _chunk4UR3M5JDjs.parser.save(data);
213
+ const data = await _chunkF44MX6U6js.parser.load(entry);
214
+ _chunkF44MX6U6js.parser.prettify(data);
215
+ await _chunkF44MX6U6js.parser.save(data);
208
216
  }
209
217
  );
210
218
  cli.command(
@@ -219,17 +227,17 @@ cli.command(
219
227
  default: "theme"
220
228
  }),
221
229
  async ({ entry, dir, theme: themeInput }) => {
222
- const data = await _chunk4UR3M5JDjs.parser.load(entry);
223
- const theme = _chunk4UR3M5JDjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
230
+ const data = await _chunkF44MX6U6js.parser.load(entry);
231
+ const theme = _chunkF44MX6U6js.resolveThemeName.call(void 0, themeInput || data.config.theme);
224
232
  if (theme === "none") {
225
233
  console.error('Can not eject theme "none"');
226
234
  process.exit(1);
227
235
  }
228
- if (_chunk4UR3M5JDjs.isPath.call(void 0, theme)) {
236
+ if (_chunkF44MX6U6js.isPath.call(void 0, theme)) {
229
237
  console.error("Theme is already ejected");
230
238
  process.exit(1);
231
239
  }
232
- const roots = _chunk4UR3M5JDjs.getThemeRoots.call(void 0, theme, entry);
240
+ const roots = _chunkF44MX6U6js.getThemeRoots.call(void 0, theme, entry);
233
241
  if (!roots.length) {
234
242
  console.error(`Does not found theme "${theme}"`);
235
243
  process.exit(1);
@@ -241,7 +249,7 @@ cli.command(
241
249
  const dirPath = `./${dir}`;
242
250
  data.slides[0].frontmatter.theme = dirPath;
243
251
  data.slides[0].raw = null;
244
- await _chunk4UR3M5JDjs.parser.save(data);
252
+ await _chunkF44MX6U6js.parser.save(data);
245
253
  console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
246
254
  }
247
255
  );
@@ -294,11 +302,11 @@ cli.command(
294
302
  "executable-path": executablePath
295
303
  }) => {
296
304
  process.env.NODE_ENV = "production";
297
- const { exportSlides } = await Promise.resolve().then(() => _chunkAW7KQET4js.__toESM.call(void 0, _chunkAW7KQET4js.__require.call(void 0, "./export-3CTBMUMP.js")));
305
+ const { exportSlides } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "./export-WKFHZNBT.js")));
298
306
  const port = await findFreePort(12445);
299
- const options = await _chunk4UR3M5JDjs.resolveOptions.call(void 0, { entry, theme }, "build");
307
+ const options = await _chunkF44MX6U6js.resolveOptions.call(void 0, { entry, theme }, "build");
300
308
  output = output || options.data.config.exportFilename || `${_path2.default.basename(entry, ".md")}-export`;
301
- const server = await _chunk4UR3M5JDjs.createServer.call(void 0,
309
+ const server = await _chunkF44MX6U6js.createServer.call(void 0,
302
310
  options,
303
311
  {
304
312
  server: { port },
@@ -307,7 +315,7 @@ cli.command(
307
315
  );
308
316
  await server.listen(port);
309
317
  printInfo(options);
310
- _chunk4UR3M5JDjs.parser.filterDisabled(options.data);
318
+ _chunkF44MX6U6js.parser.filterDisabled(options.data);
311
319
  const width = options.data.config.canvasWidth;
312
320
  const height = Math.round(width / options.data.config.aspectRatio);
313
321
  output = await exportSlides({
@@ -347,7 +355,7 @@ function printInfo(options, port, remote) {
347
355
  console.log();
348
356
  console.log();
349
357
  console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
350
- console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunk4UR3M5JDjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
358
+ console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkF44MX6U6js.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
351
359
  console.log();
352
360
  console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
353
361
  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));
@@ -359,6 +367,8 @@ function printInfo(options, port, remote) {
359
367
  if (query)
360
368
  console.log(`${_kolorist.dim.call(void 0, " private slide show ")} > ${_kolorist.cyan.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}/${query}`)}`);
361
369
  console.log(`${_kolorist.dim.call(void 0, " presenter mode ")} > ${_kolorist.blue.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}${presenterPath}`)}`);
370
+ if (options.inspect)
371
+ console.log(`${_kolorist.dim.call(void 0, " inspector")} > ${_kolorist.yellow.call(void 0, `http://localhost:${_kolorist.bold.call(void 0, port)}/__inspect/`)}`);
362
372
  if (remote !== void 0) {
363
373
  Object.values(_os2.default.networkInterfaces()).forEach(
364
374
  (v) => (v || []).filter((details) => String(details.family).slice(-1) === "4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
package/dist/cli.mjs CHANGED
@@ -6,16 +6,16 @@ import {
6
6
  resolveOptions,
7
7
  resolveThemeName,
8
8
  version
9
- } from "./chunk-3VPTNK23.mjs";
9
+ } from "./chunk-PUJ4PVRP.mjs";
10
10
  import {
11
11
  require_fast_deep_equal
12
- } from "./chunk-IY7QSYZ2.mjs";
12
+ } from "./chunk-GVIE4JZ6.mjs";
13
13
  import {
14
14
  __dirname,
15
15
  __require,
16
16
  __toESM,
17
17
  init_esm_shims
18
- } from "./chunk-57E5R3IA.mjs";
18
+ } from "./chunk-IAMILGBS.mjs";
19
19
 
20
20
  // node/cli.ts
21
21
  init_esm_shims();
@@ -60,13 +60,17 @@ cli.command(
60
60
  type: "string",
61
61
  choices: ["error", "warn", "info", "silent"],
62
62
  describe: "log level"
63
+ }).option("inspect", {
64
+ default: false,
65
+ type: "boolean",
66
+ describe: "enable the inspect plugin for debugging"
63
67
  }).option("force", {
64
68
  alias: "f",
65
69
  default: false,
66
70
  type: "boolean",
67
71
  describe: "force the optimizer to ignore the cache and re-bundle "
68
72
  }).strict().help(),
69
- async ({ entry, theme, port: userPort, open, log, remote, force }) => {
73
+ async ({ entry, theme, port: userPort, open, log, remote, force, inspect }) => {
70
74
  if (!fs.existsSync(entry) && !entry.endsWith(".md"))
71
75
  entry = `${entry}.md`;
72
76
  if (!fs.existsSync(entry)) {
@@ -86,7 +90,7 @@ cli.command(
86
90
  async function initServer() {
87
91
  if (server)
88
92
  await server.close();
89
- const options = await resolveOptions({ entry, remote, theme }, "dev");
93
+ const options = await resolveOptions({ entry, remote, theme, inspect }, "dev");
90
94
  port = userPort || await findFreePort(3030);
91
95
  server = await createServer(
92
96
  options,
@@ -182,10 +186,14 @@ cli.command(
182
186
  alias: "d",
183
187
  type: "boolean",
184
188
  describe: "allow download as PDF"
189
+ }).option("inspect", {
190
+ default: false,
191
+ type: "boolean",
192
+ describe: "enable the inspect plugin for debugging"
185
193
  }).strict().help(),
186
- async ({ entry, theme, watch, base, download, out }) => {
187
- const { build } = await Promise.resolve().then(() => __toESM(__require("./build-JJPJN7L3.mjs")));
188
- const options = await resolveOptions({ entry, theme }, "build");
194
+ async ({ entry, theme, watch, base, download, out, inspect }) => {
195
+ const { build } = await Promise.resolve().then(() => __toESM(__require("./build-363D63QG.mjs")));
196
+ const options = await resolveOptions({ entry, theme, inspect }, "build");
189
197
  if (download && !options.data.config.download)
190
198
  options.data.config.download = download;
191
199
  printInfo(options);
@@ -295,7 +303,7 @@ cli.command(
295
303
  "executable-path": executablePath
296
304
  }) => {
297
305
  process.env.NODE_ENV = "production";
298
- const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-I2KYMDHO.mjs")));
306
+ const { exportSlides } = await Promise.resolve().then(() => __toESM(__require("./export-26FXNM7P.mjs")));
299
307
  const port = await findFreePort(12445);
300
308
  const options = await resolveOptions({ entry, theme }, "build");
301
309
  output = output || options.data.config.exportFilename || `${path.basename(entry, ".md")}-export`;
@@ -360,6 +368,8 @@ function printInfo(options, port, remote) {
360
368
  if (query)
361
369
  console.log(`${dim(" private slide show ")} > ${cyan(`http://localhost:${bold(port)}/${query}`)}`);
362
370
  console.log(`${dim(" presenter mode ")} > ${blue(`http://localhost:${bold(port)}${presenterPath}`)}`);
371
+ if (options.inspect)
372
+ console.log(`${dim(" inspector")} > ${yellow(`http://localhost:${bold(port)}/__inspect/`)}`);
363
373
  if (remote !== void 0) {
364
374
  Object.values(os.networkInterfaces()).forEach(
365
375
  (v) => (v || []).filter((details) => String(details.family).slice(-1) === "4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
@@ -3,7 +3,7 @@ import {
3
3
  __toESM,
4
4
  init_esm_shims,
5
5
  packageExists
6
- } from "./chunk-57E5R3IA.mjs";
6
+ } from "./chunk-IAMILGBS.mjs";
7
7
 
8
8
  // node/export.ts
9
9
  init_esm_shims();
@@ -3,10 +3,10 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkAW7KQET4js = require('./chunk-AW7KQET4.js');
6
+ var _chunk74QPSS6Tjs = require('./chunk-74QPSS6T.js');
7
7
 
8
8
  // node/export.ts
9
- _chunkAW7KQET4js.init_cjs_shims.call(void 0, );
9
+ _chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
10
10
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
11
11
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
12
12
  var _kolorist = require('kolorist');
@@ -61,10 +61,10 @@ async function exportSlides({
61
61
  withClicks = false,
62
62
  executablePath = void 0
63
63
  }) {
64
- if (!_chunkAW7KQET4js.packageExists.call(void 0, "playwright-chromium"))
64
+ if (!_chunk74QPSS6Tjs.packageExists.call(void 0, "playwright-chromium"))
65
65
  throw new Error("The exporting for Slidev is powered by Playwright, please installed it via `npm i -D playwright-chromium`");
66
66
  const pages = _core.parseRangeString.call(void 0, total, range);
67
- const { chromium } = await Promise.resolve().then(() => _chunkAW7KQET4js.__toESM.call(void 0, _chunkAW7KQET4js.__require.call(void 0, "playwright-chromium")));
67
+ const { chromium } = await Promise.resolve().then(() => _chunk74QPSS6Tjs.__toESM.call(void 0, _chunk74QPSS6Tjs.__require.call(void 0, "playwright-chromium")));
68
68
  const browser = await chromium.launch({
69
69
  executablePath
70
70
  });
package/dist/index.d.ts CHANGED
@@ -34,6 +34,10 @@ interface SlidevEntryOptions {
34
34
  * @default process.cwd()
35
35
  */
36
36
  userRoot?: string;
37
+ /**
38
+ * Enable inspect plugin
39
+ */
40
+ inspect?: boolean;
37
41
  }
38
42
  interface ResolvedSlidevOptions {
39
43
  data: SlidevMarkdown;
@@ -47,6 +51,7 @@ interface ResolvedSlidevOptions {
47
51
  roots: string[];
48
52
  mode: 'dev' | 'build';
49
53
  remote?: string;
54
+ inspect?: boolean;
50
55
  }
51
56
  interface SlidevPluginOptions extends SlidevEntryOptions {
52
57
  vue?: ArgumentsType<typeof Vue>[0];
package/dist/index.js CHANGED
@@ -9,20 +9,20 @@
9
9
 
10
10
 
11
11
 
12
- var _chunk4UR3M5JDjs = require('./chunk-4UR3M5JD.js');
12
+ var _chunkF44MX6U6js = require('./chunk-F44MX6U6.js');
13
13
 
14
14
 
15
15
 
16
- var _chunkYUXTNPKAjs = require('./chunk-YUXTNPKA.js');
16
+ var _chunkDAM7DDLQjs = require('./chunk-DAM7DDLQ.js');
17
17
 
18
18
 
19
- var _chunkAW7KQET4js = require('./chunk-AW7KQET4.js');
19
+ var _chunk74QPSS6Tjs = require('./chunk-74QPSS6T.js');
20
20
 
21
21
  // node/index.ts
22
- _chunkAW7KQET4js.init_cjs_shims.call(void 0, );
22
+ _chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
23
23
 
24
24
  // node/declare.ts
25
- _chunkAW7KQET4js.init_cjs_shims.call(void 0, );
25
+ _chunk74QPSS6Tjs.init_cjs_shims.call(void 0, );
26
26
 
27
27
 
28
28
 
@@ -36,4 +36,4 @@ _chunkAW7KQET4js.init_cjs_shims.call(void 0, );
36
36
 
37
37
 
38
38
 
39
- exports.ViteSlidevPlugin = _chunkYUXTNPKAjs.ViteSlidevPlugin; exports.createServer = _chunk4UR3M5JDjs.createServer; exports.createWindiCSSPlugin = _chunkYUXTNPKAjs.createWindiCSSPlugin; exports.getAddonRoots = _chunk4UR3M5JDjs.getAddonRoots; exports.getCLIRoot = _chunk4UR3M5JDjs.getCLIRoot; exports.getClientRoot = _chunk4UR3M5JDjs.getClientRoot; exports.getRoot = _chunk4UR3M5JDjs.getRoot; exports.getThemeRoots = _chunk4UR3M5JDjs.getThemeRoots; exports.getUserRoot = _chunk4UR3M5JDjs.getUserRoot; exports.isPath = _chunk4UR3M5JDjs.isPath; exports.parser = _chunk4UR3M5JDjs.parser; exports.resolveOptions = _chunk4UR3M5JDjs.resolveOptions;
39
+ exports.ViteSlidevPlugin = _chunkDAM7DDLQjs.ViteSlidevPlugin; exports.createServer = _chunkF44MX6U6js.createServer; exports.createWindiCSSPlugin = _chunkDAM7DDLQjs.createWindiCSSPlugin; exports.getAddonRoots = _chunkF44MX6U6js.getAddonRoots; exports.getCLIRoot = _chunkF44MX6U6js.getCLIRoot; exports.getClientRoot = _chunkF44MX6U6js.getClientRoot; exports.getRoot = _chunkF44MX6U6js.getRoot; exports.getThemeRoots = _chunkF44MX6U6js.getThemeRoots; exports.getUserRoot = _chunkF44MX6U6js.getUserRoot; exports.isPath = _chunkF44MX6U6js.isPath; exports.parser = _chunkF44MX6U6js.parser; exports.resolveOptions = _chunkF44MX6U6js.resolveOptions;
package/dist/index.mjs CHANGED
@@ -9,14 +9,14 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-3VPTNK23.mjs";
12
+ } from "./chunk-PUJ4PVRP.mjs";
13
13
  import {
14
14
  ViteSlidevPlugin,
15
15
  createWindiCSSPlugin
16
- } from "./chunk-IY7QSYZ2.mjs";
16
+ } from "./chunk-GVIE4JZ6.mjs";
17
17
  import {
18
18
  init_esm_shims
19
- } from "./chunk-57E5R3IA.mjs";
19
+ } from "./chunk-IAMILGBS.mjs";
20
20
 
21
21
  // node/index.ts
22
22
  init_esm_shims();