@slidev/cli 0.50.0-beta.1 → 0.50.0-beta.3

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.
package/README.md CHANGED
@@ -13,7 +13,7 @@ Presentation <b>slide</b>s for <b>dev</b>elopers 🧑‍💻👩‍💻👨‍
13
13
  <a href="https://www.npmjs.com/package/@slidev/cli" target="__blank"><img src="https://img.shields.io/npm/v/@slidev/cli?color=2B90B6&label=" alt="NPM version"></a>
14
14
  <a href="https://www.npmjs.com/package/@slidev/cli" target="__blank"><img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@slidev/cli?color=349dbe&label="></a>
15
15
  <a href="https://sli.dev/" target="__blank"><img src="https://img.shields.io/static/v1?label=&message=docs%20%26%20demos&color=45b8cd" alt="Docs & Demos"></a>
16
- <a href="https://sli.dev/themes/gallery.html" target="__blank"><img src="https://img.shields.io/static/v1?label=&message=themes&color=4ec5d4" alt="Themes"></a>
16
+ <a href="https://sli.dev/resources/theme-gallery" target="__blank"><img src="https://img.shields.io/static/v1?label=&message=themes&color=4ec5d4" alt="Themes"></a>
17
17
  <br>
18
18
  <a href="https://github.com/slidevjs/slidev" target="__blank"><img alt="GitHub stars" src="https://img.shields.io/github/stars/slidevjs/slidev?style=social"></a>
19
19
  </p>
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  resolveViteConfigs
3
- } from "./chunk-6O4GDZ4B.js";
4
- import "./chunk-6DS3IPOB.js";
3
+ } from "./chunk-OBUVLPJZ.js";
5
4
  import "./chunk-UNQ5DBLZ.js";
6
5
 
7
6
  // node/commands/build.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveViteConfigs
3
- } from "./chunk-6O4GDZ4B.js";
3
+ } from "./chunk-OBUVLPJZ.js";
4
4
 
5
5
  // node/commands/serve.ts
6
6
  import { join } from "node:path";
