@slidev/cli 0.35.0 → 0.35.1

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.
@@ -2,7 +2,7 @@ import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml,
4
4
  mergeViteConfigs
5
- } from "./chunk-TFFDXUDQ.mjs";
5
+ } from "./chunk-X2HQWYH2.mjs";
6
6
  import {
7
7
  __require,
8
8
  __toESM,
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkSZ24GYH2js = require('./chunk-SZ24GYH2.js');
5
+ var _chunkGH4JJSLKjs = require('./chunk-GH4JJSLK.js');
6
6
 
7
7
 
8
8
 
@@ -655,13 +655,13 @@ async function build(options, viteConfig = {}) {
655
655
  let originalIndexHTML;
656
656
  if (_fsextra2.default.existsSync(indexPath))
657
657
  originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
658
- await _fsextra2.default.writeFile(indexPath, await _chunkSZ24GYH2js.getIndexHtml.call(void 0, options), "utf-8");
658
+ await _fsextra2.default.writeFile(indexPath, await _chunkGH4JJSLKjs.getIndexHtml.call(void 0, options), "utf-8");
659
659
  let config = void 0;
660
660
  try {
661
- const inlineConfig = await _chunkSZ24GYH2js.mergeViteConfigs.call(void 0, options, viteConfig, {
661
+ const inlineConfig = await _chunkGH4JJSLKjs.mergeViteConfigs.call(void 0, options, viteConfig, {
662
662
  root: options.userRoot,
663
663
  plugins: [
664
- await _chunkSZ24GYH2js.ViteSlidevPlugin.call(void 0, options, pluginOptions),
664
+ await _chunkGH4JJSLKjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
665
665
  {
666
666
  name: "resolve-config",
667
667
  configResolved(_config) {
@@ -679,7 +679,7 @@ async function build(options, viteConfig = {}) {
679
679
  console.log(_kolorist.yellow.call(void 0, " Monaco is disabled in the build, to enabled it, set `monaco: true` in the frontmatter"));
680
680
  } else {
681
681
  console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
682
- await _vite.build.call(void 0, await _chunkSZ24GYH2js.mergeViteConfigs.call(void 0, options, inlineConfig, {
682
+ await _vite.build.call(void 0, await _chunkGH4JJSLKjs.mergeViteConfigs.call(void 0, options, inlineConfig, {
683
683
  root: _path.join.call(void 0, options.clientRoot, "iframes/monaco"),
684
684
  base: `${config.base}iframes/monaco/`,
685
685
  build: {
@@ -1,7 +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
3
 
4
- var _chunkSZ24GYH2js = require('./chunk-SZ24GYH2.js');
4
+ var _chunkGH4JJSLKjs = require('./chunk-GH4JJSLK.js');
5
5
 
6
6
 
7
7
 
@@ -2380,14 +2380,14 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2380
2380
  const rawConfig = await _vite.resolveConfig.call(void 0, {}, "serve");
2381
2381
  const pluginOptions = rawConfig.slidev || {};
2382
2382
  process.env.EDITOR = process.env.EDITOR || "code";
2383
- const server = await _vite.createServer.call(void 0, await _chunkSZ24GYH2js.mergeViteConfigs.call(void 0, options, viteConfig, {
2383
+ const server = await _vite.createServer.call(void 0, await _chunkGH4JJSLKjs.mergeViteConfigs.call(void 0, options, viteConfig, {
2384
2384
  optimizeDeps: {
2385
2385
  entries: [
2386
2386
  _path.join.call(void 0, options.clientRoot, "main.ts")
2387
2387
  ]
2388
2388
  },
2389
2389
  plugins: [
2390
- await _chunkSZ24GYH2js.ViteSlidevPlugin.call(void 0, options, pluginOptions, serverOptions)
2390
+ await _chunkGH4JJSLKjs.ViteSlidevPlugin.call(void 0, options, pluginOptions, serverOptions)
2391
2391
  ]
2392
2392
  }, "serve"));
2393
2393
  return server;
@@ -2398,7 +2398,7 @@ _chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
2398
2398
  var _fs = require('@slidev/parser/fs'); var parser = _interopRequireWildcard(_fs);
2399
2399
 
2400
2400
  // package.json
2401
- var version = "0.35.0";
2401
+ var version = "0.35.1";
2402
2402
 
2403
2403
  // node/themes.ts
2404
2404
  _chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
@@ -998,8 +998,18 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
998
998
  awaitFn = `injection_return = ${awaitFn}`;
999
999
  }
1000
1000
  if (/\binjection_arg\b/g.test(code)) {
1001
- fn += "(injection_arg)";
1002
- awaitFn += "(injection_arg)";
1001
+ fn += "(";
1002
+ awaitFn += "(";
1003
+ const matches = Array.from(code.matchAll(/\binjection_arg(_\d+)?\b/g));
1004
+ const dedupedMatches = Array.from(new Set(matches.map((m) => m[0])));
1005
+ dedupedMatches.forEach((key, index) => {
1006
+ const isLast = index === dedupedMatches.length - 1;
1007
+ const arg = key + (isLast ? "" : ",");
1008
+ fn += arg;
1009
+ awaitFn += arg;
1010
+ });
1011
+ fn += ")";
1012
+ awaitFn += ")";
1003
1013
  } else {
1004
1014
  fn += "()";
1005
1015
  awaitFn += "()";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
3
  mergeViteConfigs
4
- } from "./chunk-TFFDXUDQ.mjs";
4
+ } from "./chunk-X2HQWYH2.mjs";
5
5
  import {
6
6
  __commonJS,
7
7
  __dirname,
@@ -2399,7 +2399,7 @@ init_esm_shims();
2399
2399
  import * as parser from "@slidev/parser/fs";
2400
2400
 
2401
2401
  // package.json
2402
- var version = "0.35.0";
2402
+ var version = "0.35.1";
2403
2403
 
2404
2404
  // node/themes.ts
2405
2405
  init_esm_shims();
@@ -999,8 +999,18 @@ function createClientSetupPlugin({ clientRoot, themeRoots, addonRoots, userRoot
999
999
  awaitFn = `injection_return = ${awaitFn}`;
1000
1000
  }
1001
1001
  if (/\binjection_arg\b/g.test(code)) {
1002
- fn += "(injection_arg)";
1003
- awaitFn += "(injection_arg)";
1002
+ fn += "(";
1003
+ awaitFn += "(";
1004
+ const matches = Array.from(code.matchAll(/\binjection_arg(_\d+)?\b/g));
1005
+ const dedupedMatches = Array.from(new Set(matches.map((m) => m[0])));
1006
+ dedupedMatches.forEach((key, index) => {
1007
+ const isLast = index === dedupedMatches.length - 1;
1008
+ const arg = key + (isLast ? "" : ",");
1009
+ fn += arg;
1010
+ awaitFn += arg;
1011
+ });
1012
+ fn += ")";
1013
+ awaitFn += ")";
1004
1014
  } else {
1005
1015
  fn += "()";
1006
1016
  awaitFn += "()";
package/dist/cli.js CHANGED
@@ -6,10 +6,10 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkZFMQVVWYjs = require('./chunk-ZFMQVVWY.js');
9
+ var _chunk2RFAYXDAjs = require('./chunk-2RFAYXDA.js');
10
10
 
11
11
 
12
- var _chunkSZ24GYH2js = require('./chunk-SZ24GYH2.js');
12
+ var _chunkGH4JJSLKjs = require('./chunk-GH4JJSLK.js');
13
13
 
14
14
 
15
15
 
@@ -18,7 +18,7 @@ var _chunkSQLX75IOjs = require('./chunk-SQLX75IO.js');
18
18
 
19
19
  // node/cli.ts
20
20
  _chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
21
- var import_fast_deep_equal = _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSZ24GYH2js.require_fast_deep_equal.call(void 0, ));
21
+ var import_fast_deep_equal = _chunkSQLX75IOjs.__toESM.call(void 0, _chunkGH4JJSLKjs.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(_chunkZFMQVVWYjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
41
+ var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunk2RFAYXDAjs.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
42
42
  cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOptions(args).option("port", {
43
43
  alias: "p",
44
44
  type: "number",
@@ -81,9 +81,9 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
81
81
  async function initServer() {
82
82
  if (server)
83
83
  await server.close();
84
- const options = await _chunkZFMQVVWYjs.resolveOptions.call(void 0, { entry, remote, theme }, "dev");
84
+ const options = await _chunk2RFAYXDAjs.resolveOptions.call(void 0, { entry, remote, theme }, "dev");
85
85
  port = userPort || await findFreePort(3030);
86
- server = await _chunkZFMQVVWYjs.createServer.call(void 0, options, {
86
+ server = await _chunk2RFAYXDAjs.createServer.call(void 0, options, {
87
87
  server: {
88
88
  port,
89
89
  strictPort: true,
@@ -94,7 +94,7 @@ cli.command("* [entry]", "Start a local server for Slidev", (args) => commonOpti
94
94
  logLevel: log
95
95
  }, {
96
96
  onDataReload(newData, data) {
97
- if (!theme && _chunkZFMQVVWYjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunkZFMQVVWYjs.resolveThemeName.call(void 0, data.config.theme)) {
97
+ if (!theme && _chunk2RFAYXDAjs.resolveThemeName.call(void 0, newData.config.theme) !== _chunk2RFAYXDAjs.resolveThemeName.call(void 0, data.config.theme)) {
98
98
  console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
99
99
  initServer();
100
100
  } else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
@@ -170,8 +170,8 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
170
170
  type: "boolean",
171
171
  describe: "allow download as PDF"
172
172
  }).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
173
- const { build } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "./build-7GBS35MR.js")));
174
- const options = await _chunkZFMQVVWYjs.resolveOptions.call(void 0, { entry, theme }, "build");
173
+ const { build } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "./build-Z26FNYJ3.js")));
174
+ const options = await _chunk2RFAYXDAjs.resolveOptions.call(void 0, { entry, theme }, "build");
175
175
  if (download && !options.data.config.download)
176
176
  options.data.config.download = download;
177
177
  printInfo(options);
@@ -184,26 +184,26 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
184
184
  });
185
185
  });
186
186
  cli.command("format [entry]", "Format the markdown file", (args) => commonOptions(args).strict().help(), async ({ entry }) => {
187
- const data = await _chunkZFMQVVWYjs.parser.load(entry);
188
- _chunkZFMQVVWYjs.parser.prettify(data);
189
- await _chunkZFMQVVWYjs.parser.save(data);
187
+ const data = await _chunk2RFAYXDAjs.parser.load(entry);
188
+ _chunk2RFAYXDAjs.parser.prettify(data);
189
+ await _chunk2RFAYXDAjs.parser.save(data);
190
190
  });
191
191
  cli.command("theme [subcommand]", "Theme related operations", (command) => {
192
192
  return command.command("eject", "Eject current theme into local file system", (args) => commonOptions(args).option("dir", {
193
193
  type: "string",
194
194
  default: "theme"
195
195
  }), async ({ entry, dir, theme: themeInput }) => {
196
- const data = await _chunkZFMQVVWYjs.parser.load(entry);
197
- const theme = _chunkZFMQVVWYjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
196
+ const data = await _chunk2RFAYXDAjs.parser.load(entry);
197
+ const theme = _chunk2RFAYXDAjs.resolveThemeName.call(void 0, themeInput || data.config.theme);
198
198
  if (theme === "none") {
199
199
  console.error('Can not eject theme "none"');
200
200
  process.exit(1);
201
201
  }
202
- if (_chunkZFMQVVWYjs.isPath.call(void 0, theme)) {
202
+ if (_chunk2RFAYXDAjs.isPath.call(void 0, theme)) {
203
203
  console.error("Theme is already ejected");
204
204
  process.exit(1);
205
205
  }
206
- const roots = _chunkZFMQVVWYjs.getThemeRoots.call(void 0, theme, entry);
206
+ const roots = _chunk2RFAYXDAjs.getThemeRoots.call(void 0, theme, entry);
207
207
  if (!roots.length) {
208
208
  console.error(`Does not found theme "${theme}"`);
209
209
  process.exit(1);
@@ -215,7 +215,7 @@ cli.command("theme [subcommand]", "Theme related operations", (command) => {
215
215
  const dirPath = `./${dir}`;
216
216
  data.slides[0].frontmatter.theme = dirPath;
217
217
  data.slides[0].raw = null;
218
- await _chunkZFMQVVWYjs.parser.save(data);
218
+ await _chunk2RFAYXDAjs.parser.save(data);
219
219
  console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
220
220
  });
221
221
  }, () => {
@@ -259,15 +259,15 @@ cli.command("export [entry]", "Export slides to PDF", (args) => commonOptions(ar
259
259
  process.env.NODE_ENV = "production";
260
260
  const { exportSlides } = await Promise.resolve().then(() => _chunkSQLX75IOjs.__toESM.call(void 0, _chunkSQLX75IOjs.__require.call(void 0, "./export-TH7MNEXN.js")));
261
261
  const port = await findFreePort(12445);
262
- const options = await _chunkZFMQVVWYjs.resolveOptions.call(void 0, { entry, theme }, "build");
262
+ const options = await _chunk2RFAYXDAjs.resolveOptions.call(void 0, { entry, theme }, "build");
263
263
  output = output || options.data.config.exportFilename || `${_path2.default.basename(entry, ".md")}-export`;
264
- const server = await _chunkZFMQVVWYjs.createServer.call(void 0, options, {
264
+ const server = await _chunk2RFAYXDAjs.createServer.call(void 0, options, {
265
265
  server: { port },
266
266
  clearScreen: false
267
267
  });
268
268
  await server.listen(port);
269
269
  printInfo(options);
270
- _chunkZFMQVVWYjs.parser.filterDisabled(options.data);
270
+ _chunk2RFAYXDAjs.parser.filterDisabled(options.data);
271
271
  const width = options.data.config.canvasWidth;
272
272
  const height = Math.round(width / options.data.config.aspectRatio);
273
273
  output = await exportSlides({
@@ -305,7 +305,7 @@ function printInfo(options, port, remote) {
305
305
  console.log();
306
306
  console.log();
307
307
  console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
308
- console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkZFMQVVWYjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
308
+ console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunk2RFAYXDAjs.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
309
309
  console.log();
310
310
  console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
311
311
  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));
package/dist/cli.mjs CHANGED
@@ -6,10 +6,10 @@ import {
6
6
  resolveOptions,
7
7
  resolveThemeName,
8
8
  version
9
- } from "./chunk-BYR4MB7V.mjs";
9
+ } from "./chunk-I7YYQ2YV.mjs";
10
10
  import {
11
11
  require_fast_deep_equal
12
- } from "./chunk-TFFDXUDQ.mjs";
12
+ } from "./chunk-X2HQWYH2.mjs";
13
13
  import {
14
14
  __dirname,
15
15
  __require,
@@ -171,7 +171,7 @@ cli.command("build [entry]", "Build hostable SPA", (args) => commonOptions(args)
171
171
  type: "boolean",
172
172
  describe: "allow download as PDF"
173
173
  }).strict().help(), async ({ entry, theme, watch, base, download, out }) => {
174
- const { build } = await Promise.resolve().then(() => __toESM(__require("./build-ZXP7BI52.mjs")));
174
+ const { build } = await Promise.resolve().then(() => __toESM(__require("./build-52YMLBLI.mjs")));
175
175
  const options = await resolveOptions({ entry, theme }, "build");
176
176
  if (download && !options.data.config.download)
177
177
  options.data.config.download = download;
package/dist/index.js CHANGED
@@ -9,11 +9,11 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkZFMQVVWYjs = require('./chunk-ZFMQVVWY.js');
12
+ var _chunk2RFAYXDAjs = require('./chunk-2RFAYXDA.js');
13
13
 
14
14
 
15
15
 
16
- var _chunkSZ24GYH2js = require('./chunk-SZ24GYH2.js');
16
+ var _chunkGH4JJSLKjs = require('./chunk-GH4JJSLK.js');
17
17
 
18
18
 
19
19
  var _chunkSQLX75IOjs = require('./chunk-SQLX75IO.js');
@@ -36,4 +36,4 @@ _chunkSQLX75IOjs.init_cjs_shims.call(void 0, );
36
36
 
37
37
 
38
38
 
39
- exports.ViteSlidevPlugin = _chunkSZ24GYH2js.ViteSlidevPlugin; exports.createServer = _chunkZFMQVVWYjs.createServer; exports.createWindiCSSPlugin = _chunkSZ24GYH2js.createWindiCSSPlugin; exports.getAddonRoots = _chunkZFMQVVWYjs.getAddonRoots; exports.getCLIRoot = _chunkZFMQVVWYjs.getCLIRoot; exports.getClientRoot = _chunkZFMQVVWYjs.getClientRoot; exports.getRoot = _chunkZFMQVVWYjs.getRoot; exports.getThemeRoots = _chunkZFMQVVWYjs.getThemeRoots; exports.getUserRoot = _chunkZFMQVVWYjs.getUserRoot; exports.isPath = _chunkZFMQVVWYjs.isPath; exports.parser = _chunkZFMQVVWYjs.parser; exports.resolveOptions = _chunkZFMQVVWYjs.resolveOptions;
39
+ exports.ViteSlidevPlugin = _chunkGH4JJSLKjs.ViteSlidevPlugin; exports.createServer = _chunk2RFAYXDAjs.createServer; exports.createWindiCSSPlugin = _chunkGH4JJSLKjs.createWindiCSSPlugin; exports.getAddonRoots = _chunk2RFAYXDAjs.getAddonRoots; exports.getCLIRoot = _chunk2RFAYXDAjs.getCLIRoot; exports.getClientRoot = _chunk2RFAYXDAjs.getClientRoot; exports.getRoot = _chunk2RFAYXDAjs.getRoot; exports.getThemeRoots = _chunk2RFAYXDAjs.getThemeRoots; exports.getUserRoot = _chunk2RFAYXDAjs.getUserRoot; exports.isPath = _chunk2RFAYXDAjs.isPath; exports.parser = _chunk2RFAYXDAjs.parser; exports.resolveOptions = _chunk2RFAYXDAjs.resolveOptions;
package/dist/index.mjs CHANGED
@@ -9,11 +9,11 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-BYR4MB7V.mjs";
12
+ } from "./chunk-I7YYQ2YV.mjs";
13
13
  import {
14
14
  ViteSlidevPlugin,
15
15
  createWindiCSSPlugin
16
- } from "./chunk-TFFDXUDQ.mjs";
16
+ } from "./chunk-X2HQWYH2.mjs";
17
17
  import {
18
18
  init_esm_shims
19
19
  } from "./chunk-GVA336JI.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.35.0",
3
+ "version": "0.35.1",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -46,9 +46,9 @@
46
46
  "@hedgedoc/markdown-it-task-lists": "^1.0.5",
47
47
  "@iconify-json/carbon": "^1.1.7",
48
48
  "@iconify-json/ph": "^1.1.2",
49
- "@slidev/client": "0.35.0",
50
- "@slidev/parser": "0.35.0",
51
- "@slidev/types": "0.35.0",
49
+ "@slidev/client": "0.35.1",
50
+ "@slidev/parser": "0.35.1",
51
+ "@slidev/types": "0.35.1",
52
52
  "@vitejs/plugin-vue": "^3.0.1",
53
53
  "@vue/compiler-sfc": "^3.2.37",
54
54
  "cli-progress": "^3.11.2",