@slidev/cli 51.5.0 → 51.6.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.
package/README.md CHANGED
@@ -36,7 +36,7 @@ Presentation <b>slide</b>s for <b>dev</b>elopers 🧑‍💻👩‍💻👨‍
36
36
 
37
37
  ## Features
38
38
 
39
- - 📝 [**Markdown-based**](https://sli.dev/guide/syntax) - foucus on content and use your favorite editor
39
+ - 📝 [**Markdown-based**](https://sli.dev/guide/syntax) - focus on content and use your favorite editor
40
40
  - 🧑‍💻 [**Developer Friendly**](https://sli.dev/guide/syntax#code-blocks) - built-in code highlighting, live coding, etc.
41
41
  - 🎨 [**Themable**](https://sli.dev/resources/theme-gallery) - theme can be shared and used with npm packages
42
42
  - 🌈 [**Stylish**](https://sli.dev/guide/syntax#embedded-styles) - on-demand utilities via [UnoCSS](https://github.com/unocss/unocss).
@@ -0,0 +1,62 @@
1
+ import { resolveViteConfigs } from "./shared-D3tuRsUE.js";
2
+ import "./resolver-BShaA6qw.js";
3
+ import fs from "node:fs/promises";
4
+ import { join, resolve } from "node:path";
5
+ import { build as build$1 } from "vite";
6
+ import { existsSync } from "node:fs";
7
+ import http from "node:http";
8
+ import connect from "connect";
9
+ import sirv from "sirv";
10
+
11
+ //#region node/commands/build.ts
12
+ async function build(options, viteConfig = {}, args) {
13
+ const indexPath = resolve(options.userRoot, "index.html");
14
+ let originalIndexHTML;
15
+ if (existsSync(indexPath)) originalIndexHTML = await fs.readFile(indexPath, "utf-8");
16
+ await fs.writeFile(indexPath, options.utils.indexHtml, "utf-8");
17
+ let config = void 0;
18
+ try {
19
+ const inlineConfig = await resolveViteConfigs(options, {
20
+ plugins: [{
21
+ name: "resolve-config",
22
+ configResolved(_config) {
23
+ config = _config;
24
+ }
25
+ }],
26
+ build: { chunkSizeWarningLimit: 2e3 }
27
+ }, viteConfig, "build");
28
+ await build$1(inlineConfig);
29
+ } finally {
30
+ if (originalIndexHTML != null) await fs.writeFile(indexPath, originalIndexHTML, "utf-8");
31
+ else await fs.unlink(indexPath);
32
+ }
33
+ const outDir = resolve(options.userRoot, config.build.outDir);
34
+ await fs.copyFile(resolve(outDir, "index.html"), resolve(outDir, "404.html"));
35
+ const redirectsPath = resolve(outDir, "_redirects");
36
+ if (!existsSync(redirectsPath)) await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200\n`, "utf-8");
37
+ if ([
38
+ true,
39
+ "true",
40
+ "auto"
41
+ ].includes(options.data.config.download)) {
42
+ const { exportSlides, getExportOptions } = await import("./export-D1Zqc-n1.js");
43
+ const port = 12445;
44
+ const app = connect();
45
+ const server = http.createServer(app);
46
+ app.use(config.base, sirv(outDir, {
47
+ etag: true,
48
+ single: true,
49
+ dev: true
50
+ }));
51
+ server.listen(port);
52
+ await exportSlides({
53
+ port,
54
+ base: config.base,
55
+ ...getExportOptions(args, options, join(outDir, "slidev-exported.pdf"))
56
+ });
57
+ server.close();
58
+ }
59
+ }
60
+
61
+ //#endregion
62
+ export { build };
package/dist/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
-
2
- export { }
1
+ export { };