@slidev/cli 0.49.0-beta.6 → 0.49.0

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-DF3ZEVPQ.mjs";
5
+ } from "./chunk-EQDFZFKJ.mjs";
6
6
  import "./chunk-LOUKLO2C.mjs";
7
7
  import "./chunk-ALXAQLRA.mjs";
8
8
  import "./chunk-BXO7ZPPU.mjs";
@@ -304,13 +304,13 @@ var require_directives = __commonJS({
304
304
  onError(0, "%YAML directive should contain exactly one part");
305
305
  return false;
306
306
  }
307
- const [version] = parts;
308
- if (version === "1.1" || version === "1.2") {
309
- this.yaml.version = version;
307
+ const [version2] = parts;
308
+ if (version2 === "1.1" || version2 === "1.2") {
309
+ this.yaml.version = version2;
310
310
  return true;
311
311
  } else {
312
- const isValid = /^\d+\.\d+$/.test(version);
313
- onError(6, `Unsupported YAML version ${version}`, isValid);
312
+ const isValid = /^\d+\.\d+$/.test(version2);
313
+ onError(6, `Unsupported YAML version ${version2}`, isValid);
314
314
  return false;
315
315
  }
316
316
  }
@@ -3331,14 +3331,14 @@ var require_Document = __commonJS({
3331
3331
  version: "1.2"
3332
3332
  }, options);
3333
3333
  this.options = opt;
3334
- let { version } = opt;
3334
+ let { version: version2 } = opt;
3335
3335
  if (options?._directives) {
3336
3336
  this.directives = options._directives.atDocument();
3337
3337
  if (this.directives.yaml.explicit)
3338
- version = this.directives.yaml.version;
3338
+ version2 = this.directives.yaml.version;
3339
3339
  } else
3340
- this.directives = new directives.Directives({ version });
3341
- this.setSchema(version, options);
3340
+ this.directives = new directives.Directives({ version: version2 });
3341
+ this.setSchema(version2, options);
3342
3342
  this.contents = value === void 0 ? null : this.createNode(value, _replacer, options);
3343
3343
  }
3344
3344
  /**
@@ -3518,11 +3518,11 @@ var require_Document = __commonJS({
3518
3518
  *
3519
3519
  * Overrides all previously set schema options.
3520
3520
  */
