@slidev/cli 0.48.0-beta.10 → 0.48.0-beta.12

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-VRC67DBV.mjs";
5
+ } from "./chunk-E34YDWCY.mjs";
6
6
  import "./chunk-O6TYYGU6.mjs";
7
7
  import {
8
8
  findPkgRoot
@@ -2496,7 +2496,7 @@ var require_semver2 = __commonJS({
2496
2496
  });
2497
2497
 
2498
2498
  // package.json
2499
- var version = "0.48.0-beta.10";
2499
+ var version = "0.48.0-beta.12";
2500
2500
 
2501
2501
  // node/common.ts
2502
2502
  import { existsSync, promises as fs } from "node:fs";
@@ -2654,6 +2654,7 @@ function createConfigPlugin(options) {
2654
2654
  resolve: {
2655
2655
  alias: {
2656
2656
  "@slidev/client/": `${toAtFS(options.clientRoot)}/`,
2657
+ "#slidev/": "/@slidev/",
2657
2658
  "vue": await resolveImportPath("vue/dist/vue.esm-browser.js", true)
2658
2659
  },
2659
2660
  dedupe: ["vue"]
@@ -2756,10 +2757,20 @@ md.use(mila, {
2756
2757
  rel: "noopener"
2757
2758
  }
2758
2759
  });
2759
- function renderNoteHTML(data) {
2760
+ function renderNote(text = "") {
2761
+ let clickCount = 0;
2762
+ const html = md.render(
2763
+ text.replace(/\[click(?::(\d+))?\]/gi, (_, count = 1) => {
2764
+ clickCount += Number(count);
2765
+ return `<span class="slidev-note-click-mark" data-clicks="${clickCount}"></span>`;
2766
+ })
2767
+ );
2768
+ return html;
2769
+ }
2770
+ function withRenderedNote(data) {
2760
2771
  return {
2761
2772
  ...data,
2762
- noteHTML: md.render(data?.note || "")
2773
+ noteHTML: renderNote(data?.note)
2763
2774
  };
2764
2775
  }
2765
2776
  function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOptions, serverOptions) {
@@ -2781,7 +2792,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOpt
2781
2792
  const [, no, type] = match;
2782
2793
  const idx = Number.parseInt(no);
2783
2794
  if (type === "json" && req.method === "GET") {
2784
- res.write(JSON.stringify(renderNoteHTML(data.slides[idx])));
2795
+ res.write(JSON.stringify(withRenderedNote(data.slides[idx])));
2785
2796
  return res.end();
2786
2797
  }
2787
2798
  if (type === "json" && req.method === "POST") {
@@ -2793,7 +2804,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOpt
2793
2804
  parser.prettifySlide(slide.source);
2794
2805
  await parser.save(data.markdownFiles[slide.source.filepath]);
2795
2806
  res.statusCode = 200;
2796
- res.write(JSON.stringify(renderNoteHTML(slide)));
2807
+ res.write(JSON.stringify(withRenderedNote(slide)));
2797
2808
  return res.end();
2798
2809
  }
2799
2810
  next();
@@ -2841,7 +2852,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOpt
2841
2852
  data: {
2842
2853
  id: i,
2843
2854
  note: b.note || "",
2844
- noteHTML: md.render(b.note || "")
2855
+ noteHTML: renderNote(b.note || "")
2845
2856
  }
2846
2857
  });
2847
2858
  }
@@ -2852,7 +2863,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOpt
2852
2863
  event: "slidev-update",
2853
2864
  data: {
2854
2865
  id: i,
2855
- data: renderNoteHTML(newData.slides[i])
2866
+ data: withRenderedNote(newData.slides[i])
2856
2867
  }
2857
2868
  });
2858
2869
  hmrPages.add(i);
@@ -2920,7 +2931,7 @@ ${title}
2920
2931
  };
