@slidev/cli 0.42.11 → 0.43.0-beta.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.
@@ -1,7 +1,7 @@
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 }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
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 }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunk34SGGZ4Pjs = require('./chunk-34SGGZ4P.js');
4
- require('./chunk-QDKRARRU.js');
3
+ var _chunkJQHGZJGJjs = require('./chunk-JQHGZJGJ.js');
4
+ require('./chunk-YUG22S6W.js');
5
5
 
6
6
  // node/export.ts
7
7
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -14,7 +14,6 @@ var _outlinepdf = require('@lillallol/outline-pdf');
14
14
  var _pdflib = require('pdf-lib'); var pdfLib = _interopRequireWildcard(_pdflib);
15
15
 
16
16
  function addToTree(tree, info, slideIndexes, level = 1) {
17
- var _a;
18
17
  const titleLevel = info.level;
19
18
  if (titleLevel && titleLevel > level && tree.length > 0) {
20
19
  addToTree(tree[tree.length - 1].children, info, slideIndexes, level + 1);
@@ -23,7 +22,7 @@ function addToTree(tree, info, slideIndexes, level = 1) {
23
22
  children: [],
24
23
  level,
25
24
  path: String(slideIndexes[info.index + 1]),
26
- hideInToc: Boolean((_a = info.frontmatter) == null ? void 0 : _a.hideInToc),
25
+ hideInToc: Boolean(_optionalChain([info, 'access', _ => _.frontmatter, 'optionalAccess', _2 => _2.hideInToc])),
27
26
  title: info.title
28
27
  });
29
28
  }
