@slidev/cli 0.49.13 → 0.49.15

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
1
  import {
2
2
  getIndexHtml,
3
3
  resolveViteConfigs
4
- } from "./chunk-HCZPMBQN.mjs";
4
+ } from "./chunk-VAXCTWQX.mjs";
5
5
  import "./chunk-27Q2X57X.mjs";
6
6
 
7
7
  // node/commands/build.ts
@@ -51,7 +51,7 @@ async function build(options, viteConfig = {}, args) {
51
51
  await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
52
52
  `, "utf-8");
53
53
  if ([true, "true", "auto"].includes(options.data.config.download)) {
54
- const { exportSlides, getExportOptions } = await import("./export-UMDVDHQ3.mjs");
54
+ const { exportSlides, getExportOptions } = await import("./export-ZRMOIVNM.mjs");
55
55
  const port = 12445;
56
56
  const app = connect();
57
57
  const server = http.createServer(app);
@@ -7176,7 +7176,7 @@ var require_dist = __commonJS({
7176
7176
  });
7177
7177
 
7178
7178
  // package.json
7179
- var version = "0.49.13";
7179
+ var version = "0.49.15";
7180
7180
 
7181
7181
  // node/commands/shared.ts
7182
7182
  import { existsSync as existsSync7, promises as fs9 } from "node:fs";
@@ -8091,12 +8091,8 @@ function createDataUtils(data) {
8091
8091
  var regexId = /^\/@slidev\/slide\/(\d+)\.(md|json)(?:\?import)?$/;
8092
8092
  var regexIdQuery = /(\d+)\.(md|json|frontmatter)$/;
8093
8093
  var templateInjectionMarker = "/* @slidev-injection */";
8094
- var templateImportContextUtils = `import {
8095
- useSlideContext,
8096
- provideFrontmatter as _provideFrontmatter,
8097
- frontmatterToProps as _frontmatterToProps,
8098
- } from "@slidev/client/context.ts"`.replace(/\n\s*/g, " ");
8099
- var templateInitContext = `const { $slidev, $nav, $clicksContext, $clicks, $page, $renderContext, $frontmatter } = useSlideContext()`;
8094
+ var templateImportContextUtils = `import { useSlideContext as _useSlideContext, frontmatterToProps as _frontmatterToProps } from "@slidev/client/context.ts"`;
8095
+ var templateInitContext = `const { $slidev, $nav, $clicksContext, $clicks, $page, $renderContext, $frontmatter } = _useSlideContext()`;
8100
8096
  function getBodyJson(req) {
8101
8097
  return new Promise((resolve8, reject) => {
8102
8098
  let body = "";
@@ -8324,37 +8320,42 @@ function createSlidesLoader(options, pluginOptions, serverOptions) {
8324
8320
  return {
8325
8321
  code: [
8326
8322
  "// @unocss-include",
8327
- 'import { reactive, computed } from "vue"',
8328
- `export const frontmatter = reactive(${JSON.stringify(fontmatter)})`,
8329
- `export const meta = reactive({
8330
- layout: computed(() => frontmatter.layout),
8331
- transition: computed(() => frontmatter.transition),
8332
- class: computed(() => frontmatter.class),
8333
- clicks: computed(() => frontmatter.clicks),
8334
- name: computed(() => frontmatter.name),
8335
- preload: computed(() => frontmatter.preload),
8336
- slide: {
8337
- ...(${JSON.stringify(slideBase)}),
8338
- frontmatter,
8339
- filepath: ${JSON.stringify(mode === "dev" ? slide.source.filepath : "")},
8340
- start: ${JSON.stringify(slide.source.start)},
8341
- id: ${pageNo},
8342
- no: ${no},
8343
- },
8344
- __clicksContext: null,
8345
- __preloaded: false,
8346
- })`,
8347
- "export default frontmatter",
8323
+ 'import { computed, reactive, shallowReactive } from "vue"',
8324
+ `export const frontmatterData = ${JSON.stringify(fontmatter)}`,
8348
8325
  // handle HMR, update frontmatter with update
8349
8326
  "if (import.meta.hot) {",
8350
- " import.meta.hot.accept(({ frontmatter: update }) => {",
8351
- " if(!update) return",
8327
+ " const firstLoad = !import.meta.hot.data.frontmatter",
8328
+ " import.meta.hot.data.frontmatter ??= reactive(frontmatterData)",
8329
+ " import.meta.hot.accept(({ frontmatterData: update }) => {",
8330
+ " if (firstLoad) return",
8331
+ " const frontmatter = import.meta.hot.data.frontmatter",
8352
8332
  " Object.keys(frontmatter).forEach(key => {",
8353
8333
  " if (!(key in update)) delete frontmatter[key]",
8354
8334
  " })",
8355
8335
  " Object.assign(frontmatter, update)",
8356
8336
  " })",
8357
- "}"
8337
+ "}",
8338
+ "export const frontmatter = import.meta.hot ? import.meta.hot.data.frontmatter : reactive(frontmatterData)",
8339
+ "export default frontmatter",
8340
+ "export const meta = shallowReactive({",
8341
+ " get layout(){ return frontmatter.layout },",
8342
+ " get transition(){ return frontmatter.transition },",
8343
+ " get class(){ return frontmatter.class },",
8344
+ " get clicks(){ return frontmatter.clicks },",
8345
+ " get name(){ return frontmatter.name },",
8346
+ " get preload(){ return frontmatter.preload },",
8347
+ // No need to be reactive, as it's only used once after reload
8348
+ " slide: {",
8349
+ ` ...(${JSON.stringify(slideBase)}),`,
8350
+ ` frontmatter,`,
8351
+ ` filepath: ${JSON.stringify(mode === "dev" ? slide.source.filepath : "")},`,
8352
+ ` start: ${JSON.stringify(slide.source.start)},`,
8353
+ ` id: ${pageNo},`,
8354
+ ` no: ${no},`,
8355
+ " },",
8356
+ " __clicksContext: null,",
8357
+ " __preloaded: false,",
8358
+ "})"
8358
8359
  ].join("\n"),
8359
8360
  map: { mappings: "" }
8360
8361
  };
@@ -8428,9 +8429,7 @@ Unknown layout "${bold(layoutName)}".${yellow(" Available layouts are:")}`) + Ob
8428
8429
  delete frontmatter.title;
