@slidev/cli 51.8.0 → 51.8.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.
@@ -1,4 +1,4 @@
1
- import { resolveViteConfigs } from "./shared-CIQE-F_F.js";
1
+ import { resolveViteConfigs } from "./shared-BC4uxnur.js";
2
2
  import "./resolver-BShaA6qw.js";
3
3
  import fs from "node:fs/promises";
4
4
  import { join, resolve } from "node:path";
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
- import { getThemeMeta, loadSetups, parser, resolveAddons, resolveOptions, resolveTheme, updateFrontmatterPatch, version } from "./shared-CIQE-F_F.js";
1
+ import { getThemeMeta, loadSetups, parser, resolveAddons, resolveOptions, resolveTheme, updateFrontmatterPatch, version } from "./shared-BC4uxnur.js";
2
2
  import { getRoots, isInstalledGlobally, resolveEntry } from "./resolver-BShaA6qw.js";
3
- import { createServer } from "./serve-DgKBytqU.js";
3
+ import { createServer } from "./serve-CwwupxEq.js";
4
4
  import { exec } from "node:child_process";
5
5
  import fs from "node:fs/promises";
6
6
  import os from "node:os";
@@ -295,7 +295,7 @@ cli.command("build [entry..]", "Build hostable SPA", (args) => exportOptions(com
295
295
  describe: "enable the inspect plugin for debugging"
296
296
  }).strict().help(), async (args) => {
297
297
  const { entry, theme, base, download, out, inspect } = args;
298
- const { build } = await import("./build-BCss6wHH.js");
298
+ const { build } = await import("./build-DbJ651Nz.js");
299
299
  for (const entryFile of entry) {
300
300
  const options = await resolveOptions({
301
301
  entry: entryFile,
package/dist/index.d.ts CHANGED
@@ -5,15 +5,12 @@ import { ResolvedSlidevOptions, ResolvedSlidevUtils, SlidevEntryOptions, SlidevP
5
5
 
6
6
  //#region node/commands/serve.d.ts
7
7
  declare function createServer(options: ResolvedSlidevOptions, viteConfig?: InlineConfig, serverOptions?: SlidevServerOptions): Promise<vite0.ViteDevServer>;
8
-
9
8
  //#endregion
10
9
  //#region node/options.d.ts
11
10
  declare function resolveOptions(entryOptions: SlidevEntryOptions, mode: ResolvedSlidevOptions['mode']): Promise<ResolvedSlidevOptions>;
12
11
  declare function createDataUtils(resolved: Omit<ResolvedSlidevOptions, 'utils'>): Promise<ResolvedSlidevUtils>;
13
-
14
12
  //#endregion
15
13
  //#region node/vite/index.d.ts
16
14
  declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions?: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<PluginOption[]>;
17
-
18
15
  //#endregion
19
16
  export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { ViteSlidevPlugin, createDataUtils, parser, resolveOptions } from "./shared-CIQE-F_F.js";
1
+ import { ViteSlidevPlugin, createDataUtils, parser, resolveOptions } from "./shared-BC4uxnur.js";
2
2
  import "./resolver-BShaA6qw.js";
3
- import { createServer } from "./serve-DgKBytqU.js";
3
+ import { createServer } from "./serve-CwwupxEq.js";
4
4
 
5
5
  export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };
@@ -1,4 +1,4 @@
1
- import { resolveViteConfigs } from "./shared-CIQE-F_F.js";
1
+ import { resolveViteConfigs } from "./shared-BC4uxnur.js";
2
2
  import { join } from "node:path";
3
3
  import process from "node:process";
4
4
  import { createServer } from "vite";
@@ -43,7 +43,7 @@ import Vue from "@vitejs/plugin-vue";
43
43
  import VueJsx from "@vitejs/plugin-vue-jsx";
44
44
 
45
45
  //#region package.json
46
- var version = "51.8.0";
46
+ var version = "51.8.2";
47
47
 
48
48
  //#endregion
49
49
  //#region node/syntax/markdown-it/markdown-it-link.ts
@@ -374,6 +374,8 @@ function createConfigPlugin(options) {
374
374
  return () => {
375
375
  server.middlewares.use(async (req, res, next) => {
376
376
  if (req.url === "/index.html") {
377
+ const headers = server.config.server.headers ?? {};
378
+ for (const header in headers) res.setHeader(header, headers[header]);
377
379
  res.setHeader("Content-Type", "text/html");
378
380
  res.statusCode = 200;
379
381
  res.end(options.utils.indexHtml);
@@ -1279,7 +1281,7 @@ function createSlidesLoader(options, serverOptions) {
1279
1281
  const notesMd = MarkdownIt({ html: true });
1280
1282
  notesMd.use(MarkdownItLink);
1281
1283
  if (data.features.katex) notesMd.use(MarkdownItKatex, utils.katexOptions);
1282
- const hmrSlidesIndexes = new Set();
1284
+ const hmrSlidesIndexes = /* @__PURE__ */ new Set();
1283
1285
  let server;
1284
1286
  let skipHmr = null;
1285
1287
  let sourceIds = resolveSourceIds(data);
@@ -1358,7 +1360,7 @@ function createSlidesLoader(options, serverOptions) {
1358
1360
  skipHmr = null;
1359
1361
  return [];
1360
1362
  }
1361
- const moduleIds = new Set();
1363
+ const moduleIds = /* @__PURE__ */ new Set();
1362
1364
  const newSourceIds = resolveSourceIds(newData);
1363
1365
  for (const type of ["md", "frontmatter"]) {
1364
1366
  const old = sourceIds[type];
@@ -1705,8 +1707,8 @@ async function MarkdownItShiki({ data: { config }, mode, utils }) {
1705
1707
  const dragComponentRegex = /<(v-?drag-?\w*)([\s>])/i;
1706
1708
  const dragDirectiveRegex = /(?<![</\w])v-drag(=".*?")?/i;
1707
1709
  function MarkdownItVDrag(md, markdownTransformMap) {
1708
- const visited = new WeakSet();
1709
- const sourceMapConsumers = new WeakMap();
1710
+ const visited = /* @__PURE__ */ new WeakSet();
1711
+ const sourceMapConsumers = /* @__PURE__ */ new WeakMap();
1710
1712
  function getSourceMapConsumer(id) {
1711
1713
  const s = markdownTransformMap.get(id);
1712
1714
  if (!s) return void 0;
@@ -1843,7 +1845,7 @@ function transformKaTexWrapper(ctx) {
1843
1845
 
1844
1846
  //#endregion
1845
1847
  //#region node/syntax/transform/magic-move.ts
1846
- const reMagicMoveBlock = /^````(?:md|markdown) magic-move *(\{[^}]*\})?([^ \n]*)\n([\s\S]+?)^````$/gm;
1848
+ const reMagicMoveBlock = /^````(?:md|markdown) magic-move(?: *\[([^\]]*)\])?(?: *(\{[^}]*\}))? *([^ \n]*)\n([\s\S]+?)^````$/gm;
1847
1849
  function parseLineNumbersOption(options) {
1848
1850
  return /lines: *true/.test(options) ? true : /lines: *false/.test(options) ? false : void 0;
1849
1851
  }
@@ -1851,7 +1853,7 @@ function parseLineNumbersOption(options) {
1851
1853
  * Transform magic-move code blocks
1852
1854
  */
1853
1855
  function transformMagicMove(ctx) {
1854
- ctx.s.replace(reMagicMoveBlock, (full, options = "{}", _attrs = "", body) => {
1856
+ ctx.s.replace(reMagicMoveBlock, (full, title = "", options = "{}", _attrs = "", body) => {
1855
1857
  const matches = Array.from(body.matchAll(reCodeBlock));
1856
1858
  if (!matches.length) throw new Error("Magic Move block must contain at least one code block");
1857
1859
  const defaultLineNumbers = parseLineNumbersOption(options) ?? ctx.options.data.config.lineNumbers;
@@ -1864,7 +1866,7 @@ function transformMagicMove(ctx) {
1864
1866
  }, lineNumbers);
1865
1867
  });
1866
1868
  const compressed = lz.compressToBase64(JSON.stringify(steps));
1867
- return `<ShikiMagicMove v-bind="${options}" steps-lz="${compressed}" :step-ranges='${JSON.stringify(ranges)}' />`;
1869
+ return `<ShikiMagicMove v-bind="${options}" steps-lz="${compressed}" :title='${JSON.stringify(title)}' :step-ranges='${JSON.stringify(ranges)}' />`;
1868
1870
  });
1869
1871
  }
1870
1872
 
@@ -1950,7 +1952,7 @@ function transformSlotSugar(ctx) {
1950
1952
 
1951
1953
  //#endregion
1952
1954
  //#region node/vite/monacoWrite.ts
1953
- const monacoWriterWhitelist = new Set();
1955
+ const monacoWriterWhitelist = /* @__PURE__ */ new Set();
1954
1956
  function createMonacoWriterPlugin({ userRoot }) {
1955
1957
  return {
1956
1958
  name: "slidev:monaco-write",
@@ -2033,7 +2035,7 @@ const reMonacoWrite = /^\{monaco-write\}/;
2033
2035
  function transformSnippet({ s, slide, options }) {
2034
2036
  const watchFiles = options.data.watchFiles;
2035
2037
  const dir = path.dirname(slide.source?.filepath ?? options.entry ?? options.userRoot);
2036
- s.replace(/^<<<\s*(\S.*?)(#[\w-]+)?\s*(?:\s(\S+?))?\s*(\{.*)?$/gm, (full, filepath = "", regionName = "", lang = "", meta = "") => {
2038
+ s.replace(/^<<<[ \t]*(\S.*?)(#[\w-]+)?[ \t]*(?:[ \t](\S+?))?[ \t]*(\{.*)?$/gm, (full, filepath = "", regionName = "", lang = "", meta = "") => {
2037
2039
  const src = slash(/^@\//.test(filepath) ? path.resolve(options.userRoot, filepath.slice(2)) : path.resolve(dir, filepath));
2038
2040
  meta = meta.trim();
2039
2041
  lang = lang.trim();
@@ -2053,7 +2055,7 @@ function transformSnippet({ s, slide, options }) {
2053
2055
  const encoded = lz.compressToBase64(content);
2054
2056
  return `<Monaco writable=${JSON.stringify(filepath)} code-lz="${encoded}" lang="${lang}" v-bind="${meta}" />`;
2055
2057
  } else {
2056
- watchFiles[src] ??= new Set();
2058
+ watchFiles[src] ??= /* @__PURE__ */ new Set();
2057
2059
  watchFiles[src].add(slide.index);
2058
2060
  }
2059
2061
  return `\`\`\`${lang} ${meta}\n${content}\n\`\`\``;
@@ -2084,7 +2086,7 @@ async function getMarkdownTransformers(options) {
2084
2086
  //#endregion
2085
2087
  //#region node/vite/markdown.ts
2086
2088
  async function createMarkdownPlugin(options, { markdown: mdOptions }) {
2087
- const markdownTransformMap = new Map();
2089
+ const markdownTransformMap = /* @__PURE__ */ new Map();
2088
2090
  const transformers = await getMarkdownTransformers(options);
2089
2091
  return Markdown({
2090
2092
  include: [/\.md$/],
@@ -2305,11 +2307,15 @@ async function setupUnocss({ clientRoot, roots, data, utils }) {
2305
2307
  return "default" in loaded ? loaded.default : loaded;
2306
2308
  }))).filter((x) => !!x);
2307
2309
  }
2310
+ const tokens = await loadModule(resolve(clientRoot, ".generated/unocss-tokens.ts"));
2308
2311
  const configs = [
2309
- { presets: [presetIcons({
2310
- collectionsNodeResolvePath: utils.iconsResolvePath,
2311
- collections: { slidev: { logo: () => readFileSync(resolve(clientRoot, "assets/logo.svg"), "utf-8") } }
2312
- })] },
2312
+ {
2313
+ presets: [presetIcons({
2314
+ collectionsNodeResolvePath: utils.iconsResolvePath,
2315
+ collections: { slidev: { logo: () => readFileSync(resolve(clientRoot, "assets/logo.svg"), "utf-8") } }
2316
+ })],
2317
+ safelist: tokens
2318
+ },
2313
2319
  ...await loadFileConfigs(clientRoot),
2314
2320
  ...await loadSetups(roots, "unocss.ts", [], loadFileConfigs)
2315
2321
  ].filter(Boolean);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
3
  "type": "module",
4
- "version": "51.8.0",
4
+ "version": "51.8.2",
5
5
  "description": "Presentation slides for developers",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -44,18 +44,18 @@
44
44
  "dependencies": {
45
45
  "@antfu/ni": "^24.4.0",
46
46
  "@antfu/utils": "^9.2.0",
47
- "@iconify-json/carbon": "^1.2.8",
47
+ "@iconify-json/carbon": "^1.2.9",
48
48
  "@iconify-json/ph": "^1.2.2",
49
49
  "@iconify-json/svg-spinners": "^1.2.2",
50
50
  "@lillallol/outline-pdf": "^4.0.0",
51
- "@shikijs/markdown-it": "^3.4.2",
52
- "@shikijs/twoslash": "^3.4.2",
53
- "@shikijs/vitepress-twoslash": "^3.4.2",
54
- "@unocss/extractor-mdc": "^66.1.2",
55
- "@unocss/reset": "^66.1.2",
51
+ "@shikijs/markdown-it": "^3.6.0",
52
+ "@shikijs/twoslash": "^3.6.0",
53
+ "@shikijs/vitepress-twoslash": "^3.6.0",
54
+ "@unocss/extractor-mdc": "^66.2.0",
55
+ "@unocss/reset": "^66.2.0",
56
56
  "@vitejs/plugin-vue": "^5.2.4",
57
57
  "@vitejs/plugin-vue-jsx": "^4.2.0",
58
- "ansis": "^4.0.0",
58
+ "ansis": "^4.1.0",
59
59
  "chokidar": "^4.0.3",
60
60
  "cli-progress": "^3.12.0",
61
61
  "connect": "^3.7.0",
@@ -88,15 +88,15 @@
88
88
  "resolve-from": "^5.0.0",
89
89
  "resolve-global": "^2.0.0",
90
90
  "semver": "^7.7.2",
91
- "shiki": "^3.4.2",
91
+ "shiki": "^3.6.0",
92
92
  "shiki-magic-move": "^1.1.0",
93
93
  "sirv": "^3.0.1",
94
94
  "source-map-js": "^1.2.1",
95
95
  "typescript": "^5.8.3",
96
96
  "unhead": "^2.0.10",
97
- "unocss": "^66.1.2",
97
+ "unocss": "^66.2.0",
98
98
  "unplugin-icons": "^22.1.0",
99
- "unplugin-vue-components": "^28.5.0",
99
+ "unplugin-vue-components": "^28.7.0",
100
100
  "unplugin-vue-markdown": "^28.3.1",
101
101
  "untun": "^0.1.3",
102
102
  "uqr": "^0.1.2",
@@ -106,12 +106,12 @@
106
106
  "vite-plugin-static-copy": "^3.0.0",
107
107
  "vite-plugin-vue-server-ref": "^1.0.0",
108
108
  "vitefu": "^1.0.6",
109
- "vue": "^3.5.14",
109
+ "vue": "^3.5.16",
110
110
  "yaml": "^2.8.0",
111
111
  "yargs": "^17.7.2",
112
- "@slidev/types": "51.8.0",
113
- "@slidev/client": "51.8.0",
114
- "@slidev/parser": "51.8.0"
112
+ "@slidev/client": "51.8.2",
113
+ "@slidev/parser": "51.8.2",
114
+ "@slidev/types": "51.8.2"
115
115
  },
116
116
  "devDependencies": {
117
117
  "@hedgedoc/markdown-it-plugins": "^2.1.4",