@@ -77,7 +76,7 @@ async function exportNotes({
77
76
  output = "notes",
78
77
  timeout = 3e4
79
78
  }) {
80
- if (!_chunk34SGGZ4Pjs.packageExists.call(void 0, "playwright-chromium"))
79
+ if (!_chunkJQHGZJGJjs.packageExists.call(void 0, "playwright-chromium"))
81
80
  throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
82
81
  const { chromium } = await Promise.resolve().then(() => require("playwright-chromium"));
83
82
  const browser = await chromium.launch();
@@ -123,7 +122,7 @@ async function exportSlides({
123
122
  withToc = false,
124
123
  perSlide = false
125
124
  }) {
126
- if (!_chunk34SGGZ4Pjs.packageExists.call(void 0, "playwright-chromium"))
125
+ if (!_chunkJQHGZJGJjs.packageExists.call(void 0, "playwright-chromium"))
127
126
  throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
128
127
  const pages = _core.parseRangeString.call(void 0, total, range);
129
128
  const { chromium } = await Promise.resolve().then(() => require("playwright-chromium"));
@@ -170,15 +169,13 @@ async function exportSlides({
170
169
  clicksBySlide[path2] = (clicksBySlide[path2] || 0) + 1;
171
170
  }
172
171
  const slideIndexes = Object.fromEntries(Object.entries(clicksBySlide).reduce((acc, [path2, clicks], i) => {
173
- var _a;
174
- acc.push([path2, clicks + (_nullishCoalesce(((_a = acc[i - 1]) == null ? void 0 : _a[1]), () => ( 0)))]);
172
+ acc.push([path2, clicks + (_nullishCoalesce(_optionalChain([acc, 'access', _3 => _3[i - 1], 'optionalAccess', _4 => _4[1]]), () => ( 0)))]);
175
173
  return acc;
176
174
  }, []));
177
175
  return slideIndexes;
178
176
  }
179
177
  function getClicksFromUrl(url) {
180
- var _a;
181
- return (_a = url.match(/clicks=([1-9][0-9]*)/)) == null ? void 0 : _a[1];
178
+ return _optionalChain([url, 'access', _5 => _5.match, 'call', _6 => _6(/clicks=([1-9][0-9]*)/), 'optionalAccess', _7 => _7[1]]);
182
179
  }
183
180
  async function genPageWithClicks(fn, i, clicks) {
184
181
  await fn(i, clicks);
@@ -225,7 +222,6 @@ async function exportSlides({
225
222
  await _fsextra2.default.writeFile(output, buffer);
226
223
  }
227
224
  async function genPagePdfOnePiece() {
228
- var _a, _b, _c, _d, _e, _f;
229
225
  await go("print");
230
226
  const slideIndexes = await getSlidesIndex();
231
227
  await page.pdf({
@@ -244,17 +240,17 @@ async function exportSlides({
244
240
  let pdfData = await _fsextra2.default.readFile(output);
245
241
  let pdf = await _pdflib.PDFDocument.load(pdfData);
246
242
  const titleSlide = slides[0];
247
- if (titleSlide == null ? void 0 : titleSlide.title)
243
+ if (_optionalChain([titleSlide, 'optionalAccess', _8 => _8.title]))
248
244
  pdf.setTitle(titleSlide.title);
249
- if ((_a = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _a.info)
245
+ if (_optionalChain([titleSlide, 'optionalAccess', _9 => _9.frontmatter, 'optionalAccess', _10 => _10.info]))
250
246
  pdf.setSubject(titleSlide.frontmatter.info);
251
- if ((_b = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _b.author)
247
+ if (_optionalChain([titleSlide, 'optionalAccess', _11 => _11.frontmatter, 'optionalAccess', _12 => _12.author]))
252
248
  pdf.setAuthor(titleSlide.frontmatter.author);
253
- if ((_c = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _c.keywords) {
254
- if (Array.isArray((_d = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _d.keywords))
255
- pdf.setKeywords((_e = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _e.keywords);
249
+ if (_optionalChain([titleSlide, 'optionalAccess', _13 => _13.frontmatter, 'optionalAccess', _14 => _14.keywords])) {
250
+ if (Array.isArray(_optionalChain([titleSlide, 'optionalAccess', _15 => _15.frontmatter, 'optionalAccess', _16 => _16.keywords])))
251
+ pdf.setKeywords(_optionalChain([titleSlide, 'optionalAccess', _17 => _17.frontmatter, 'optionalAccess', _18 => _18.keywords]));
256
252
  else
257
- pdf.setKeywords((_f = titleSlide == null ? void 0 : titleSlide.frontmatter) == null ? void 0 : _f.keywords.split(","));
253
+ pdf.setKeywords(_optionalChain([titleSlide, 'optionalAccess', _19 => _19.frontmatter, 'optionalAccess', _20 => _20.keywords, 'access', _21 => _21.split, 'call', _22 => _22(",")]));
258
254
  }
259
255
  if (withToc) {
260
256
  const outlinePdf = _outlinepdf.outlinePdfFactory.call(void 0, pdfLib);
@@ -306,13 +302,12 @@ async function exportSlides({
306
302
  async function genPageMd(slides2) {
307
303
  const files = await _fsextra2.default.readdir(output);
308
304
  const mds = files.map((file, i, files2) => {
309
- var _a, _b, _c;
310
305
  const slideIndex = getSlideIndex(file);
311
- const mdImg = `![${(_a = slides2[slideIndex]) == null ? void 0 : _a.title}](./${_path2.default.join(output, file)})
306
+ const mdImg = `![${_optionalChain([slides2, 'access', _23 => _23[slideIndex], 'optionalAccess', _24 => _24.title])}](./${_path2.default.join(output, file)})
312
307
 
313
308
  `;
314
- if ((i + 1 === files2.length || getSlideIndex(files2[i + 1]) !== slideIndex) && ((_b = slides2[slideIndex]) == null ? void 0 : _b.note))
315
- return `${mdImg}${(_c = slides2[slideIndex]) == null ? void 0 : _c.note}
309
+ if ((i + 1 === files2.length || getSlideIndex(files2[i + 1]) !== slideIndex) && _optionalChain([slides2, 'access', _25 => _25[slideIndex], 'optionalAccess', _26 => _26.note]))
310
+ return `${mdImg}${_optionalChain([slides2, 'access', _27 => _27[slideIndex], 'optionalAccess', _28 => _28.note])}
316
311
 
317
312
  `;
318
313
  return mdImg;
package/dist/index.js CHANGED
@@ -9,16 +9,16 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkTH7JXF42js = require('./chunk-TH7JXF42.js');
12
+ var _chunkCJW2UL6Kjs = require('./chunk-CJW2UL6K.js');
13
13
 
14
14
 
15
- var _chunkRSZHGGR3js = require('./chunk-RSZHGGR3.js');
15
+ var _chunkJ7PXWEZ7js = require('./chunk-J7PXWEZ7.js');
16
16
 
17
17
 
18
- var _chunk4O6GOAOCjs = require('./chunk-4O6GOAOC.js');
18
+ var _chunkROTHRPSWjs = require('./chunk-ROTHRPSW.js');
19
19
  require('./chunk-KKGXM3XL.js');
20
- require('./chunk-34SGGZ4P.js');
21
- require('./chunk-QDKRARRU.js');
20
+ require('./chunk-JQHGZJGJ.js');
21
+ require('./chunk-YUG22S6W.js');
22
22
 
23
23
 
24
24
 
@@ -32,4 +32,4 @@ require('./chunk-QDKRARRU.js');
32
32
 
33
33
 
34
34
 
35
- exports.ViteSlidevPlugin = _chunk4O6GOAOCjs.ViteSlidevPlugin; exports.createServer = _chunkTH7JXF42js.createServer; exports.createWindiCSSPlugin = _chunkRSZHGGR3js.createWindiCSSPlugin; exports.getAddonRoots = _chunkTH7JXF42js.getAddonRoots; exports.getCLIRoot = _chunkTH7JXF42js.getCLIRoot; exports.getClientRoot = _chunkTH7JXF42js.getClientRoot; exports.getRoot = _chunkTH7JXF42js.getRoot; exports.getThemeRoots = _chunkTH7JXF42js.getThemeRoots; exports.getUserRoot = _chunkTH7JXF42js.getUserRoot; exports.isPath = _chunkTH7JXF42js.isPath; exports.parser = _chunkTH7JXF42js.parser; exports.resolveOptions = _chunkTH7JXF42js.resolveOptions;
35
+ exports.ViteSlidevPlugin = _chunkROTHRPSWjs.ViteSlidevPlugin; exports.createServer = _chunkCJW2UL6Kjs.createServer; exports.createWindiCSSPlugin = _chunkJ7PXWEZ7js.createWindiCSSPlugin; exports.getAddonRoots = _chunkCJW2UL6Kjs.getAddonRoots; exports.getCLIRoot = _chunkCJW2UL6Kjs.getCLIRoot; exports.getClientRoot = _chunkCJW2UL6Kjs.getClientRoot; exports.getRoot = _chunkCJW2UL6Kjs.getRoot; exports.getThemeRoots = _chunkCJW2UL6Kjs.getThemeRoots; exports.getUserRoot = _chunkCJW2UL6Kjs.getUserRoot; exports.isPath = _chunkCJW2UL6Kjs.isPath; exports.parser = _chunkCJW2UL6Kjs.parser; exports.resolveOptions = _chunkCJW2UL6Kjs.resolveOptions;
package/dist/index.mjs CHANGED
@@ -9,16 +9,16 @@ import {
9
9
  isPath,
10
10
  parser,
11
11
  resolveOptions
12
- } from "./chunk-QVVA2G2Y.mjs";
12
+ } from "./chunk-Y2TFMOHQ.mjs";
13
13
  import {
14
14
  createWindiCSSPlugin
15
- } from "./chunk-VPD6PH2L.mjs";
15
+ } from "./chunk-HO75FTDI.mjs";
16
16
  import {
17
17
  ViteSlidevPlugin
18
- } from "./chunk-UAV6RPFT.mjs";
19
- import "./chunk-6XVZLT3I.mjs";
20
- import "./chunk-MZBIET7Y.mjs";
21
- import "./chunk-KB3DQ2OE.mjs";
18
+ } from "./chunk-HA2YGJJG.mjs";
19
+ import "./chunk-JDHANZ37.mjs";
20
+ import "./chunk-ZEKM4EGL.mjs";
21
+ import "./chunk-QHOBBTS4.mjs";
22
22
  export {
23
23
  ViteSlidevPlugin,
24
24
  createServer,
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
3
  var _chunkKKGXM3XLjs = require('./chunk-KKGXM3XL.js');
4
- require('./chunk-QDKRARRU.js');
4
+ require('./chunk-YUG22S6W.js');
5
5
 
6
6
  // node/plugins/unocss.ts
7
7
  var _path = require('path');
@@ -11,7 +11,6 @@ var _unocss = require('unocss');
11
11
  var _jiti = require('jiti'); var _jiti2 = _interopRequireDefault(_jiti);
12
12
  var _vite = require('unocss/vite'); var _vite2 = _interopRequireDefault(_vite);
13
13
  async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, userRoot, data }, { unocss: unoOptions = {} }) {
14
- var _a, _b, _c, _d;
15
14
  const configFiles = _utils.uniq.call(void 0, [
16
15
  _path.resolve.call(void 0, userRoot, "uno.config.ts"),
17
16
  _path.resolve.call(void 0, userRoot, "unocss.config.ts"),
@@ -30,11 +29,11 @@ async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, u
30
29
  configs.reverse();
31
30
  let config = _unocss.mergeConfigs.call(void 0, [...configs, unoOptions]);
32
31
  config = await _chunkKKGXM3XLjs.loadSetups.call(void 0, roots, "unocss.ts", {}, config, true);
33
- config.theme || (config.theme = {});
34
- (_a = config.theme).fontFamily || (_a.fontFamily = {});
35
- (_b = config.theme.fontFamily).sans || (_b.sans = data.config.fonts.sans.join(","));
36
- (_c = config.theme.fontFamily).mono || (_c.mono = data.config.fonts.mono.join(","));
37
- (_d = config.theme.fontFamily).serif || (_d.serif = data.config.fonts.serif.join(","));
32
+ config.theme ||= {};
33
+ config.theme.fontFamily ||= {};
34
+ config.theme.fontFamily.sans ||= data.config.fonts.sans.join(",");
35
+ config.theme.fontFamily.mono ||= data.config.fonts.mono.join(",");
36
+ config.theme.fontFamily.serif ||= data.config.fonts.serif.join(",");
38
37
  return _vite2.default.call(void 0, {
39
38
  configFile: false,
40
39
  configDeps: configFiles,
@@ -1,17 +1,16 @@
1
1
  import {
2
2
  loadSetups
3
- } from "./chunk-6XVZLT3I.mjs";
4
- import "./chunk-KB3DQ2OE.mjs";
3
+ } from "./chunk-JDHANZ37.mjs";
4
+ import "./chunk-QHOBBTS4.mjs";
5
5
 
6
6
  // node/plugins/unocss.ts
7
- import { resolve } from "path";
8
- import { existsSync } from "fs";
7
+ import { resolve } from "node:path";
8
+ import { existsSync } from "node:fs";
9
9
  import { uniq } from "@antfu/utils";
10
10
  import { mergeConfigs } from "unocss";
11
11
  import jiti from "jiti";
12
12
  import UnoCSS from "unocss/vite";
13
13
  async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, userRoot, data }, { unocss: unoOptions = {} }) {
14
- var _a, _b, _c, _d;
15
14
  const configFiles = uniq([
16
15
  resolve(userRoot, "uno.config.ts"),
17
16
  resolve(userRoot, "unocss.config.ts"),
@@ -30,11 +29,11 @@ async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, u
30
29
  configs.reverse();
31
30
  let config = mergeConfigs([...configs, unoOptions]);
32
31
  config = await loadSetups(roots, "unocss.ts", {}, config, true);
33
- config.theme || (config.theme = {});
34
- (_a = config.theme).fontFamily || (_a.fontFamily = {});
35
- (_b = config.theme.fontFamily).sans || (_b.sans = data.config.fonts.sans.join(","));
36
- (_c = config.theme.fontFamily).mono || (_c.mono = data.config.fonts.mono.join(","));
37
- (_d = config.theme.fontFamily).serif || (_d.serif = data.config.fonts.serif.join(","));
32
+ config.theme ||= {};
33
+ config.theme.fontFamily ||= {};
34
+ config.theme.fontFamily.sans ||= data.config.fonts.sans.join(",");
35
+ config.theme.fontFamily.mono ||= data.config.fonts.mono.join(",");
36
+ config.theme.fontFamily.serif ||= data.config.fonts.serif.join(",");
38
37
  return UnoCSS({
39
38
  configFile: false,
40
39
  configDeps: configFiles,
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkJ7PXWEZ7js = require('./chunk-J7PXWEZ7.js');
4
+ require('./chunk-KKGXM3XL.js');
5
+ require('./chunk-JQHGZJGJ.js');
6
+ require('./chunk-YUG22S6W.js');
7
+
8
+
9
+ exports.createWindiCSSPlugin = _chunkJ7PXWEZ7js.createWindiCSSPlugin;
@@ -0,0 +1,9 @@
1
+ import {
2
+ createWindiCSSPlugin
3
+ } from "./chunk-HO75FTDI.mjs";
4
+ import "./chunk-JDHANZ37.mjs";
5
+ import "./chunk-ZEKM4EGL.mjs";
6
+ import "./chunk-QHOBBTS4.mjs";
7
+ export {
8
+ createWindiCSSPlugin
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.42.11",
3
+ "version": "0.43.0-beta.1",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "template.md"
32
32
  ],
33
33
  "engines": {
34
- "node": ">=14.0.0"
34
+ "node": ">=18.0.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "playwright-chromium": "^1.10.0"
@@ -81,7 +81,7 @@
81
81
  "resolve": "^1.22.4",
82
82
  "resolve-from": "^5.0.0",
83
83
  "resolve-global": "^1.0.0",
84
- "shiki": "^0.14.3",
84
+ "shiki": "npm:shikiji-compat@^0.6.5",
85
85
  "unocss": "^0.55.3",
86
86
  "unplugin-icons": "^0.16.5",
87
87
  "unplugin-vue-components": "^0.25.1",
@@ -96,14 +96,15 @@
96
96
  "vue": "^3.3.4",
97
97
  "windicss": "^3.5.6",
98
98
  "yargs": "^17.7.2",
99
- "@slidev/client": "0.42.11",
100
- "@slidev/parser": "0.42.11",
101
- "@slidev/types": "0.42.11"
99
+ "@slidev/client": "0.43.0-beta.1",
100
+ "@slidev/parser": "0.43.0-beta.1",
101
+ "@slidev/types": "0.43.0-beta.1"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@types/plantuml-encoder": "^1.4.0",
105
105
  "fast-deep-equal": "^3.1.3",
106
106
  "local-pkg": "^0.4.3",
107
+ "markdown-it-mdc": "^0.0.4",
107
108
  "semver": "^7.5.4",
108
109
  "sirv": "^2.0.3"
109
110
  },
package/template.md CHANGED
@@ -120,7 +120,7 @@ function updateUser(id: number, update: User) {
120
120
  }
121
121
  ```
122
122
 
123
- <arrow v-click="3" x1="400" y1="420" x2="230" y2="330" color="#564" width="3" arrowSize="1" />
123
+ <arrow v-click="[3, 4]" x1="400" y1="420" x2="230" y2="330" color="#564" width="3" arrowSize="1" />
124
124
 
125
125
  ---
126
126