8429
8430
  const imports = [
8430
8431
  `import InjectedLayout from "${toAtFS(layouts[layoutName])}"`,
8431
- `import frontmatter from "${toAtFS(`${VIRTUAL_SLIDE_PREFIX + (index + 1)}.frontmatter`)}"`,
8432
8432
  templateImportContextUtils,
8433
- "_provideFrontmatter(frontmatter)",
8434
8433
  templateInitContext,
8435
8434
  templateInjectionMarker
8436
8435
  ];
@@ -8443,7 +8442,7 @@ ${imports.join("\n")}
8443
8442
  if (body.startsWith("<div>") && body.endsWith("</div>"))
8444
8443
  body = body.slice(5, -6);
8445
8444
  code = `${code.slice(0, injectA)}
8446
- <InjectedLayout v-bind="_frontmatterToProps(frontmatter,${index})">
8445
+ <InjectedLayout v-bind="_frontmatterToProps($frontmatter,${index})">
8447
8446
  ${body}
8448
8447
  </InjectedLayout>
8449
8448
  ${code.slice(injectB)}`;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveViteConfigs
3
- } from "./chunk-HCZPMBQN.mjs";
3
+ } from "./chunk-VAXCTWQX.mjs";
4
4
 
5
5
  // node/commands/server.ts
6
6
  import { join } from "node:path";
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createServer
3
- } from "./chunk-J54JXUYT.mjs";
3
+ } from "./chunk-X5LWKCT6.mjs";
4
4
  import {
5
5
  getThemeMeta,
6
6
  loadSetups,
@@ -9,7 +9,7 @@ import {
9
9
  resolveOptions,
10
10
  resolveTheme,
11
11
  version
12
- } from "./chunk-HCZPMBQN.mjs";
12
+ } from "./chunk-VAXCTWQX.mjs";
13
13
  import {
14
14
  getRoots,
15
15
  isInstalledGlobally,
@@ -325,7 +325,7 @@ cli.command(
325
325
  }).strict().help(),