@@ -1,8 +1,3 @@
1
- import {
2
- escapeVueInCode,
3
- getCodeBlocks,
4
- normalizeRangeStr
5
- } from "./chunk-6DS3IPOB.js";
6
1
  import {
7
2
  createResolver,
8
3
  getRoots,
@@ -14,7 +9,7 @@ import {
14
9
  } from "./chunk-UNQ5DBLZ.js";
15
10
 
16
11
  // package.json
17
- var version = "0.50.0-beta.1";
12
+ var version = "0.50.0-beta.3";
18
13
 
19
14
  // node/integrations/themes.ts
20
15
  import { join } from "node:path";
@@ -193,7 +188,8 @@ var INCLUDE_GLOBAL = [
193
188
  "prettier",
194
189
  "recordrtc",
195
190
  "typescript",
196
- "yaml"
191
+ "yaml",
192
+ "html-to-image"
197
193
  ];
198
194
  var INCLUDE_LOCAL = INCLUDE_GLOBAL.map((i) => `@slidev/cli > @slidev/client > ${i}`);
199
195
  var EXCLUDE_GLOBAL = [
@@ -1580,6 +1576,34 @@ function MarkdownItKatex(md, options) {
1580
1576
  // node/syntax/markdown-it/markdown-it-shiki.ts
1581
1577
  import { isTruthy } from "@antfu/utils";
1582
1578
  import { fromHighlighter } from "@shikijs/markdown-it/core";
1579
+
1580
+ // node/syntax/transform/utils.ts
1581
+ function normalizeRangeStr(rangeStr = "") {
1582
+ return !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
1583
+ }
1584
+ function getCodeBlocks(md) {
1585
+ const codeblocks = Array.from(md.matchAll(/^```[\s\S]*?^```/gm)).map((m) => {
1586
+ const start = m.index;
1587
+ const end = m.index + m[0].length;
1588
+ const startLine = md.slice(0, start).match(/\n/g)?.length || 0;
1589
+ const endLine = md.slice(0, end).match(/\n/g)?.length || 0;
1590
+ return [start, end, startLine, endLine];
1591
+ });
1592
+ return {
1593
+ codeblocks,
1594
+ isInsideCodeblocks(idx) {
1595
+ return codeblocks.some(([s, e]) => s <= idx && idx <= e);
1596
+ },
1597
+ isLineInsideCodeblocks(line) {
1598
+ return codeblocks.some(([, , s, e]) => s <= line && line <= e);
1599
+ }
1600
+ };
1601
+ }
1602
+ function escapeVueInCode(md) {
1603
+ return md.replace(/\{\{/g, "&lbrace;&lbrace;");
1604
+ }
1605
+
1606
+ // node/syntax/markdown-it/markdown-it-shiki.ts
1583
1607
  async function MarkdownItShiki({ data: { config }, mode, utils }) {
1584
1608
  const transformers = [
1585
1609
  ...utils.shikiOptions.transformers || [],
@@ -1669,10 +1693,6 @@ async function useMarkdownItPlugins(md, options, markdownTransformMap) {
1669
1693
  const { roots, data: { features, config } } = options;
1670
1694
  if (config.highlighter === "shiki") {
1671
1695
  md.use(await MarkdownItShiki(options));
1672
- } else {
1673
- console.warn("[Slidev] Highlighter: Prism highlighter is deprecated, and will be removed in v0.50. Refer to https://github.com/slidevjs/slidev/issues/1390");
1674
- const { default: MarkdownItPrism } = await import("./markdown-it-prism-44L27JJK.js");
1675
- md.use(MarkdownItPrism);
1676
1696
  }
1677
1697
  md.use(MarkdownItLink);
1678
1698
  md.use(MarkdownItEscapeInlineCode);
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createServer
3
- } from "./chunk-6GC5ATZB.js";
3
+ } from "./chunk-22D4K34T.js";
4
4
  import {
5
5
  getThemeMeta,
6
6
  loadSetups,
@@ -9,8 +9,7 @@ import {
9
9
  resolveOptions,
10
10
  resolveTheme,
11
11
  version
12
- } from "./chunk-6O4GDZ4B.js";
13
- import "./chunk-6DS3IPOB.js";
12
+ } from "./chunk-OBUVLPJZ.js";
14
13
  import {
15
14
  getRoots,
16
15
  isInstalledGlobally,
@@ -51,7 +50,6 @@ async function setupPreparser() {
51
50
 
52
51
  // node/cli.ts
53
52
  var CONFIG_RESTART_FIELDS = [
54
- "highlighter",
55
53
  "monaco",
56
54
  "routerMode",
57
55
  "fonts",
@@ -334,7 +332,7 @@ cli.command(
334
332
  }).strict().help(),
335
333
  async (args) => {
336
334
  const { entry, theme, base, download, out, inspect } = args;
337
- const { build } = await import("./build-FMVKC2PV.js");
335
+ const { build } = await import("./build-ZP4MQTE4.js");
338
336
  for (const entryFile of entry) {
339
337
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
340
338
  if (download && !options.data.config.download)
package/dist/index.js CHANGED
@@ -1,13 +1,12 @@
1
1
  import {
2
2
  createServer
3
- } from "./chunk-6GC5ATZB.js";
3
+ } from "./chunk-22D4K34T.js";
4
4
  import {
5
5
  ViteSlidevPlugin,
6
6
  createDataUtils,
7
7
  parser,
8
8
  resolveOptions
9
- } from "./chunk-6O4GDZ4B.js";
10
- import "./chunk-6DS3IPOB.js";
9
+ } from "./chunk-OBUVLPJZ.js";
11
10
  import "./chunk-UNQ5DBLZ.js";
12
11
  export {
13
12
  ViteSlidevPlugin,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
3
  "type": "module",
4
- "version": "0.50.0-beta.1",
4
+ "version": "0.50.0-beta.3",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "antfu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -48,11 +48,11 @@
48
48
  "@iconify-json/ph": "^1.2.0",
49
49
  "@iconify-json/svg-spinners": "^1.2.0",
50
50
  "@lillallol/outline-pdf": "^4.0.0",
51
- "@shikijs/markdown-it": "^1.20.0",
52
- "@shikijs/twoslash": "^1.20.0",
53
- "@shikijs/vitepress-twoslash": "^1.20.0",
54
- "@unocss/extractor-mdc": "^0.62.4",
55
- "@unocss/reset": "^0.62.4",
51
+ "@shikijs/markdown-it": "^1.21.0",
52
+ "@shikijs/twoslash": "^1.21.0",
53
+ "@shikijs/vitepress-twoslash": "^1.21.0",
54
+ "@unocss/extractor-mdc": "^0.63.2",
55
+ "@unocss/reset": "^0.63.2",
56
56
  "@vitejs/plugin-vue": "^5.1.4",
57
57
  "@vitejs/plugin-vue-jsx": "^4.0.1",
58
58
  "chokidar": "^4.0.1",
@@ -66,7 +66,7 @@
66
66
  "global-directory": "^4.0.1",
67
67
  "htmlparser2": "^9.1.0",
68
68
  "is-installed-globally": "^1.0.0",
69
- "jiti": "^2.0.0",
69
+ "jiti": "^2.1.0",
70
70
  "katex": "^0.16.11",
71
71
  "kolorist": "^1.8.0",
72
72
  "local-pkg": "^0.5.0",
@@ -84,18 +84,17 @@
84
84
  "plantuml-encoder": "^1.4.0",
85
85
  "postcss-nested": "^6.2.0",
86
86
  "pptxgenjs": "^3.12.0",
87
- "prismjs": "^1.29.0",
88
87
  "prompts": "^2.4.2",
89
88
  "public-ip": "^7.0.1",
90
89
  "resolve-from": "^5.0.0",
91
90
  "resolve-global": "^2.0.0",
92
91
  "semver": "^7.6.3",
93
- "shiki": "^1.20.0",
94
- "shiki-magic-move": "^0.4.4",
92
+ "shiki": "^1.21.0",
93
+ "shiki-magic-move": "^0.4.5",
95
94
  "sirv": "^2.0.4",
96
95
  "source-map-js": "^1.2.1",
97
96
  "typescript": "^5.6.2",
98
- "unocss": "^0.62.4",
97
+ "unocss": "^0.63.2",
99
98
  "unplugin-icons": "^0.19.3",
100
99
  "unplugin-vue-components": "^0.27.4",
101
100
  "unplugin-vue-markdown": "^0.26.2",
@@ -107,12 +106,12 @@
107
106
  "vite-plugin-static-copy": "^1.0.6",
108
107
  "vite-plugin-vue-server-ref": "^0.4.2",
109
108
  "vitefu": "^1.0.2",
110
- "vue": "^3.5.9",
109
+ "vue": "^3.5.10",
111
110
  "yaml": "^2.5.1",
112
111
  "yargs": "^17.7.2",
113
- "@slidev/client": "0.50.0-beta.1",
114
- "@slidev/parser": "0.50.0-beta.1",
115
- "@slidev/types": "0.50.0-beta.1"
112
+ "@slidev/client": "0.50.0-beta.3",
113
+ "@slidev/types": "0.50.0-beta.3",
114
+ "@slidev/parser": "0.50.0-beta.3"
116
115
  },
117
116
  "devDependencies": {
118
117
  "@hedgedoc/markdown-it-plugins": "^2.1.4",
package/template.md CHANGED
@@ -6,8 +6,6 @@ theme: seriph
6
6
  background: https://cover.sli.dev
7
7
  # apply any unocss classes to the current slide
8
8
  class: 'text-center'
9
- # https://sli.dev/custom/config-highlighter.html
10
- highlighter: shiki
11
9
  # some information about the slides, markdown enabled
12
10
  info: |
13
11
  ## Slidev Starter Template
@@ -237,8 +235,8 @@ theme: seriph
237
235
 
238
236
  </div>
239
237
 
240
- Read more about [How to use a theme](https://sli.dev/themes/use.html) and
241
- check out the [Awesome Themes Gallery](https://sli.dev/themes/gallery.html).
238
+ Read more about [How to use a theme](https://sli.dev/guide/theme-addon#use-theme) and
239
+ check out the [Awesome Themes Gallery](https://sli.dev/resources/theme-gallery).
242
240
 
243
241
  ---
244
242
  preload: false
@@ -1,31 +0,0 @@
1
- // node/syntax/transform/utils.ts
2
- function normalizeRangeStr(rangeStr = "") {
3
- return !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
4
- }
5
- function getCodeBlocks(md) {
6
- const codeblocks = Array.from(md.matchAll(/^```[\s\S]*?^```/gm)).map((m) => {
7
- const start = m.index;
8
- const end = m.index + m[0].length;
9
- const startLine = md.slice(0, start).match(/\n/g)?.length || 0;
10
- const endLine = md.slice(0, end).match(/\n/g)?.length || 0;
11
- return [start, end, startLine, endLine];
12
- });
13
- return {
14
- codeblocks,
15
- isInsideCodeblocks(idx) {
16
- return codeblocks.some(([s, e]) => s <= idx && idx <= e);
17
- },
18
- isLineInsideCodeblocks(line) {
19
- return codeblocks.some(([, , s, e]) => s <= line && line <= e);
20
- }
21
- };
22
- }
23
- function escapeVueInCode(md) {
24
- return md.replace(/\{\{/g, "&lbrace;&lbrace;");
25
- }
26
-
27
- export {
28
- normalizeRangeStr,
29
- getCodeBlocks,
30
- escapeVueInCode
31
- };
@@ -1,107 +0,0 @@
1
- import {
2
- escapeVueInCode
3
- } from "./chunk-6DS3IPOB.js";
4
-
5
- // node/syntax/markdown-it/markdown-it-prism.ts
6
- import { createRequire } from "node:module";
7
- import * as htmlparser2 from "htmlparser2";
8
- import Prism from "prismjs";
9
- import loadLanguages from "prismjs/components/index.js";
10
- var require2 = createRequire(import.meta.url);
11
- var Tag = class {
12
- tagname;
13
- attributes;
14
- constructor(tagname, attributes) {
15
- this.tagname = tagname;
16
- this.attributes = attributes;
17
- }
18
- asOpen() {
19
- return `<${this.tagname} ${Object.entries(this.attributes).map(([key, value]) => `${key}="${value}"`).join(" ")}>`;
20
- }
21
- asClosed() {
22
- return `</${this.tagname}>`;
23
- }
24
- };
25
- var DEFAULTS = {
26
- plugins: [],
27
- init: () => {
28
- },
29
- defaultLanguageForUnknown: void 0,
30
- defaultLanguageForUnspecified: void 0,
31
- defaultLanguage: void 0
32
- };
33
- function loadPrismLang(lang) {
34
- if (!lang)
35
- return void 0;
36
- let langObject = Prism.languages[lang];
37
- if (langObject === void 0) {
38
- loadLanguages([lang]);
39
- langObject = Prism.languages[lang];
40
- }
41
- return langObject;
42
- }
43
- function loadPrismPlugin(name) {
44
- try {
45
- require2(`prismjs/plugins/${name}/prism-${name}`);
46
- } catch (e) {
47
- throw new Error(`Cannot load Prism plugin "${name}". Please check the spelling.`, { cause: e });
48
- }
49
- }
50
- function selectLanguage(options, lang) {
51
- let langToUse = lang;
52
- if (langToUse === "" && options.defaultLanguageForUnspecified !== void 0)
53
- langToUse = options.defaultLanguageForUnspecified;
54
- let prismLang = loadPrismLang(langToUse);
55
- if (prismLang === void 0 && options.defaultLanguageForUnknown !== void 0) {
56
- langToUse = options.defaultLanguageForUnknown;
57
- prismLang = loadPrismLang(langToUse);
58
- }
59
- return [langToUse, prismLang];
60
- }
61
- function highlight(markdownit, options, text, lang) {
62
- const [langToUse, prismLang] = selectLanguage(options, lang);
63
- let code = text.trimEnd();
64
- code = prismLang ? highlightPrism(code, prismLang, langToUse) : markdownit.utils.escapeHtml(code);
65
- code = code.split(/\r?\n/g).map((line) => `<span class="line">${line}</span>`).join("\n");
66
- const classAttribute = langToUse ? ` class="slidev-code ${markdownit.options.langPrefix}${markdownit.utils.escapeHtml(langToUse)}"` : "";
67
- return escapeVueInCode(`<pre${classAttribute}><code>${code}</code></pre>`);
68
- }
69
- function highlightPrism(code, prismLang, langToUse) {
70
- const openTags = [];
71
- const parser = new htmlparser2.Parser({
72
- onopentag(tagname, attributes) {
73
- openTags.push(new Tag(tagname, attributes));
74
- },
75
- onclosetag() {
76
- openTags.pop();
77
- }
78
- });
79
- code = Prism.highlight(code, prismLang, langToUse);
80
- code = code.split(/\r?\n/g).map((line) => {
81
- const prefix = openTags.map((tag) => tag.asOpen()).join("");
82
- parser.write(line);
83
- const postfix = openTags.reverse().map((tag) => tag.asClosed()).join("");
84
- return prefix + line + postfix;
85
- }).join("\n");
86
- parser.end();
87
- return code;
88
- }
89
- function checkLanguageOption(options, optionName) {
90
- const language = options[optionName];
91
- if (language !== void 0 && loadPrismLang(language) === void 0)
92
- throw new Error(`Bad option ${optionName}: There is no Prism language '${language}'.`);
93
- }
94
- function MarkdownItPrism(markdownit, useroptions) {
95
- const options = Object.assign({}, DEFAULTS, useroptions);
96
- checkLanguageOption(options, "defaultLanguage");
97
- checkLanguageOption(options, "defaultLanguageForUnknown");
98
- checkLanguageOption(options, "defaultLanguageForUnspecified");
99
- options.defaultLanguageForUnknown = options.defaultLanguageForUnknown || options.defaultLanguage;
100
- options.defaultLanguageForUnspecified = options.defaultLanguageForUnspecified || options.defaultLanguage;
101
- options.plugins.forEach(loadPrismPlugin);
102
- options.init(Prism);
103
- markdownit.options.highlight = (text, lang) => highlight(markdownit, options, text, lang);
104
- }
105
- export {
106
- MarkdownItPrism as default
107
- };