3521
- setSchema(version, options = {}) {
3522
- if (typeof version === "number")
3523
- version = String(version);
3521
+ setSchema(version2, options = {}) {
3522
+ if (typeof version2 === "number")
3523
+ version2 = String(version2);
3524
3524
  let opt;
3525
- switch (version) {
3525
+ switch (version2) {
3526
3526
  case "1.1":
3527
3527
  if (this.directives)
3528
3528
  this.directives.yaml.version = "1.1";
@@ -3533,9 +3533,9 @@ var require_Document = __commonJS({
3533
3533
  case "1.2":
3534
3534
  case "next":
3535
3535
  if (this.directives)
3536
- this.directives.yaml.version = version;
3536
+ this.directives.yaml.version = version2;
3537
3537
  else
3538
- this.directives = new directives.Directives({ version });
3538
+ this.directives = new directives.Directives({ version: version2 });
3539
3539
  opt = { merge: false, resolveKnownTags: true, schema: "core" };
3540
3540
  break;
3541
3541
  case null:
@@ -3544,7 +3544,7 @@ var require_Document = __commonJS({
3544
3544
  opt = null;
3545
3545
  break;
3546
3546
  default: {
3547
- const sv = JSON.stringify(version);
3547
+ const sv = JSON.stringify(version2);
3548
3548
  throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);
3549
3549
  }
3550
3550
  }
@@ -7142,10 +7142,40 @@ var require_dist = __commonJS({
7142
7142
  }
7143
7143
  });
7144
7144
 
7145
+ // package.json
7146
+ var version = "0.49.0";
7147
+
7145
7148
  // node/commands/shared.ts
7146
7149
  import { existsSync, promises as fs } from "node:fs";
7147
7150
  import { join } from "node:path";
7148
7151
  import { loadConfigFromFile, mergeConfig, resolveConfig } from "vite";
7152
+ import { isString } from "unocss";
7153
+ import MarkdownIt from "markdown-it";
7154
+ import { slash } from "@antfu/utils";
7155
+
7156
+ // node/syntax/markdown-it/markdown-it-link.ts
7157
+ function markdownItLink(md) {
7158
+ const defaultRender = md.renderer.rules.link_open ?? ((tokens, idx, options, _env, self) => self.renderToken(tokens, idx, options));
7159
+ md.renderer.rules.link_open = function(tokens, idx, options, env, self) {
7160
+ const token = tokens[idx];
7161
+ const hrefIndex = token.attrIndex("href");
7162
+ const attr = token.attrs?.[hrefIndex];
7163
+ const href = attr?.[1] ?? "";
7164
+ if ("./#".includes(href[0]) || /^\d+$/.test(href)) {
7165
+ token.tag = "Link";
7166
+ attr[0] = "to";
7167
+ for (let i = idx + 1; i < tokens.length; i++) {
7168
+ if (tokens[i].type === "link_close") {
7169
+ tokens[i].tag = "Link";
7170
+ break;
7171
+ }
7172
+ }
7173
+ } else if (token.attrGet("target") == null) {
7174
+ token.attrPush(["target", "_blank"]);
7175
+ }
7176
+ return defaultRender(tokens, idx, options, env, self);
7177
+ };
7178
+ }
7149
7179
 
7150
7180
  // node/utils.ts
7151
7181
  var import_yaml = __toESM(require_dist());
@@ -7192,11 +7222,34 @@ function updateFrontmatterPatch(slide, frontmatter) {
7192
7222
  }
7193
7223
 
7194
7224
  // node/commands/shared.ts
7195
- async function getIndexHtml({ clientRoot, roots, data }) {
7225
+ var sharedMd = MarkdownIt({ html: true });
7226
+ sharedMd.use(markdownItLink);
7227
+ function getTitle(data) {
7228
+ if (isString(data.config.title)) {
7229
+ const tokens = sharedMd.parseInline(data.config.title, {});
7230
+ return stringifyMarkdownTokens(tokens);
7231
+ }
7232
+ return data.config.title;
7233
+ }
7234
+ function escapeHtml(unsafe) {
7235
+ return JSON.stringify(
7236
+ String(unsafe).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;")
7237
+ );
7238
+ }
7239
+ async function getIndexHtml({ entry, clientRoot, roots, data }) {
7196
7240
  let main = await fs.readFile(join(clientRoot, "index.html"), "utf-8");
7197
7241
  let head = "";
7198
7242
  let body = "";
7199
- head += `<link rel="icon" href="${data.config.favicon}">`;
7243
+ const { info, author, keywords } = data.headmatter;
7244
+ head += [
7245
+ `<meta name="slidev:version" content="${version}">`,
7246
+ `<meta charset="slidev:entry" content="${slash(entry)}">`,
7247
+ `<link rel="icon" href="${data.config.favicon}">`,
7248
+ `<title>${getTitle(data)}</title>`,
7249
+ info && `<meta name="description" content=${escapeHtml(info)}>`,
7250
+ author && `<meta name="author" content=${escapeHtml(author)}>`,
7251
+ keywords && `<meta name="keywords" content=${escapeHtml(Array.isArray(keywords) ? keywords.join(", ") : keywords)}>`
7252
+ ].filter(Boolean).join("\n");
7200
7253
  for (const root of roots) {
7201
7254
  const path3 = join(root, "index.html");
7202
7255
  if (!existsSync(path3))
@@ -7301,7 +7354,7 @@ ${value}
7301
7354
  import { join as join3 } from "node:path";
7302
7355
  import { fileURLToPath, pathToFileURL } from "node:url";
7303
7356
  import { mergeConfig as mergeConfig2 } from "vite";
7304
- import { slash, uniq } from "@antfu/utils";
7357
+ import { slash as slash2, uniq } from "@antfu/utils";
7305
7358
  import { createResolve } from "mlly";
7306
7359
  var INCLUDE_GLOBAL = [
7307
7360
  "@shikijs/monaco",
@@ -7431,7 +7484,7 @@ function createConfigPlugin(options) {
7431
7484
  options.userWorkspaceRoot,
7432
7485
  options.clientRoot,
7433
7486
  // Special case for PNPM global installation
7434
- isInstalledGlobally.value ? slash(options.cliRoot).replace(/\/\.pnpm\/.*$/ig, "") : options.cliRoot,
7487
+ isInstalledGlobally.value ? slash2(options.cliRoot).replace(/\/\.pnpm\/.*$/ig, "") : options.cliRoot,
7435
7488
  ...options.roots
7436
7489
  ])
7437
7490
  }
@@ -7505,21 +7558,20 @@ function getDefine(options) {
7505
7558
 
7506
7559
  // node/vite/loaders.ts
7507
7560
  import path from "node:path";
7508
- import { isString as isString2, isTruthy, notNullish, range } from "@antfu/utils";
7561
+ import { notNullish, range } from "@antfu/utils";
7509
7562
  import fg3 from "fast-glob";
7510
- import Markdown from "markdown-it";
7511
7563
  import { bold, gray, red, yellow } from "kolorist";
7512
7564
  import * as parser from "@slidev/parser/fs";
7513
7565
  import equal from "fast-deep-equal";
7514
7566
 
7515
7567
  // node/virtual/configs.ts
7516
- import { isString } from "@antfu/utils";
7568
+ import { isString as isString2 } from "@antfu/utils";
7517
7569
  var templateConfigs = {
7518
7570
  id: "/@slidev/configs",
7519
- getContent: async ({ data, remote }, { md: md2 }) => {
7520
- function getTitle() {
7521
- if (isString(data.config.title)) {
7522
- const tokens = md2.parseInline(data.config.title, {});
7571
+ getContent: async ({ data, remote }, { md }) => {
7572
+ function getTitle2() {
7573
+ if (isString2(data.config.title)) {
7574
+ const tokens = md.parseInline(data.config.title, {});
7523
7575
  return stringifyMarkdownTokens(tokens);
7524
7576
  }
7525
7577
  return data.config.title;
@@ -7527,10 +7579,10 @@ var templateConfigs = {
7527
7579
  const config = {
7528
7580
  ...data.config,
7529
7581
  remote,
7530
- title: getTitle()
7582
+ title: getTitle2()
7531
7583
  };
7532
- if (isString(config.info))
7533
- config.info = md2.render(config.info);
7584
+ if (isString2(config.info))
7585
+ config.info = md.render(config.info);
7534
7586
  return `export default ${JSON.stringify(config)}`;
7535
7587
  }
7536
7588
  };
@@ -7960,30 +8012,6 @@ var templates = [
7960
8012
  templateLegacyTitles
7961
8013
  ];
7962
8014
 
7963
- // node/syntax/markdown-it/markdown-it-link.ts
7964
- function markdownItLink(md2) {
7965
- const defaultRender = md2.renderer.rules.link_open ?? ((tokens, idx, options, _env, self) => self.renderToken(tokens, idx, options));
7966
- md2.renderer.rules.link_open = function(tokens, idx, options, env, self) {
7967
- const token = tokens[idx];
7968
- const hrefIndex = token.attrIndex("href");
7969
- const attr = token.attrs?.[hrefIndex];
7970
- const href = attr?.[1] ?? "";
7971
- if ("./#".includes(href[0]) || /^\d+$/.test(href)) {
7972
- token.tag = "Link";
7973
- attr[0] = "to";
7974
- for (let i = idx + 1; i < tokens.length; i++) {
7975
- if (tokens[i].type === "link_close") {
7976
- tokens[i].tag = "Link";
7977
- break;
7978
- }
7979
- }
7980
- } else if (token.attrGet("target") == null) {
7981
- token.attrPush(["target", "_blank"]);
7982
- }
7983
- return defaultRender(tokens, idx, options, env, self);
7984
- };
7985
- }
7986
-
7987
8015
  // node/vite/loaders.ts
7988
8016
  var regexId = /^\/\@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
7989
8017
  var regexIdQuery = /(\d+?)\.(md|json|frontmatter)$/;
@@ -8008,11 +8036,9 @@ function getBodyJson(req) {
8008
8036
  });
8009
8037
  });
8010
8038
  }
8011
- var md = Markdown({ html: true });
8012
- md.use(markdownItLink);
8013
8039
  function renderNote(text = "") {
8014
8040
  let clickCount = 0;
8015
- const html = md.render(
8041
+ const html = sharedMd.render(
8016
8042
  text.replace(/\[click(?::(\d+))?\]/gi, (_, count = 1) => {
8017
8043
  clickCount += Number(count);
8018
8044
  return `<span class="slidev-note-click-mark" data-clicks="${clickCount}"></span>`;
@@ -8034,7 +8060,7 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8034
8060
  let skipHmr = null;
8035
8061
  const { data, clientRoot, roots, mode } = options;
8036
8062
  const templateCtx = {
8037
- md,
8063
+ md: sharedMd,
8038
8064
  async getLayouts() {
8039
8065
  const now = Date.now();
8040
8066
  if (now - _layouts_cache_time < 2e3)
@@ -8279,8 +8305,7 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8279
8305
  const [, no, type] = match;
8280
8306
  if (type !== "md")
8281
8307
  return;
8282
- const pageNo = Number.parseInt(no) - 1;
8283
- return transformMarkdown(code, pageNo);
8308
+ return transformMarkdown(code, +no - 1);
8284
8309
  }
8285
8310
  },
8286
8311
  {
@@ -8302,39 +8327,6 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8302
8327
  if (replaced !== code)
8303
8328
  return replaced;
8304
8329
  }
8305
- },
8306
- {
8307
- name: "slidev:index-html-transform",
8308
- transformIndexHtml() {
8309
- const { info, author, keywords } = data.headmatter;
8310
- return [
8311
- {
8312
- tag: "title",
8313
- children: getTitle()
8314
- },
8315
- info && {
8316
- tag: "meta",
8317
- attrs: {
8318
- name: "description",
8319
- content: info
8320
- }
8321
- },
8322
- author && {
8323
- tag: "meta",
8324
- attrs: {
8325
- name: "author",
8326
- content: author
8327
- }
8328
- },
8329
- keywords && {
8330
- tag: "meta",
8331
- attrs: {
8332
- name: "keywords",
8333
- content: Array.isArray(keywords) ? keywords.join(", ") : keywords
8334
- }
8335
- }
8336
- ].filter(isTruthy);
8337
- }
8338
8330
  }
8339
8331
  ];
8340
8332
  function updateServerWatcher() {
@@ -8348,10 +8340,10 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8348
8340
  ...data.slides[pageNo]?.frontmatter || {}
8349
8341
  };
8350
8342
  }
8351
- async function transformMarkdown(code, pageNo) {
8343
+ async function transformMarkdown(code, index) {
8352
8344
  const layouts = await templateCtx.getLayouts();
8353
- const frontmatter = getFrontmatter(pageNo);
8354
- let layoutName = frontmatter?.layout || (pageNo === 0 ? "cover" : "default");
8345
+ const frontmatter = getFrontmatter(index);
8346
+ let layoutName = frontmatter?.layout || (index === 0 ? "cover" : "default");
8355
8347
  if (!layouts[layoutName]) {
8356
8348
  console.error(red(`
8357
8349
  Unknown layout "${bold(layoutName)}".${yellow(" Available layouts are:")}`) + Object.keys(layouts).map((i, idx) => (idx % 3 === 0 ? "\n " : "") + gray(i.padEnd(15, " "))).join(" "));
@@ -8361,7 +8353,7 @@ Unknown layout "${bold(layoutName)}".${yellow(" Available layouts are:")}`) + Ob
8361
8353
  delete frontmatter.title;
8362
8354
  const imports = [
8363
8355
  `import InjectedLayout from "${toAtFS(layouts[layoutName])}"`,
8364
- `import frontmatter from "${toAtFS(`${VIRTUAL_SLIDE_PREFIX + (pageNo + 1)}.frontmatter`)}"`,
8356
+ `import frontmatter from "${toAtFS(`${VIRTUAL_SLIDE_PREFIX + (index + 1)}.frontmatter`)}"`,
8365
8357
  templateImportContextUtils,
8366
8358
  "_provideFrontmatter(frontmatter)",
8367
8359
  templateInitContext,
@@ -8376,7 +8368,7 @@ ${imports.join("\n")}
8376
8368
  if (body.startsWith("<div>") && body.endsWith("</div>"))
8377
8369
  body = body.slice(5, -6);
8378
8370
  code = `${code.slice(0, injectA)}
8379
- <InjectedLayout v-bind="_frontmatterToProps(frontmatter,${pageNo})">
8371
+ <InjectedLayout v-bind="_frontmatterToProps(frontmatter,${index})">
8380
8372
  ${body}
8381
8373
  </InjectedLayout>
8382
8374
  ${code.slice(injectB)}`;
@@ -8433,18 +8425,11 @@ ${imports.join("\n")}
8433
8425
  </script>
8434
8426
  ${code}`;
8435
8427
  }
8436
- function getTitle() {
8437
- if (isString2(data.config.title)) {
8438
- const tokens = md.parseInline(data.config.title, {});
8439
- return stringifyMarkdownTokens(tokens);
8440
- }
8441
- return data.config.title;
8442
- }
8443
8428
  }
8444
8429
 
8445
8430
  // node/vite/markdown.ts
8446
- import Markdown2 from "unplugin-vue-markdown/vite";
8447
- import { isTruthy as isTruthy2, slash as slash3 } from "@antfu/utils";
8431
+ import Markdown from "unplugin-vue-markdown/vite";
8432
+ import { isTruthy, slash as slash4 } from "@antfu/utils";
8448
8433
 
8449
8434
  // ../../node_modules/.pnpm/@hedgedoc+markdown-it-plugins@2.1.4_patch_hash=tuyuxytl56b2vxulpkzt2wf4o4_markdown-it@14.1.0/node_modules/@hedgedoc/markdown-it-plugins/dist/esm/image-size/specialCharacters.js
8450
8435
  var SpecialCharacters;
@@ -8465,9 +8450,9 @@ var SpecialCharacters;
8465
8450
  // ../../node_modules/.pnpm/@hedgedoc+markdown-it-plugins@2.1.4_patch_hash=tuyuxytl56b2vxulpkzt2wf4o4_markdown-it@14.1.0/node_modules/@hedgedoc/markdown-it-plugins/dist/esm/task-lists/index.js
8466
8451
  import Token from "markdown-it/lib/token.mjs";
8467
8452
  var checkboxRegex = /^ *\[([\sx])] /i;
8468
- function taskLists(md2, options = { enabled: false, label: false, lineNumber: false }) {
8469
- md2.core.ruler.after("inline", "task-lists", (state) => processToken(state, options));
8470
- md2.renderer.rules.taskListItemCheckbox = (tokens) => {
8453
+ function taskLists(md, options = { enabled: false, label: false, lineNumber: false }) {
8454
+ md.core.ruler.after("inline", "task-lists", (state) => processToken(state, options));
8455
+ md.renderer.rules.taskListItemCheckbox = (tokens) => {
8471
8456
  const token = tokens[0];
8472
8457
  const checkedAttribute = token.attrGet("checked") ? 'checked="" ' : "";
8473
8458
  const disabledAttribute = token.attrGet("disabled") ? 'disabled="" ' : "";
@@ -8476,10 +8461,10 @@ function taskLists(md2, options = { enabled: false, label: false, lineNumber: fa
8476
8461
  const dataLineAttribute = line && options.lineNumber ? `data-line="${line}" ` : "";
8477
8462
  return `<input class="task-list-item-checkbox" type="checkbox" ${checkedAttribute}${disabledAttribute}${dataLineAttribute}${idAttribute}/>`;
8478
8463
  };
8479
- md2.renderer.rules.taskListItemLabel_close = () => {
8464
+ md.renderer.rules.taskListItemLabel_close = () => {
8480
8465
  return "</label>";
8481
8466
  };
8482
- md2.renderer.rules.taskListItemLabel_open = (tokens) => {
8467
+ md.renderer.rules.taskListItemLabel_open = (tokens) => {
8483
8468
  const token = tokens[0];
8484
8469
  const id = token.attrGet("id");
8485
8470
  return `<label for="${id}">`;
@@ -8686,7 +8671,7 @@ function math_block(state, start, end, silent) {
8686
8671
  token.markup = "$$";
8687
8672
  return true;
8688
8673
  }
8689
- function math_plugin(md2, options) {
8674
+ function math_plugin(md, options) {
8690
8675
  options = options || {};
8691
8676
  const katexInline = function(latex) {
8692
8677
  options.displayMode = false;
@@ -8715,12 +8700,12 @@ function math_plugin(md2, options) {
8715
8700
  return `${katexBlock(tokens[idx].content)}
8716
8701
  `;
8717
8702
  };
8718
- md2.inline.ruler.after("escape", "math_inline", math_inline);
8719
- md2.block.ruler.after("blockquote", "math_block", math_block, {
8703
+ md.inline.ruler.after("escape", "math_inline", math_inline);
8704
+ md.block.ruler.after("blockquote", "math_block", math_block, {
8720
8705
  alt: ["paragraph", "reference", "blockquote", "list"]
8721
8706
  });
8722
- md2.renderer.rules.math_inline = inlineRenderer;
8723
- md2.renderer.rules.math_block = blockRenderer;
8707
+ md.renderer.rules.math_inline = inlineRenderer;
8708
+ md.renderer.rules.math_block = blockRenderer;
8724
8709
  }
8725
8710
 
8726
8711
  // node/syntax/markdown-it/markdown-it-prism.ts
@@ -8733,12 +8718,12 @@ import * as htmlparser2 from "htmlparser2";
8733
8718
  function normalizeRangeStr(rangeStr = "") {
8734
8719
  return !rangeStr.trim() ? [] : rangeStr.trim().split(/\|/g).map((i) => i.trim());
8735
8720
  }
8736
- function getCodeBlocks(md2) {
8737
- const codeblocks = Array.from(md2.matchAll(/^```[\s\S]*?^```/mg)).map((m) => {
8721
+ function getCodeBlocks(md) {
8722
+ const codeblocks = Array.from(md.matchAll(/^```[\s\S]*?^```/mg)).map((m) => {
8738
8723
  const start = m.index;
8739
8724
  const end = m.index + m[0].length;
8740
- const startLine = md2.slice(0, start).match(/\n/g)?.length || 0;
8741
- const endLine = md2.slice(0, end).match(/\n/g)?.length || 0;
8725
+ const startLine = md.slice(0, start).match(/\n/g)?.length || 0;
8726
+ const endLine = md.slice(0, end).match(/\n/g)?.length || 0;
8742
8727
  return [start, end, startLine, endLine];
8743
8728
  });
8744
8729
  return {
@@ -8751,8 +8736,8 @@ function getCodeBlocks(md2) {
8751
8736
  }
8752
8737
  };
8753
8738
  }
8754
- function escapeVueInCode(md2) {
8755
- return md2.replace(/{{/g, "&lbrace;&lbrace;");
8739
+ function escapeVueInCode(md) {
8740
+ return md.replace(/{{/g, "&lbrace;&lbrace;");
8756
8741
  }
8757
8742
 
8758
8743
  // node/syntax/markdown-it/markdown-it-prism.ts
@@ -8854,7 +8839,7 @@ function markdownItPrism(markdownit, useroptions) {
8854
8839
 
8855
8840
  // node/syntax/markdown-it/markdown-it-v-drag.ts
8856
8841
  import { SourceMapConsumer } from "source-map-js";
8857
- function markdownItVDrag(md2, markdownTransformMap) {
8842
+ function markdownItVDrag(md, markdownTransformMap) {
8858
8843
  const visited = /* @__PURE__ */ new WeakSet();
8859
8844
  const sourceMapConsumers = /* @__PURE__ */ new WeakMap();
8860
8845
  function getSourceMapConsumer(id) {
@@ -8872,8 +8857,8 @@ function markdownItVDrag(md2, markdownTransformMap) {
8872
8857
  sourceMapConsumers.set(s, smc);
8873
8858
  return smc;
8874
8859
  }
8875
- const _parse = md2.parse;
8876
- md2.parse = function(src, env) {
8860
+ const _parse = md.parse;
8861
+ md.parse = function(src, env) {
8877
8862
  const smc = getSourceMapConsumer(env.id);
8878
8863
  const toOriginalPos = smc ? (line) => smc.originalPositionFor({ line, column: 0 }).line : (line) => line;
8879
8864
  function toMarkdownSource(map, idx) {
@@ -8970,7 +8955,7 @@ function transformPlantUml(ctx) {
8970
8955
  // node/syntax/transform/snippet.ts
8971
8956
  import path2 from "node:path";
8972
8957
  import fs4 from "fs-extra";
8973
- import { slash as slash2 } from "@antfu/utils";
8958
+ import { slash as slash3 } from "@antfu/utils";
8974
8959
  function dedent(text) {
8975
8960
  const lines = text.split("\n");
8976
8961
  const minIndentLength = lines.reduce((acc, line) => {
@@ -9034,7 +9019,7 @@ function transformSnippet(ctx) {
9034
9019
  /^<<< *(.+?)(#[\w-]+)? *(?: (\S+?))? *(\{.*)?$/mg,
9035
9020
  (full, filepath = "", regionName = "", lang = "", meta = "") => {
9036
9021
  const firstLine = `\`\`\`${lang || path2.extname(filepath).slice(1)} ${meta}`;
9037
- const src = slash2(
9022
+ const src = slash3(
9038
9023
  /^\@[\/]/.test(filepath) ? path2.resolve(options.userRoot, filepath.slice(2)) : path2.resolve(dir, filepath)
9039
9024
  );
9040
9025
  data.watchFiles.push(src);
@@ -9169,23 +9154,23 @@ $$
9169
9154
  async function createMarkdownPlugin(options, { markdown: mdOptions }) {
9170
9155
  const { data: { config }, roots, mode, entry, clientRoot } = options;
9171
9156
  const setups = [];
9172
- const entryPath = slash3(entry);
9157
+ const entryPath = slash4(entry);
9173
9158
  let shiki;
9174
9159
  let shikiOptions;
9175
9160
  if (config.highlighter === "shiki") {
9176
9161
  const result = await createMarkdownItShiki(clientRoot, roots, config, mode);
9177
9162
  shiki = result.shiki;
9178
9163
  shikiOptions = result.shikiOptions;
9179
- setups.push((md2) => md2.use(result.plugin));
9164
+ setups.push((md) => md.use(result.plugin));
9180
9165
  } else {
9181
9166
  console.warn("[Slidev] Highlighter: Prism highlighter is deprecated, and will be removed in v0.50. Refer to https://github.com/slidevjs/slidev/issues/1390");
9182
- setups.push((md2) => md2.use(markdownItPrism));
9167
+ setups.push((md) => md.use(markdownItPrism));
9183
9168
  }
9184
9169
  if (config.mdc)
9185
- setups.push((md2) => md2.use(MarkdownItMdc));
9170
+ setups.push((md) => md.use(MarkdownItMdc));
9186
9171
  const KatexOptions = await loadSetups(options.clientRoot, roots, "katex.ts", {}, { strict: false }, false);
9187
9172
  const markdownTransformMap = /* @__PURE__ */ new Map();
9188
- return Markdown2({
9173
+ return Markdown({
9189
9174
  include: [/\.md$/],
9190
9175
  wrapperClasses: "",
9191
9176
  headEnabled: false,
@@ -9199,15 +9184,15 @@ async function createMarkdownPlugin(options, { markdown: mdOptions }) {
9199
9184
  ...mdOptions?.markdownItOptions
9200
9185
  },
9201
9186
  ...mdOptions,
9202
- markdownItSetup(md2) {
9203
- md2.use(markdownItLink);
9204
- md2.use(MarkdownItEscapeInlineCode);
9205
- md2.use(MarkdownItFootnote);
9206
- md2.use(taskLists, { enabled: true, lineNumber: true, label: true });
9207
- md2.use(math_plugin, KatexOptions);
9208
- md2.use(markdownItVDrag, markdownTransformMap);
9209
- setups.forEach((i) => i(md2));
9210
- mdOptions?.markdownItSetup?.(md2);
9187
+ markdownItSetup(md) {
9188
+ md.use(markdownItLink);
9189
+ md.use(MarkdownItEscapeInlineCode);
9190
+ md.use(MarkdownItFootnote);
9191
+ md.use(taskLists, { enabled: true, lineNumber: true, label: true });
9192
+ md.use(math_plugin, KatexOptions);
9193
+ md.use(markdownItVDrag, markdownTransformMap);
9194
+ setups.forEach((i) => i(md));
9195
+ mdOptions?.markdownItSetup?.(md);
9211
9196
  },
9212
9197
  transforms: {
9213
9198
  before(code, id) {
@@ -9262,7 +9247,7 @@ async function createMarkdownItShiki(clientRoot, roots, config, mode) {
9262
9247
  return escapeVueInCode(code);
9263
9248
  }
9264
9249
  }
9265
- ].filter(isTruthy2);
9250
+ ].filter(isTruthy);
9266
9251
  const plugin = markdownItShiki(shiki, {
9267
9252
  ...shikiOptions,
9268
9253
  transformers
@@ -9273,9 +9258,9 @@ async function createMarkdownItShiki(clientRoot, roots, config, mode) {
9273
9258
  plugin
9274
9259
  };
9275
9260
  }
9276
- function MarkdownItEscapeInlineCode(md2) {
9277
- const codeInline = md2.renderer.rules.code_inline;
9278
- md2.renderer.rules.code_inline = (tokens, idx, options, env, self) => {
9261
+ function MarkdownItEscapeInlineCode(md) {
9262
+ const codeInline = md.renderer.rules.code_inline;
9263
+ md.renderer.rules.code_inline = (tokens, idx, options, env, self) => {
9279
9264
  const result = codeInline(tokens, idx, options, env, self);
9280
9265
  return result.replace(/^<code/, "<code v-pre");
9281
9266
  };
@@ -9327,7 +9312,7 @@ function createVueCompilerFlagsPlugin(options) {
9327
9312
  // node/vite/monacoTypes.ts
9328
9313
  import fs5 from "node:fs/promises";
9329
9314
  import { dirname as dirname2, resolve as resolve4 } from "node:path";
9330
- import { slash as slash4 } from "@antfu/utils";
9315
+ import { slash as slash5 } from "@antfu/utils";
9331
9316
  import fg4 from "fast-glob";
9332
9317
  import { findDepPkgJsonPath } from "vitefu";
9333
9318
  function createMonacoTypesLoader({ userRoot }) {
@@ -9354,8 +9339,8 @@ function createMonacoTypesLoader({ userRoot }) {
9354
9339
  const pkgJson = JSON.parse(await fs5.readFile(pkgJsonPath, "utf-8"));
9355
9340
  const deps = pkgJson.dependencies ?? {};
9356
9341
  return [
9357
- `import "/@slidev-monaco-types/load?root=${slash4(root)}&name=${pkgJson.name}"`,
9358
- ...Object.keys(deps).map((dep) => `import "/@slidev-monaco-types/resolve?pkg=${dep}&importer=${slash4(root)}"`)
9342
+ `import "/@slidev-monaco-types/load?root=${slash5(root)}&name=${pkgJson.name}"`,
9343
+ ...Object.keys(deps).map((dep) => `import "/@slidev-monaco-types/resolve?pkg=${dep}&importer=${slash5(root)}"`)
9359
9344
  ].join("\n");
9360
9345
  }
9361
9346
  const matchLoad = id.match(/^\/\@slidev-monaco-types\/load\?root=(.*?)&name=(.*)$/);
@@ -9541,6 +9526,7 @@ async function ViteSlidevPlugin(options, pluginOptions, serverOptions = {}) {
9541
9526
  }
9542
9527
 
9543
9528
  export {
9529
+ version,
9544
9530
  getIndexHtml,
9545
9531
  mergeViteConfigs,
9546
9532
  ViteSlidevPlugin
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  ViteSlidevPlugin,
3
- mergeViteConfigs
4
- } from "./chunk-DF3ZEVPQ.mjs";
3
+ mergeViteConfigs,
4
+ version
5
+ } from "./chunk-EQDFZFKJ.mjs";
5
6
  import {
6
7
  createResolver,
7
8
  getRoots,
@@ -47,9 +48,6 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
47
48
  // node/parser.ts
48
49
  import * as parser from "@slidev/parser/fs";
49
50
 
50
- // package.json
51
- var version = "0.49.0-beta.6";
52
-
53
51
  // node/integrations/themes.ts
54
52
  import { join as join2 } from "node:path";
55
53
  import fs from "fs-extra";
@@ -148,7 +146,6 @@ async function resolveOptions(options, mode) {
148
146
  export {
149
147
  createServer,
150
148
  parser,
151
- version,
152
149
  resolveTheme,
153
150
  getThemeMeta,
154
151
  resolveAddons,
package/dist/cli.mjs CHANGED
@@ -4,10 +4,11 @@ import {
4
4
  parser,
5
5
  resolveAddons,
6
6
  resolveOptions,
7
- resolveTheme,
7
+ resolveTheme
8
+ } from "./chunk-EUUONAZW.mjs";
9
+ import {
8
10
  version
9
- } from "./chunk-R7SOIPTZ.mjs";
10
- import "./chunk-DF3ZEVPQ.mjs";
11
+ } from "./chunk-EQDFZFKJ.mjs";
11
12
  import {
12
13
  loadSetups
13
14
  } from "./chunk-LOUKLO2C.mjs";
@@ -326,7 +327,7 @@ cli.command(
326
327
  }).strict().help(),
327
328
  async (args) => {
328
329
  const { entry, theme, watch, base, download, out, inspect } = args;
329
- const { build } = await import("./build-4R4CW3SG.mjs");
330
+ const { build } = await import("./build-X6PKMCFT.mjs");
330
331
  for (const entryFile of entry) {
331
332
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
332
333
  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-R7SOIPTZ.mjs";
5
+ } from "./chunk-EUUONAZW.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
- } from "./chunk-DF3ZEVPQ.mjs";
8
+ } from "./chunk-EQDFZFKJ.mjs";
9
9
  import "./chunk-LOUKLO2C.mjs";
10
10
  import "./chunk-ALXAQLRA.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.49.0-beta.6",
3
+ "version": "0.49.0",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -43,16 +43,16 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@antfu/ni": "^0.21.12",
46
- "@antfu/utils": "^0.7.7",
46
+ "@antfu/utils": "^0.7.8",
47
47
  "@iconify-json/carbon": "^1.1.32",
48
- "@iconify-json/ph": "^1.1.12",
48
+ "@iconify-json/ph": "^1.1.13",
49
49
  "@iconify-json/svg-spinners": "^1.1.2",
50
50
  "@lillallol/outline-pdf": "^4.0.0",
51
- "@shikijs/markdown-it": "^1.4.0",
52
- "@shikijs/twoslash": "^1.4.0",
53
- "@shikijs/vitepress-twoslash": "^1.4.0",
54
- "@unocss/extractor-mdc": "^0.59.4",
55
- "@unocss/reset": "^0.59.4",
51
+ "@shikijs/markdown-it": "^1.5.1",
52
+ "@shikijs/twoslash": "^1.5.1",
53
+ "@shikijs/vitepress-twoslash": "^1.5.1",
54
+ "@unocss/extractor-mdc": "^0.60.0",
55
+ "@unocss/reset": "^0.60.0",
56
56
  "@vitejs/plugin-vue": "^5.0.4",
57
57
  "@vitejs/plugin-vue-jsx": "^3.1.0",
58
58
  "chokidar": "^3.6.0",
@@ -88,13 +88,13 @@
88
88
  "public-ip": "^6.0.2",
89
89
  "resolve-from": "^5.0.0",
90
90
  "resolve-global": "^2.0.0",
91
- "semver": "^7.6.0",
92
- "shiki": "^1.4.0",
93
- "shiki-magic-move": "^0.3.7",
91
+ "semver": "^7.6.2",
92
+ "shiki": "^1.5.1",
93
+ "shiki-magic-move": "^0.4.2",
94
94
  "sirv": "^2.0.4",
95
95
  "source-map-js": "^1.2.0",
96
96
  "typescript": "^5.4.5",
97
- "unocss": "^0.59.4",
97
+ "unocss": "^0.60.0",
98
98
  "unplugin-icons": "^0.19.0",
99
99
  "unplugin-vue-components": "^0.27.0",
100
100
  "unplugin-vue-markdown": "^0.26.2",
@@ -106,11 +106,11 @@
106
106
  "vite-plugin-static-copy": "^1.0.4",
107
107
  "vite-plugin-vue-server-ref": "^0.4.2",
108
108
  "vitefu": "^0.2.5",
109
- "vue": "^3.4.26",
109
+ "vue": "^3.4.27",
110
110
  "yargs": "^17.7.2",
111
- "@slidev/client": "0.49.0-beta.6",
112
- "@slidev/types": "0.49.0-beta.6",
113
- "@slidev/parser": "0.49.0-beta.6"
111
+ "@slidev/client": "0.49.0",
112
+ "@slidev/types": "0.49.0",
113
+ "@slidev/parser": "0.49.0"
114
114
  },
115
115
  "devDependencies": {
116
116
  "@hedgedoc/markdown-it-plugins": "^2.1.4",
package/README.md DELETED
@@ -1,102 +0,0 @@
1
- <br>
2
- <p align="center">
3
- <a href="https://sli.dev" target="_blank">
4
- <img src="https://sli.dev/logo-title.png" alt="Slidev" height="250" width="250"/>
5
- </a>
6
- </p>
7
-
8
- <p align="center">
9
- Presentation <b>slide</b>s for <b>dev</b>elopers 🧑‍💻👩‍💻👨‍💻
10
- </p>
11
-
12
- <p align="center">
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
- <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
- <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>
17
- <br>
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
- </p>
20
-
21
- <p align="center">
22
- <a href="https://twitter.com/antfu7/status/1389604687502995457">Video Preview</a> | <a href="https://sli.dev">Documentation</a>
23
- </p>
24
-
25
- <div align="center">
26
- <table>
27
- <tbody>
28
- <td align="center">
29
- <img width="2000" height="0" alt="" aria-hiden><br>
30
- <sub>Made possible by my <a href="https://github.com/sponsors/antfu">Sponsor Program 💖</a></sub><br>
31
- <img width="2000" height="0" alt="" aria-hiden>
32
- </td>
33
- </tbody>
34
- </table>
35
- </div>
36
-
37
- ## Features
38
-
39
- - 📝 [**Markdown-based**](https://sli.dev/guide/syntax.html) - use your favorite editors and workflow
40
- - 🧑‍💻 [**Developer Friendly**](https://sli.dev/guide/syntax.html#code-blocks) - built-in syntax highlighting, live coding, etc.
41
- - 🎨 [**Themable**](https://sli.dev/themes/gallery.html) - theme can be shared and used with npm packages.
42
- - 🌈 [**Stylish**](https://sli.dev/guide/syntax.html#embedded-styles) - on-demand utilities via [UnoCSS](https://github.com/unocss/unocss).
43
- - 🤹 [**Interactive**](https://sli.dev/custom/directory-structure.html#components) - embedding Vue components seamlessly.
44
- - 🎙 [**Presenter Mode**](https://sli.dev/guide/presenter-mode.html) - use another window, or even your phone to control your slides.
45
- - 🧮 [**LaTeX**](https://sli.dev/guide/syntax.html#latex) - built-in LaTeX math equations support.
46
- - 📰 [**Diagrams**](https://sli.dev/guide/syntax.html#diagrams) - creates diagrams with textual descriptions
47
- - 🌟 [**Icons**](https://sli.dev/guide/syntax.html#icons) - access to icons from any iconset directly.
48
- - 💻 [**Editors**](https://sli.dev/guide/editors.html) - integrated editor, or [extension for VS Code](https://github.com/slidevjs/slidev-vscode)
49
- - 🎥 [**Recording**](https://sli.dev/guide/recording.html) - built-in recording and camera view.
50
- - 📤 [**Portable**](https://sli.dev/guide/exporting.html) - export into PDF, PNGs, or even a hostable SPA.
51
- - ⚡️ [**Fast**](https://vitejs.dev) - instant reloading powered by [Vite](https://vitejs.dev).
52
- - 🛠 [**Hackable**](https://sli.dev/custom/config-vite.html) - using Vite plugins, Vue components, or any npm packages.
53
-
54
- ## Getting Started
55
-
56
- ### Try it Online ⚡️
57
-
58
- [sli.dev/new](https://sli.dev/new)
59
-
60
- [![](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://sli.dev/new)
61
-
62
- ### Init Project Locally
63
-
64
- Install [Node.js >=18](https://nodejs.org/) and run the following command:
65
-
66
- ```bash
67
- npm init slidev
68
- ```
69
-
70
- Documentations:
71
- **[English](https://sli.dev)** | [中文文档](https://cn.sli.dev) | [Français](https://fr.sli.dev) | [Español](https://es.sli.dev) | [Русский](https://ru.sli.dev) | [Português-BR](https://br.sli.dev)
72
-
73
- Discord: [chat.sli.dev](https://chat.sli.dev)
74
-
75
- For a full example, you can check the [demo](https://github.com/slidevjs/slidev/blob/main/demo) folder, which is also the source file for [my previous talk](https://antfu.me/posts/composable-vue-vueday-2021).
76
-
77
- ## Tech Stack
78
-
79
- - [Vite](https://vitejs.dev) - An extremely fast frontend tooling
80
- - [Vue 3](https://v3.vuejs.org/) powered [Markdown](https://daringfireball.net/projects/markdown/syntax) - Focus on the content while having the power of HTML and Vue components whenever needed
81
- - [UnoCSS](https://github.com/unocss/unocss) - On-demand utility-first CSS engine, style your slides at ease
82
- - [Shiki](https://github.com/shikijs/shiki), [Monaco Editor](https://github.com/Microsoft/monaco-editor) - First-class code snippets support with live coding capability
83
- - [RecordRTC](https://recordrtc.org) - Built-in recording and camera view
84
- - [VueUse](https://vueuse.org) family - [`@vueuse/core`](https://github.com/vueuse/vueuse), [`@vueuse/motion`](https://github.com/vueuse/motion), etc.
85
- - [Iconify](https://iconify.design/) - Iconsets collection.
86
- - [Drauu](https://github.com/antfu/drauu) - Drawing and annotations support
87
- - [KaTeX](https://katex.org/) - LaTeX math rendering.
88
- - [Mermaid](https://mermaid-js.github.io/mermaid) - Textual Diagrams.
89
-
90
- ## Sponsors
91
-
92
- This project is made possible by all the sponsors supporting my work:
93
-
94
- <p align="center">
95
- <a href="https://github.com/sponsors/antfu">
96
- <img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg' alt="Logos from Sponsors" />
97
- </a>
98
- </p>
99
-
100
- ## License
101
-
102
- MIT License © 2021 [Anthony Fu](https://github.com/antfu)