326
326
  async (args) => {
327
327
  const { entry, theme, base, download, out, inspect } = args;
328
- const { build } = await import("./build-CLIVCKGZ.mjs");
328
+ const { build } = await import("./build-J45HACJD.mjs");
329
329
  for (const entryFile of entry) {
330
330
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
331
331
  if (download && !options.data.config.download)
@@ -405,7 +405,7 @@ cli.command(
405
405
  (args) => exportOptions(commonOptions(args)).strict().help(),
406
406
  async (args) => {
407
407
  const { entry, theme } = args;
408
- const { exportSlides, getExportOptions } = await import("./export-UMDVDHQ3.mjs");
408
+ const { exportSlides, getExportOptions } = await import("./export-ZRMOIVNM.mjs");
409
409
  const port = await getPort(12445);
410
410
  for (const entryFile of entry) {
411
411
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
@@ -454,7 +454,7 @@ cli.command(
454
454
  timeout,
455
455
  wait
456
456
  }) => {
457
- const { exportNotes } = await import("./export-UMDVDHQ3.mjs");
457
+ const { exportNotes } = await import("./export-ZRMOIVNM.mjs");
458
458
  const port = await getPort(12445);
459
459
  for (const entryFile of entry) {
460
460
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -478,7 +478,7 @@ function getExportOptions(args, options, outDir, outFilename) {
478
478
  format: format || "pdf",
479
479
  timeout: timeout ?? 3e4,
480
480
  wait: wait ?? 0,
481
- waitUntil: waitUntil === "none" ? void 0 : waitUntil,
481
+ waitUntil: waitUntil === "none" ? void 0 : waitUntil ?? "networkidle",
482
482
  dark: dark || options.data.config.colorSchema === "dark",
483
483
  routerMode: options.data.config.routerMode,
484
484
  width: options.data.config.canvasWidth,
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createServer
3
- } from "./chunk-J54JXUYT.mjs";
3
+ } from "./chunk-X5LWKCT6.mjs";
4
4
  import {
5
5
  ViteSlidevPlugin,
6
6
  createDataUtils,
7
7
  parser,
8
8
  resolveOptions
9
- } from "./chunk-HCZPMBQN.mjs";
9
+ } from "./chunk-VAXCTWQX.mjs";
10
10
  import "./chunk-27Q2X57X.mjs";
11
11
  export {
12
12
  ViteSlidevPlugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.49.13",
3
+ "version": "0.49.15",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -51,8 +51,8 @@
51
51
  "@shikijs/markdown-it": "^1.10.0",
52
52
  "@shikijs/twoslash": "^1.10.0",
53
53
  "@shikijs/vitepress-twoslash": "^1.10.0",
54
- "@unocss/extractor-mdc": "^0.61.0",
55
- "@unocss/reset": "^0.61.0",
54
+ "@unocss/extractor-mdc": "^0.61.2",
55
+ "@unocss/reset": "^0.61.2",
56
56
  "@vitejs/plugin-vue": "^5.0.5",
57
57
  "@vitejs/plugin-vue-jsx": "^4.0.0",
58
58
  "chokidar": "^3.6.0",
@@ -95,7 +95,7 @@
95
95
  "sirv": "^2.0.4",
96
96
  "source-map-js": "^1.2.0",
97
97
  "typescript": "^5.5.2",
98
- "unocss": "^0.61.0",
98
+ "unocss": "^0.61.2",
99
99
  "unplugin-icons": "^0.19.0",
100
100
  "unplugin-vue-components": "^0.27.2",
101
101
  "unplugin-vue-markdown": "^0.26.2",
@@ -109,9 +109,9 @@
109
109
  "vitefu": "^0.2.5",
110
110
  "vue": "^3.4.31",
111
111
  "yargs": "^17.7.2",
112
- "@slidev/client": "0.49.13",
113
- "@slidev/parser": "0.49.13",
114
- "@slidev/types": "0.49.13"
112
+ "@slidev/client": "0.49.15",
113
+ "@slidev/types": "0.49.15",
114
+ "@slidev/parser": "0.49.15"
115
115
  },
116
116
  "devDependencies": {
117
117
  "@hedgedoc/markdown-it-plugins": "^2.1.4",