@slidev/cli 52.0.0 → 52.1.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.
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { resolveViteConfigs } from "./shared-s9xIcfim.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
|
+
if (options.data.config.seoMeta?.ogImage === "auto" || options.data.config.seoMeta?.ogImage?.startsWith(".")) {
|
|
35
|
+
const filename = options.data.config.seoMeta?.ogImage === "auto" ? "og-image.png" : options.data.config.seoMeta.ogImage;
|
|
36
|
+
const projectOgImagePath = resolve(options.userRoot, filename);
|
|
37
|
+
const outputOgImagePath = resolve(outDir, filename);
|
|
38
|
+
const projectOgImageExists = await fs.access(projectOgImagePath).then(() => true).catch(() => false);
|
|
39
|
+
if (projectOgImageExists) await fs.copyFile(projectOgImagePath, outputOgImagePath);
|
|
40
|
+
else if (options.data.config.seoMeta?.ogImage === "auto") {
|
|
41
|
+
const port = 12445;
|
|
42
|
+
const app = connect();
|
|
43
|
+
const server = http.createServer(app);
|
|
44
|
+
app.use(config.base, sirv(outDir, {
|
|
45
|
+
etag: true,
|
|
46
|
+
single: true,
|
|
47
|
+
dev: true
|
|
48
|
+
}));
|
|
49
|
+
server.listen(port);
|
|
50
|
+
const { exportSlides } = await import("./export-D1Zqc-n1.js");
|
|
51
|
+
const tempDir = resolve(outDir, "temp");
|
|
52
|
+
await fs.mkdir(tempDir, { recursive: true });
|
|
53
|
+
await exportSlides({
|
|
54
|
+
port,
|
|
55
|
+
base: config.base,
|
|
56
|
+
slides: options.data.slides,
|
|
57
|
+
total: options.data.slides.length,
|
|
58
|
+
format: "png",
|
|
59
|
+
output: tempDir,
|
|
60
|
+
range: "1",
|
|
61
|
+
width: options.data.config.canvasWidth,
|
|
62
|
+
height: Math.round(options.data.config.canvasWidth / options.data.config.aspectRatio),
|
|
63
|
+
routerMode: options.data.config.routerMode,
|
|
64
|
+
waitUntil: "networkidle",
|
|
65
|
+
timeout: 3e4,
|
|
66
|
+
perSlide: true,
|
|
67
|
+
omitBackground: false
|
|
68
|
+
});
|
|
69
|
+
const tempFiles = await fs.readdir(tempDir);
|
|
70
|
+
const pngFile = tempFiles.find((file) => file.endsWith(".png"));
|
|
71
|
+
if (pngFile) {
|
|
72
|
+
const generatedPath = resolve(tempDir, pngFile);
|
|
73
|
+
await fs.copyFile(generatedPath, projectOgImagePath);
|
|
74
|
+
await fs.copyFile(generatedPath, outputOgImagePath);
|
|
75
|
+
}
|
|
76
|
+
await fs.rm(tempDir, {
|
|
77
|
+
recursive: true,
|
|
78
|
+
force: true
|
|
79
|
+
});
|
|
80
|
+
server.close();
|
|
81
|
+
} else throw new Error(`[Slidev] ogImage: ${filename} not found`);
|
|
82
|
+
}
|
|
83
|
+
await fs.copyFile(resolve(outDir, "index.html"), resolve(outDir, "404.html"));
|
|
84
|
+
const redirectsPath = resolve(outDir, "_redirects");
|
|
85
|
+
if (!existsSync(redirectsPath)) await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200\n`, "utf-8");
|
|
86
|
+
if ([
|
|
87
|
+
true,
|
|
88
|
+
"true",
|
|
89
|
+
"auto"
|
|
90
|
+
].includes(options.data.config.download)) {
|
|
91
|
+
const { exportSlides, getExportOptions } = await import("./export-D1Zqc-n1.js");
|
|
92
|
+
const port = 12445;
|
|
93
|
+
const app = connect();
|
|
94
|
+
const server = http.createServer(app);
|
|
95
|
+
app.use(config.base, sirv(outDir, {
|
|
96
|
+
etag: true,
|
|
97
|
+
single: true,
|
|
98
|
+
dev: true
|
|
99
|
+
}));
|
|
100
|
+
server.listen(port);
|
|
101
|
+
await exportSlides({
|
|
102
|
+
port,
|
|
103
|
+
base: config.base,
|
|
104
|
+
...getExportOptions(args, options, join(outDir, "slidev-exported.pdf"))
|
|
105
|
+
});
|
|
106
|
+
server.close();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//#endregion
|
|
111
|
+
export { build };
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getThemeMeta, loadSetups, parser, resolveAddons, resolveOptions, resolveTheme, updateFrontmatterPatch, version } from "./shared-
|
|
1
|
+
import { getThemeMeta, loadSetups, parser, resolveAddons, resolveOptions, resolveTheme, updateFrontmatterPatch, version } from "./shared-s9xIcfim.js";
|
|
2
2
|
import { getRoots, isInstalledGlobally, resolveEntry } from "./resolver-BShaA6qw.js";
|
|
3
|
-
import { createServer } from "./serve-
|
|
3
|
+
import { createServer } from "./serve-CCcAw521.js";
|
|
4
4
|
import { exec } from "node:child_process";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import os from "node:os";
|
|
@@ -295,7 +295,7 @@ cli.command("build [entry..]", "Build hostable SPA", (args) => exportOptions(com
|
|
|
295
295
|
describe: "enable the inspect plugin for debugging"
|
|
296
296
|
}).strict().help(), async (args) => {
|
|
297
297
|
const { entry, theme, base, download, out, inspect } = args;
|
|
298
|
-
const { build } = await import("./build-
|
|
298
|
+
const { build } = await import("./build-DuUdJ0C5.js");
|
|
299
299
|
for (const entryFile of entry) {
|
|
300
300
|
const options = await resolveOptions({
|
|
301
301
|
entry: entryFile,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ViteSlidevPlugin, createDataUtils, parser, resolveOptions } from "./shared-
|
|
1
|
+
import { ViteSlidevPlugin, createDataUtils, parser, resolveOptions } from "./shared-s9xIcfim.js";
|
|
2
2
|
import "./resolver-BShaA6qw.js";
|
|
3
|
-
import { createServer } from "./serve-
|
|
3
|
+
import { createServer } from "./serve-CCcAw521.js";
|
|
4
4
|
|
|
5
5
|
export { ViteSlidevPlugin, createDataUtils, createServer, parser, resolveOptions };
|
|
@@ -43,7 +43,7 @@ import Vue from "@vitejs/plugin-vue";
|
|
|
43
43
|
import VueJsx from "@vitejs/plugin-vue-jsx";
|
|
44
44
|
|
|
45
45
|
//#region package.json
|
|
46
|
-
var version = "52.
|
|
46
|
+
var version = "52.1.0";
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region node/syntax/markdown-it/markdown-it-link.ts
|
|
@@ -544,6 +544,7 @@ async function setupIndexHtml({ mode, entry, clientRoot, userRoot, roots, data,
|
|
|
544
544
|
}
|
|
545
545
|
const { info, author, keywords } = data.headmatter;
|
|
546
546
|
const seoMeta = data.headmatter.seoMeta ?? {};
|
|
547
|
+
const ogImage = seoMeta.ogImage === "auto" ? "./og-image.png" : seoMeta.ogImage ? seoMeta.ogImage : existsSync(join(userRoot, "og-image.png")) ? "./og-image.png" : void 0;
|
|
547
548
|
const title = getSlideTitle(data);
|
|
548
549
|
const description = info ? toAttrValue(info) : null;
|
|
549
550
|
const unhead = createHead({ init: [{
|
|
@@ -554,6 +555,10 @@ async function setupIndexHtml({ mode, entry, clientRoot, userRoot, roots, data,
|
|
|
554
555
|
href: data.config.favicon
|
|
555
556
|
} : null, ...webFontsLink].filter((x) => x),
|
|
556
557
|
meta: [
|
|
558
|
+
{
|
|
559
|
+
"http-equiv": "Content-Type",
|
|
560
|
+
"content": "text/html; charset=UTF-8"
|
|
561
|
+
},
|
|
557
562
|
{
|
|
558
563
|
property: "slidev:version",
|
|
559
564
|
content: version
|
|
@@ -584,7 +589,7 @@ async function setupIndexHtml({ mode, entry, clientRoot, userRoot, roots, data,
|
|
|
584
589
|
},
|
|
585
590
|
{
|
|
586
591
|
property: "og:image",
|
|
587
|
-
content:
|
|
592
|
+
content: ogImage
|
|
588
593
|
},
|
|
589
594
|
{
|
|
590
595
|
property: "og:url",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "52.
|
|
4
|
+
"version": "52.1.0",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@antfu/ni": "^25.0.0",
|
|
46
46
|
"@antfu/utils": "^9.2.0",
|
|
47
|
-
"@iconify-json/carbon": "^1.2.
|
|
47
|
+
"@iconify-json/carbon": "^1.2.11",
|
|
48
48
|
"@iconify-json/ph": "^1.2.2",
|
|
49
49
|
"@iconify-json/svg-spinners": "^1.2.2",
|
|
50
50
|
"@lillallol/outline-pdf": "^4.0.0",
|
|
51
|
-
"@shikijs/markdown-it": "^3.
|
|
52
|
-
"@shikijs/twoslash": "^3.
|
|
53
|
-
"@shikijs/vitepress-twoslash": "^3.
|
|
54
|
-
"@unocss/extractor-mdc": "^66.3.
|
|
55
|
-
"@unocss/reset": "^66.3.
|
|
51
|
+
"@shikijs/markdown-it": "^3.8.1",
|
|
52
|
+
"@shikijs/twoslash": "^3.8.1",
|
|
53
|
+
"@shikijs/vitepress-twoslash": "^3.8.1",
|
|
54
|
+
"@unocss/extractor-mdc": "^66.3.3",
|
|
55
|
+
"@unocss/reset": "^66.3.3",
|
|
56
56
|
"@vitejs/plugin-vue": "^6.0.0",
|
|
57
|
-
"@vitejs/plugin-vue-jsx": "^5.0.
|
|
57
|
+
"@vitejs/plugin-vue-jsx": "^5.0.1",
|
|
58
58
|
"ansis": "^4.1.0",
|
|
59
59
|
"chokidar": "^4.0.3",
|
|
60
60
|
"cli-progress": "^3.12.0",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"debug": "^4.4.1",
|
|
63
63
|
"fast-deep-equal": "^3.1.3",
|
|
64
64
|
"fast-glob": "^3.3.3",
|
|
65
|
-
"get-port-please": "^3.
|
|
65
|
+
"get-port-please": "^3.2.0",
|
|
66
66
|
"global-directory": "^4.0.1",
|
|
67
67
|
"htmlparser2": "^10.0.0",
|
|
68
68
|
"is-installed-globally": "^1.0.0",
|
|
69
|
-
"jiti": "^2.
|
|
69
|
+
"jiti": "^2.5.1",
|
|
70
70
|
"katex": "^0.16.22",
|
|
71
71
|
"local-pkg": "^1.1.1",
|
|
72
72
|
"lz-string": "^1.5.0",
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"magic-string-stack": "^1.0.0",
|
|
75
75
|
"markdown-it": "^14.1.0",
|
|
76
76
|
"markdown-it-footnote": "^4.0.0",
|
|
77
|
-
"markdown-it-mdc": "^0.2.
|
|
77
|
+
"markdown-it-mdc": "^0.2.6",
|
|
78
78
|
"mlly": "^1.7.4",
|
|
79
79
|
"monaco-editor": "^0.52.2",
|
|
80
|
-
"open": "^10.
|
|
80
|
+
"open": "^10.2.0",
|
|
81
81
|
"pdf-lib": "^1.17.1",
|
|
82
|
-
"picomatch": "^4.0.
|
|
82
|
+
"picomatch": "^4.0.3",
|
|
83
83
|
"plantuml-encoder": "^1.4.0",
|
|
84
84
|
"postcss-nested": "^7.0.2",
|
|
85
85
|
"pptxgenjs": "^4.0.1",
|
|
@@ -88,34 +88,34 @@
|
|
|
88
88
|
"resolve-from": "^5.0.0",
|
|
89
89
|
"resolve-global": "^2.0.0",
|
|
90
90
|
"semver": "^7.7.2",
|
|
91
|
-
"shiki": "^3.
|
|
91
|
+
"shiki": "^3.8.1",
|
|
92
92
|
"shiki-magic-move": "^1.1.0",
|
|
93
93
|
"sirv": "^3.0.1",
|
|
94
94
|
"source-map-js": "^1.2.1",
|
|
95
95
|
"typescript": "^5.8.3",
|
|
96
|
-
"unhead": "^2.0.
|
|
97
|
-
"unocss": "^66.3.
|
|
96
|
+
"unhead": "^2.0.12",
|
|
97
|
+
"unocss": "^66.3.3",
|
|
98
98
|
"unplugin-icons": "^22.1.0",
|
|
99
99
|
"unplugin-vue-components": "^28.8.0",
|
|
100
|
-
"unplugin-vue-markdown": "^29.
|
|
100
|
+
"unplugin-vue-markdown": "^29.1.0",
|
|
101
101
|
"untun": "^0.1.3",
|
|
102
102
|
"uqr": "^0.1.2",
|
|
103
|
-
"vite": "^7.0.
|
|
104
|
-
"vite-plugin-inspect": "^11.3.
|
|
103
|
+
"vite": "^7.0.6",
|
|
104
|
+
"vite-plugin-inspect": "^11.3.2",
|
|
105
105
|
"vite-plugin-remote-assets": "^2.0.0",
|
|
106
|
-
"vite-plugin-static-copy": "^3.1.
|
|
106
|
+
"vite-plugin-static-copy": "^3.1.1",
|
|
107
107
|
"vite-plugin-vue-server-ref": "^1.0.0",
|
|
108
|
-
"vitefu": "^1.
|
|
109
|
-
"vue": "^3.5.
|
|
108
|
+
"vitefu": "^1.1.1",
|
|
109
|
+
"vue": "^3.5.18",
|
|
110
110
|
"yaml": "^2.8.0",
|
|
111
111
|
"yargs": "^18.0.0",
|
|
112
|
-
"@slidev/
|
|
113
|
-
"@slidev/
|
|
114
|
-
"@slidev/types": "52.
|
|
112
|
+
"@slidev/parser": "52.1.0",
|
|
113
|
+
"@slidev/client": "52.1.0",
|
|
114
|
+
"@slidev/types": "52.1.0"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@hedgedoc/markdown-it-plugins": "^2.1.4",
|
|
118
|
-
"@types/picomatch": "^4.0.
|
|
118
|
+
"@types/picomatch": "^4.0.1",
|
|
119
119
|
"@types/plantuml-encoder": "^1.4.2"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
package/dist/build-DoDZ6Gwg.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { resolveViteConfigs } from "./shared-B9qiqcmG.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 };
|