@slidev/cli 0.48.5 → 0.48.6

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.
@@ -62,7 +62,7 @@ async function build(options, viteConfig = {}, args) {
62
62
  await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
63
63
  `, "utf-8");
64
64
  if ([true, "true", "auto"].includes(options.data.config.download)) {
65
- const { exportSlides, getExportOptions } = await import("./export-7BCUWALW.mjs");
65
+ const { exportSlides, getExportOptions } = await import("./export-674XF5SK.mjs");
66
66
  const port = 12445;
67
67
  const app = connect();
68
68
  const server = http.createServer(app);
@@ -48,7 +48,7 @@ async function createServer(options, viteConfig = {}, serverOptions = {}) {
48
48
  import * as parser from "@slidev/parser/fs";
49
49
 
50
50
  // package.json
51
- var version = "0.48.5";
51
+ var version = "0.48.6";
52
52
 
53
53
  // node/integrations/themes.ts
54
54
  import { join as join2 } from "node:path";
package/dist/cli.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  resolveOptions,
7
7
  resolveTheme,
8
8
  version
9
- } from "./chunk-5J4CYI2E.mjs";
9
+ } from "./chunk-2FVGDH3A.mjs";
10
10
  import "./chunk-M3AHQMLP.mjs";
11
11
  import {
12
12
  loadSetups
@@ -325,7 +325,7 @@ cli.command(
325
325
  }).strict().help(),
326
326
  async (args) => {
327
327
  const { entry, theme, watch, base, download, out, inspect } = args;
328
- const { build } = await import("./build-6DZCUTHS.mjs");
328
+ const { build } = await import("./build-A5ALFNZS.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)
@@ -406,7 +406,7 @@ cli.command(
406
406
  (args) => exportOptions(commonOptions(args)).strict().help(),
407
407
  async (args) => {
408
408
  const { entry, theme } = args;
409
- const { exportSlides, getExportOptions } = await import("./export-7BCUWALW.mjs");
409
+ const { exportSlides, getExportOptions } = await import("./export-674XF5SK.mjs");
410
410
  const port = await getPort(12445);
411
411
  for (const entryFile of entry) {
412
412
  const options = await resolveOptions({ entry: entryFile, theme }, "export");
@@ -450,7 +450,7 @@ cli.command(
450
450
  output,
451
451
  timeout
452
452
  }) => {
453
- const { exportNotes } = await import("./export-7BCUWALW.mjs");
453
+ const { exportNotes } = await import("./export-674XF5SK.mjs");
454
454
  const port = await getPort(12445);
455
455
  for (const entryFile of entry) {
456
456
  const options = await resolveOptions({ entry: entryFile }, "export");
@@ -5,6 +5,7 @@ import {
5
5
  // node/commands/export.ts
6
6
  import path from "node:path";
7
7
  import { Buffer } from "node:buffer";
8
+ import process from "node:process";
8
9
  import fs from "fs-extra";
9
10
  import { blue, cyan, dim, green, yellow } from "kolorist";
10
11
  import { Presets, SingleBar } from "cli-progress";
@@ -137,7 +138,16 @@ async function exportSlides({
137
138
  const page = await context.newPage();
138
139
  const progress = createSlidevProgress(!perSlide);
139
140
  async function go(no, clicks) {
140
- const path2 = `${no}?print${withClicks ? "=clicks" : ""}${clicks ? `&clicks=${clicks}` : ""}${range ? `&range=${range}` : ""}`;
141
+ const query = new URLSearchParams();
142
+ if (withClicks)
143
+ query.set("print", "clicks");
144
+ else
145
+ query.set("print", "true");
146
+ if (range)
147
+ query.set("range", range);
148
+ if (clicks)
149
+ query.set("clicks", clicks);
150
+ const path2 = `${no}?${query.toString()}`;
141
151
  const url = routerMode === "hash" ? `http://localhost:${port}${base}#${path2}` : `http://localhost:${port}${base}${path2}`;
142
152
  await page.goto(url, {
143
153
  waitUntil: "networkidle",
@@ -145,20 +155,26 @@ async function exportSlides({
145
155
  });
146
156
  await page.waitForLoadState("networkidle");
147
157
  await page.emulateMedia({ colorScheme: dark ? "dark" : "light", media: "screen" });
158
+ const slide = page.locator(`[data-slidev-no="${no}"]`);
159
+ await slide.waitFor({ state: "visible" });
148
160
  {
149
- const elements = page.locator(".slidev-slide-loading");
161
+ const elements = slide.locator(".slidev-slide-loading");
150
162
  const count = await elements.count();
151
163
  for (let index = 0; index < count; index++)
152
164
  await elements.nth(index).waitFor({ state: "detached" });
153
165
  }
154
166
  {
155
- const elements = page.locator("[data-waitfor]");
167
+ const elements = slide.locator("[data-waitfor]");
156
168
  const count = await elements.count();
157
169
  for (let index = 0; index < count; index++) {
158
170
  const element = elements.nth(index);
159
171
  const attribute = await element.getAttribute("data-waitfor");
160
- if (attribute)
161
- await element.locator(attribute).waitFor();
172
+ if (attribute) {
173
+ await element.locator(attribute).waitFor({ state: "visible" }).catch((e) => {
174
+ console.error(e);
175
+ process.exitCode = 1;
176
+ });
177
+ }
162
178
  }
163
179
  }
164
180
  {
@@ -166,17 +182,20 @@ async function exportSlides({
166
182
  await Promise.all(frames.map((frame) => frame.waitForLoadState()));
167
183
  }
168
184
  {
169
- const container = page.locator("#mermaid-rendering-container");
170
- while (true) {
171
- const element = container.locator("div").first();
172
- if (await element.count() === 0)
173
- break;
174
- await element.waitFor({ state: "detached" });
185
+ const container = slide.locator("#mermaid-rendering-container");
186
+ const count = await container.count();
187
+ if (count > 0) {
188
+ while (true) {
189
+ const element = container.locator("div").first();
190
+ if (await element.count() === 0)
191
+ break;
192
+ await element.waitFor({ state: "detached" });
193
+ }
194
+ await container.evaluate((node) => node.style.display = "none");
175
195
  }
176
- await container.evaluate((node) => node.style.display = "none");
177
196
  }
178
197
  {
179
- const elements = page.locator(".monaco-aria-container");
198
+ const elements = slide.locator(".monaco-aria-container");
180
199
  const count = await elements.count();
181
200
  for (let index = 0; index < count; index++) {
182
201
  const element = elements.nth(index);
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  createServer,
3
3
  parser,
4
4
  resolveOptions
5
- } from "./chunk-5J4CYI2E.mjs";
5
+ } from "./chunk-2FVGDH3A.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
8
  } from "./chunk-M3AHQMLP.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.48.5",
3
+ "version": "0.48.6",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -106,9 +106,9 @@
106
106
  "vitefu": "^0.2.5",
107
107
  "vue": "^3.4.21",
108
108
  "yargs": "^17.7.2",
109
- "@slidev/client": "0.48.5",
110
- "@slidev/parser": "0.48.5",
111
- "@slidev/types": "0.48.5"
109
+ "@slidev/parser": "0.48.6",
110
+ "@slidev/client": "0.48.6",
111
+ "@slidev/types": "0.48.6"
112
112
  },
113
113
  "devDependencies": {
114
114
  "@hedgedoc/markdown-it-plugins": "^2.1.4",