2921
2932
  } else if (type === "frontmatter") {
2922
2933
  const slideBase = {
2923
- ...renderNoteHTML(slide),
2934
+ ...withRenderedNote(slide),
2924
2935
  frontmatter: void 0,
2925
2936
  source: void 0,
2926
2937
  // remove raw content in build, optimize the bundle size
@@ -3246,7 +3257,10 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
3246
3257
  const imports = [];
3247
3258
  const redirects = [];
3248
3259
  const layouts = await getLayouts();
3249
- imports.push(`import __layout__end from '${layouts.end}'`);
3260
+ imports.push(
3261
+ `import { markRaw } from 'vue'`,
3262
+ `import __layout__end from '${layouts.end}'`
3263
+ );
3250
3264
  let no = 1;
3251
3265
  const routes = data.slides.map((i, idx) => {
3252
3266
  imports.push(`import n${no} from '${slidePrefix}${idx + 1}.md'`);
@@ -3257,12 +3271,12 @@ ${Object.entries(layouts).map(([k, v]) => `"${k}": ${v}`).join(",\n")}
3257
3271
  no += 1;
3258
3272
  return route;
3259
3273
  });
3260
- const routesStr = `export default [
3274
+ const routesStr = `export const rawRoutes = [
3261
3275
  ${routes.join(",\n")}
3262
- ]`;
3276
+ ].map(markRaw)`;
3263
3277
  const redirectsStr = `export const redirects = [
3264
3278
  ${redirects.join(",\n")}
3265
- ]`;
3279
+ ].map(markRaw)`;
3266
3280
  return [...imports, routesStr, redirectsStr].join("\n");
3267
3281
  }
3268
3282
  function getTitle() {
@@ -4,7 +4,7 @@ import {
4
4
  mergeViteConfigs,
5
5
  require_semver,
6
6
  version
7
- } from "./chunk-VRC67DBV.mjs";
7
+ } from "./chunk-E34YDWCY.mjs";
8
8
  import {
9
9
  createResolver,
10
10
  getRoots,
package/dist/cli.mjs CHANGED
@@ -5,10 +5,10 @@ import {
5
5
  resolveAddons,
6
6
  resolveOptions,
7
7
  resolveTheme
8
- } from "./chunk-W4YOBANG.mjs";
8
+ } from "./chunk-YLK3KG3T.mjs";
9
9
  import {
10
10
  version
11
- } from "./chunk-VRC67DBV.mjs";
11
+ } from "./chunk-E34YDWCY.mjs";
12
12
  import {
13
13
  loadSetups
14
14
  } from "./chunk-O6TYYGU6.mjs";
@@ -277,7 +277,7 @@ cli.command(
277
277
  }).strict().help(),
278
278
  async (args) => {
279
279
  const { entry, theme, watch, base, download, out, inspect } = args;
280
- const { build } = await import("./build-3Z2FXQKW.mjs");
280
+ const { build } = await import("./build-CLZFYNH7.mjs");
281
281
  for (const entryFile of entry) {
282
282
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
283
283
  if (download && !options.data.config.download)
package/dist/index.mjs CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createServer,
3
3
  parser,
4
4
  resolveOptions
5
- } from "./chunk-W4YOBANG.mjs";
5
+ } from "./chunk-YLK3KG3T.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
- } from "./chunk-VRC67DBV.mjs";
8
+ } from "./chunk-E34YDWCY.mjs";
9
9
  import "./chunk-O6TYYGU6.mjs";
10
10
  import "./chunk-7HOZGSL4.mjs";
11
11
  import "./chunk-BXO7ZPPU.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.48.0-beta.10",
3
+ "version": "0.48.0-beta.12",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -104,9 +104,9 @@
104
104
  "vitefu": "^0.2.5",
105
105
  "vue": "^3.4.19",
106
106
  "yargs": "^17.7.2",
107
- "@slidev/client": "0.48.0-beta.10",
108
- "@slidev/types": "0.48.0-beta.10",
109
- "@slidev/parser": "0.48.0-beta.10"
107
+ "@slidev/parser": "0.48.0-beta.12",
108
+ "@slidev/types": "0.48.0-beta.12",
109
+ "@slidev/client": "0.48.0-beta.12"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@hedgedoc/markdown-it-plugins": "^2.1.4",