@slidev/cli 51.1.2 → 51.2.1
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/dist/{build-HX4M5G6G.js → build-2QWDNCVK.js} +7 -6
- package/dist/{chunk-VYGXR6XP.js → chunk-BFQFB535.js} +53 -50
- package/dist/{chunk-SGL3ENKK.js → chunk-LF5Q7I4U.js} +1 -1
- package/dist/{chunk-UNQ5DBLZ.js → chunk-TJFRPB4N.js} +1 -1
- package/dist/cli.js +17 -13
- package/dist/{export-I2C456L6.js → export-VO32FL6K.js} +5 -4
- package/dist/index.js +3 -3
- package/package.json +19 -20
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveViteConfigs
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-BFQFB535.js";
|
|
4
|
+
import "./chunk-TJFRPB4N.js";
|
|
5
5
|
|
|
6
6
|
// node/commands/build.ts
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import fs from "node:fs/promises";
|
|
7
9
|
import http from "node:http";
|
|
8
10
|
import { resolve } from "node:path";
|
|
9
11
|
import connect from "connect";
|
|
10
|
-
import fs from "fs-extra";
|
|
11
12
|
import sirv from "sirv";
|
|
12
13
|
import { build as viteBuild } from "vite";
|
|
13
14
|
async function build(options, viteConfig = {}, args) {
|
|
14
15
|
const indexPath = resolve(options.userRoot, "index.html");
|
|
15
16
|
let originalIndexHTML;
|
|
16
|
-
if (
|
|
17
|
+
if (existsSync(indexPath))
|
|
17
18
|
originalIndexHTML = await fs.readFile(indexPath, "utf-8");
|
|
18
19
|
await fs.writeFile(indexPath, options.utils.indexHtml, "utf-8");
|
|
19
20
|
let config = void 0;
|
|
@@ -46,11 +47,11 @@ async function build(options, viteConfig = {}, args) {
|
|
|
46
47
|
const outDir = resolve(options.userRoot, config.build.outDir);
|
|
47
48
|
await fs.copyFile(resolve(outDir, "index.html"), resolve(outDir, "404.html"));
|
|
48
49
|
const redirectsPath = resolve(outDir, "_redirects");
|
|
49
|
-
if (!
|
|
50
|
+
if (!existsSync(redirectsPath))
|
|
50
51
|
await fs.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
|
|
51
52
|
`, "utf-8");
|
|
52
53
|
if ([true, "true", "auto"].includes(options.data.config.download)) {
|
|
53
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
54
|
+
const { exportSlides, getExportOptions } = await import("./export-VO32FL6K.js");
|
|
54
55
|
const port = 12445;
|
|
55
56
|
const app = connect();
|
|
56
57
|
const server = http.createServer(app);
|
|
@@ -6,14 +6,15 @@ import {
|
|
|
6
6
|
resolveImportPath,
|
|
7
7
|
resolveImportUrl,
|
|
8
8
|
toAtFS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TJFRPB4N.js";
|
|
10
10
|
|
|
11
11
|
// package.json
|
|
12
|
-
var version = "51.1
|
|
12
|
+
var version = "51.2.1";
|
|
13
13
|
|
|
14
14
|
// node/integrations/themes.ts
|
|
15
|
+
import { existsSync } from "node:fs";
|
|
16
|
+
import fs from "node:fs/promises";
|
|
15
17
|
import { join } from "node:path";
|
|
16
|
-
import fs from "fs-extra";
|
|
17
18
|
import { satisfies } from "semver";
|
|
18
19
|
var officialThemes = {
|
|
19
20
|
"none": "",
|
|
@@ -26,9 +27,9 @@ var officialThemes = {
|
|
|
26
27
|
var resolveTheme = createResolver("theme", officialThemes);
|
|
27
28
|
async function getThemeMeta(name, root) {
|
|
28
29
|
const path4 = join(root, "package.json");
|
|
29
|
-
if (!
|
|
30
|
+
if (!existsSync(path4))
|
|
30
31
|
return {};
|
|
31
|
-
const { slidev = {}, engines = {} } = await fs.
|
|
32
|
+
const { slidev = {}, engines = {} } = JSON.parse(await fs.readFile(path4, "utf-8"));
|
|
32
33
|
if (engines.slidev && !satisfies(version, engines.slidev, { includePrerelease: true }))
|
|
33
34
|
throw new Error(`[slidev] theme "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
|
|
34
35
|
return slidev;
|
|
@@ -42,11 +43,11 @@ import path3 from "node:path";
|
|
|
42
43
|
import { objectMap as objectMap2, uniq as uniq5 } from "@antfu/utils";
|
|
43
44
|
import Debug from "debug";
|
|
44
45
|
import fg4 from "fast-glob";
|
|
45
|
-
import
|
|
46
|
+
import pm from "picomatch";
|
|
46
47
|
|
|
47
48
|
// node/integrations/addons.ts
|
|
49
|
+
import fs2 from "node:fs/promises";
|
|
48
50
|
import { resolve } from "node:path";
|
|
49
|
-
import fs2 from "fs-extra";
|
|
50
51
|
import { satisfies as satisfies2 } from "semver";
|
|
51
52
|
async function resolveAddons(addonsInConfig) {
|
|
52
53
|
const { userRoot, userPkgJson } = await getRoots();
|
|
@@ -57,7 +58,7 @@ async function resolveAddons(addonsInConfig) {
|
|
|
57
58
|
if (!pkgRoot)
|
|
58
59
|
return;
|
|
59
60
|
resolved.push(pkgRoot);
|
|
60
|
-
const { slidev = {}, engines = {} } = await fs2.
|
|
61
|
+
const { slidev = {}, engines = {} } = JSON.parse(await fs2.readFile(resolve(pkgRoot, "package.json"), "utf-8"));
|
|
61
62
|
if (engines.slidev && !satisfies2(version, engines.slidev, { includePrerelease: true }))
|
|
62
63
|
throw new Error(`[slidev] addon "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
|
|
63
64
|
if (Array.isArray(slidev.addons))
|
|
@@ -71,14 +72,14 @@ async function resolveAddons(addonsInConfig) {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
// node/setups/indexHtml.ts
|
|
74
|
-
import { existsSync as
|
|
75
|
+
import { existsSync as existsSync12, readFileSync as readFileSync2 } from "node:fs";
|
|
75
76
|
import { join as join13 } from "node:path";
|
|
76
77
|
import { slash as slash4 } from "@antfu/utils";
|
|
77
|
-
import { white, yellow as yellow2 } from "
|
|
78
|
+
import { white, yellow as yellow2 } from "ansis";
|
|
78
79
|
import { escapeHtml } from "markdown-it/lib/common/utils.mjs";
|
|
79
80
|
|
|
80
81
|
// node/commands/shared.ts
|
|
81
|
-
import { existsSync as
|
|
82
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
82
83
|
import { join as join12 } from "node:path";
|
|
83
84
|
import MarkdownIt2 from "markdown-it";
|
|
84
85
|
import { loadConfigFromFile, mergeConfig as mergeConfig2 } from "vite";
|
|
@@ -491,7 +492,7 @@ async function createInspectPlugin(options, pluginOptions) {
|
|
|
491
492
|
}
|
|
492
493
|
|
|
493
494
|
// node/vite/layoutWrapper.ts
|
|
494
|
-
import { bold, gray, red, yellow } from "
|
|
495
|
+
import { bold, gray, red, yellow } from "ansis";
|
|
495
496
|
function createLayoutWrapperPlugin({ data, utils }) {
|
|
496
497
|
return {
|
|
497
498
|
name: "slidev:layout-wrapper",
|
|
@@ -734,7 +735,7 @@ console.warn('/@slidev/titles.md is deprecated, import from #slidev/title-render
|
|
|
734
735
|
};
|
|
735
736
|
|
|
736
737
|
// node/virtual/global-layers.ts
|
|
737
|
-
import { existsSync } from "node:fs";
|
|
738
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
738
739
|
import { join as join4 } from "node:path";
|
|
739
740
|
var templateGlobalLayers = {
|
|
740
741
|
id: `/@slidev/global-layers`,
|
|
@@ -742,7 +743,7 @@ var templateGlobalLayers = {
|
|
|
742
743
|
const imports = [];
|
|
743
744
|
let n = 0;
|
|
744
745
|
function getComponent(names) {
|
|
745
|
-
const components = roots.flatMap((root) => names.map((name) => join4(root, name))).filter((i) =>
|
|
746
|
+
const components = roots.flatMap((root) => names.map((name) => join4(root, name))).filter((i) => existsSync2(i));
|
|
746
747
|
imports.push(components.map((path4, i) => `import __n${n}_${i} from '${toAtFS(path4)}'`).join("\n"));
|
|
747
748
|
const render = components.map((_, i) => `h(__n${n}_${i})`).join(",");
|
|
748
749
|
n++;
|
|
@@ -861,7 +862,7 @@ var templateMonacoTypes = {
|
|
|
861
862
|
};
|
|
862
863
|
|
|
863
864
|
// node/virtual/nav-controls.ts
|
|
864
|
-
import { existsSync as
|
|
865
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
865
866
|
import { join as join6 } from "node:path";
|
|
866
867
|
var templateNavControls = {
|
|
867
868
|
id: "/@slidev/custom-nav-controls",
|
|
@@ -871,7 +872,7 @@ var templateNavControls = {
|
|
|
871
872
|
join6(root, "custom-nav-controls.vue"),
|
|
872
873
|
join6(root, "CustomNavControls.vue")
|
|
873
874
|
];
|
|
874
|
-
}).filter((i) =>
|
|
875
|
+
}).filter((i) => existsSync3(i));
|
|
875
876
|
const imports = components.map((i, idx) => `import __n${idx} from '${toAtFS(i)}'`).join("\n");
|
|
876
877
|
const render = components.map((i, idx) => `h(__n${idx})`).join(",");
|
|
877
878
|
return `${imports}
|
|
@@ -883,7 +884,7 @@ export default {
|
|
|
883
884
|
};
|
|
884
885
|
|
|
885
886
|
// node/virtual/setups.ts
|
|
886
|
-
import { existsSync as
|
|
887
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
887
888
|
import { join as join7 } from "node:path";
|
|
888
889
|
function createSetupTemplate(name) {
|
|
889
890
|
return {
|
|
@@ -892,7 +893,7 @@ function createSetupTemplate(name) {
|
|
|
892
893
|
const setups = roots.flatMap((i) => {
|
|
893
894
|
const path4 = join7(i, "setup", name);
|
|
894
895
|
return [".ts", ".mts", ".js", ".mjs"].map((ext) => path4 + ext);
|
|
895
|
-
}).filter((i) =>
|
|
896
|
+
}).filter((i) => existsSync4(i));
|
|
896
897
|
const imports = [];
|
|
897
898
|
setups.forEach((path4, idx) => {
|
|
898
899
|
imports.push(`import __n${idx} from '${toAtFS(path4)}'`);
|
|
@@ -1015,7 +1016,7 @@ ${slides.join(",\n")}
|
|
|
1015
1016
|
};
|
|
1016
1017
|
|
|
1017
1018
|
// node/virtual/styles.ts
|
|
1018
|
-
import { existsSync as
|
|
1019
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
1019
1020
|
import { join as join8 } from "node:path";
|
|
1020
1021
|
var templateStyle = {
|
|
1021
1022
|
id: "/@slidev/styles",
|
|
@@ -1039,7 +1040,7 @@ var templateStyle = {
|
|
|
1039
1040
|
join8(root, "style.css")
|
|
1040
1041
|
];
|
|
1041
1042
|
for (const style of styles) {
|
|
1042
|
-
if (
|
|
1043
|
+
if (existsSync5(style)) {
|
|
1043
1044
|
imports.push(`import "${toAtFS(style)}"`);
|
|
1044
1045
|
continue;
|
|
1045
1046
|
}
|
|
@@ -1686,14 +1687,14 @@ async function useMarkdownItPlugins(md, options, markdownTransformMap) {
|
|
|
1686
1687
|
}
|
|
1687
1688
|
|
|
1688
1689
|
// node/setups/load.ts
|
|
1690
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
1689
1691
|
import { resolve as resolve4 } from "node:path";
|
|
1690
1692
|
import { deepMergeWithArray } from "@antfu/utils";
|
|
1691
|
-
import fs3 from "fs-extra";
|
|
1692
1693
|
async function loadSetups(roots, filename, args, extraLoader) {
|
|
1693
1694
|
const returns = [];
|
|
1694
1695
|
for (const root of roots) {
|
|
1695
1696
|
const path4 = resolve4(root, "setup", filename);
|
|
1696
|
-
if (
|
|
1697
|
+
if (existsSync6(path4)) {
|
|
1697
1698
|
const { default: setup } = await loadModule(path4);
|
|
1698
1699
|
const ret = await setup(...args);
|
|
1699
1700
|
if (ret)
|
|
@@ -1909,13 +1910,13 @@ function transformSlotSugar(ctx) {
|
|
|
1909
1910
|
}
|
|
1910
1911
|
|
|
1911
1912
|
// node/syntax/transform/snippet.ts
|
|
1913
|
+
import fs4 from "node:fs";
|
|
1912
1914
|
import path2 from "node:path";
|
|
1913
1915
|
import { slash as slash2 } from "@antfu/utils";
|
|
1914
|
-
import fs5 from "fs-extra";
|
|
1915
1916
|
import lz4 from "lz-string";
|
|
1916
1917
|
|
|
1917
1918
|
// node/vite/monacoWrite.ts
|
|
1918
|
-
import
|
|
1919
|
+
import fs3 from "node:fs/promises";
|
|
1919
1920
|
import path from "node:path";
|
|
1920
1921
|
var monacoWriterWhitelist = /* @__PURE__ */ new Set();
|
|
1921
1922
|
function createMonacoWriterPlugin({ userRoot }) {
|
|
@@ -1939,7 +1940,7 @@ function createMonacoWriterPlugin({ userRoot }) {
|
|
|
1939
1940
|
}
|
|
1940
1941
|
const filepath = path.join(userRoot, file);
|
|
1941
1942
|
console.log("[Slidev] Writing file:", filepath);
|
|
1942
|
-
await
|
|
1943
|
+
await fs3.writeFile(filepath, content, "utf-8");
|
|
1943
1944
|
}
|
|
1944
1945
|
});
|
|
1945
1946
|
});
|
|
@@ -2014,11 +2015,11 @@ function transformSnippet({ s, slide, options }) {
|
|
|
2014
2015
|
meta = meta.trim();
|
|
2015
2016
|
lang = lang.trim();
|
|
2016
2017
|
lang = lang || path2.extname(filepath).slice(1);
|
|
2017
|
-
const isAFile =
|
|
2018
|
-
if (!
|
|
2018
|
+
const isAFile = fs4.statSync(src).isFile();
|
|
2019
|
+
if (!fs4.existsSync(src) || !isAFile) {
|
|
2019
2020
|
throw new Error(isAFile ? `Code snippet path not found: ${src}` : `Invalid code snippet option`);
|
|
2020
2021
|
}
|
|
2021
|
-
let content =
|
|
2022
|
+
let content = fs4.readFileSync(src, "utf8");
|
|
2022
2023
|
if (regionName) {
|
|
2023
2024
|
const lines = content.split(/\r?\n/);
|
|
2024
2025
|
const region = findRegion(lines, regionName.slice(1));
|
|
@@ -2117,7 +2118,7 @@ async function createMarkdownPlugin(options, { markdown: mdOptions }) {
|
|
|
2117
2118
|
}
|
|
2118
2119
|
|
|
2119
2120
|
// node/vite/monacoTypes.ts
|
|
2120
|
-
import
|
|
2121
|
+
import fs5 from "node:fs/promises";
|
|
2121
2122
|
import { dirname, resolve as resolve5 } from "node:path";
|
|
2122
2123
|
import { slash as slash3 } from "@antfu/utils";
|
|
2123
2124
|
import fg2 from "fast-glob";
|
|
@@ -2142,7 +2143,7 @@ function createMonacoTypesLoader({ userRoot, utils }) {
|
|
|
2142
2143
|
if (!pkgJsonPath)
|
|
2143
2144
|
throw new Error(`Package "${pkg}" not found in "${importer}"`);
|
|
2144
2145
|
const root = slash3(dirname(pkgJsonPath));
|
|
2145
|
-
const pkgJson = JSON.parse(await
|
|
2146
|
+
const pkgJson = JSON.parse(await fs5.readFile(pkgJsonPath, "utf-8"));
|
|
2146
2147
|
let deps = Object.keys(pkgJson.dependencies ?? {});
|
|
2147
2148
|
deps = deps.filter((pkg2) => !utils.isMonacoTypesIgnored(pkg2));
|
|
2148
2149
|
return [
|
|
@@ -2202,9 +2203,10 @@ async function createRemoteAssetsPlugin({ data: { config }, mode }, pluginOption
|
|
|
2202
2203
|
import ServerRef from "vite-plugin-vue-server-ref";
|
|
2203
2204
|
|
|
2204
2205
|
// node/integrations/drawings.ts
|
|
2206
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
2207
|
+
import fs6 from "node:fs/promises";
|
|
2205
2208
|
import { basename, dirname as dirname2, join as join9, resolve as resolve6 } from "node:path";
|
|
2206
2209
|
import fg3 from "fast-glob";
|
|
2207
|
-
import fs7 from "fs-extra";
|
|
2208
2210
|
function resolveDrawingsDir(options) {
|
|
2209
2211
|
return options.data.config.drawings.persist ? resolve6(
|
|
2210
2212
|
dirname2(options.entry),
|
|
@@ -2213,7 +2215,7 @@ function resolveDrawingsDir(options) {
|
|
|
2213
2215
|
}
|
|
2214
2216
|
async function loadDrawings(options) {
|
|
2215
2217
|
const dir = resolveDrawingsDir(options);
|
|
2216
|
-
if (!dir || !
|
|
2218
|
+
if (!dir || !existsSync7(dir))
|
|
2217
2219
|
return {};
|
|
2218
2220
|
const files = await fg3("*.svg", {
|
|
2219
2221
|
onlyFiles: true,
|
|
@@ -2226,7 +2228,7 @@ async function loadDrawings(options) {
|
|
|
2226
2228
|
const num = +basename(path4, ".svg");
|
|
2227
2229
|
if (Number.isNaN(num))
|
|
2228
2230
|
return;
|
|
2229
|
-
const content = await
|
|
2231
|
+
const content = await fs6.readFile(path4, "utf8");
|
|
2230
2232
|
const lines = content.split(/\n/g);
|
|
2231
2233
|
obj[num.toString()] = lines.slice(1, -1).join("\n");
|
|
2232
2234
|
}));
|
|
@@ -2239,7 +2241,7 @@ async function writeDrawings(options, drawing) {
|
|
|
2239
2241
|
const width = options.data.config.canvasWidth;
|
|
2240
2242
|
const height = Math.round(width / options.data.config.aspectRatio);
|
|
2241
2243
|
const SVG_HEAD = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">`;
|
|
2242
|
-
await
|
|
2244
|
+
await fs6.mkdir(dir, { recursive: true });
|
|
2243
2245
|
return Promise.all(
|
|
2244
2246
|
Object.entries(drawing).map(async ([key, value]) => {
|
|
2245
2247
|
if (!value)
|
|
@@ -2247,30 +2249,31 @@ async function writeDrawings(options, drawing) {
|
|
|
2247
2249
|
const svg = `${SVG_HEAD}
|
|
2248
2250
|
${value}
|
|
2249
2251
|
</svg>`;
|
|
2250
|
-
await
|
|
2252
|
+
await fs6.writeFile(join9(dir, `${key}.svg`), svg, "utf-8");
|
|
2251
2253
|
})
|
|
2252
2254
|
);
|
|
2253
2255
|
}
|
|
2254
2256
|
|
|
2255
2257
|
// node/integrations/snapshots.ts
|
|
2258
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
2259
|
+
import fs7 from "node:fs/promises";
|
|
2256
2260
|
import { dirname as dirname3, join as join10, resolve as resolve7 } from "node:path";
|
|
2257
|
-
import fs8 from "fs-extra";
|
|
2258
2261
|
function resolveSnapshotsDir(options) {
|
|
2259
2262
|
return resolve7(dirname3(options.entry), ".slidev/snapshots");
|
|
2260
2263
|
}
|
|
2261
2264
|
async function loadSnapshots(options) {
|
|
2262
2265
|
const dir = resolveSnapshotsDir(options);
|
|
2263
2266
|
const file = join10(dir, "snapshots.json");
|
|
2264
|
-
if (!dir || !
|
|
2267
|
+
if (!dir || !existsSync8(file))
|
|
2265
2268
|
return {};
|
|
2266
|
-
return JSON.parse(await
|
|
2269
|
+
return JSON.parse(await fs7.readFile(file, "utf8"));
|
|
2267
2270
|
}
|
|
2268
2271
|
async function writeSnapshots(options, data) {
|
|
2269
2272
|
const dir = resolveSnapshotsDir(options);
|
|
2270
2273
|
if (!dir)
|
|
2271
2274
|
return;
|
|
2272
|
-
await
|
|
2273
|
-
await
|
|
2275
|
+
await fs7.mkdir(dir, { recursive: true });
|
|
2276
|
+
await fs7.writeFile(join10(dir, "snapshots.json"), JSON.stringify(data, null, 2), "utf-8");
|
|
2274
2277
|
}
|
|
2275
2278
|
|
|
2276
2279
|
// node/vite/serverRef.ts
|
|
@@ -2299,10 +2302,10 @@ async function createServerRefPlugin(options, pluginOptions) {
|
|
|
2299
2302
|
}
|
|
2300
2303
|
|
|
2301
2304
|
// node/vite/staticCopy.ts
|
|
2302
|
-
import { existsSync as
|
|
2305
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
2303
2306
|
import { join as join11 } from "node:path";
|
|
2304
2307
|
async function createStaticCopyPlugin({ themeRoots, addonRoots }, pluginOptions) {
|
|
2305
|
-
const publicDirs = [...themeRoots, ...addonRoots].map((i) => join11(i, "public")).filter(
|
|
2308
|
+
const publicDirs = [...themeRoots, ...addonRoots].map((i) => join11(i, "public")).filter(existsSync9);
|
|
2306
2309
|
if (!publicDirs.length)
|
|
2307
2310
|
return;
|
|
2308
2311
|
const { viteStaticCopy } = await import("vite-plugin-static-copy");
|
|
@@ -2320,7 +2323,7 @@ async function createStaticCopyPlugin({ themeRoots, addonRoots }, pluginOptions)
|
|
|
2320
2323
|
import UnoCSS from "unocss/vite";
|
|
2321
2324
|
|
|
2322
2325
|
// node/setups/unocss.ts
|
|
2323
|
-
import { existsSync as
|
|
2326
|
+
import { existsSync as existsSync10, readFileSync } from "node:fs";
|
|
2324
2327
|
import { resolve as resolve8 } from "node:path";
|
|
2325
2328
|
import { mergeConfigs, presetIcons } from "unocss";
|
|
2326
2329
|
async function setupUnocss({ clientRoot, roots, data, utils }) {
|
|
@@ -2329,7 +2332,7 @@ async function setupUnocss({ clientRoot, roots, data, utils }) {
|
|
|
2329
2332
|
resolve8(root, "uno.config.ts"),
|
|
2330
2333
|
resolve8(root, "unocss.config.ts")
|
|
2331
2334
|
].map(async (i) => {
|
|
2332
|
-
if (!
|
|
2335
|
+
if (!existsSync10(i))
|
|
2333
2336
|
return void 0;
|
|
2334
2337
|
const loaded = await loadModule(i);
|
|
2335
2338
|
return "default" in loaded ? loaded.default : loaded;
|
|
@@ -2467,7 +2470,7 @@ async function resolveViteConfigs(options, baseConfig, overrideConfigs, command,
|
|
|
2467
2470
|
};
|
|
2468
2471
|
const files = options.roots.map((i) => join12(i, "vite.config.ts"));
|
|
2469
2472
|
for (const file of files) {
|
|
2470
|
-
if (!
|
|
2473
|
+
if (!existsSync11(file))
|
|
2471
2474
|
continue;
|
|
2472
2475
|
const viteConfig = await loadConfigFromFile(configEnv, file);
|
|
2473
2476
|
if (!viteConfig?.config)
|
|
@@ -2507,7 +2510,7 @@ function setupIndexHtml({ mode, entry, clientRoot, userRoot, roots, data, base }
|
|
|
2507
2510
|
].filter(Boolean).join("\n");
|
|
2508
2511
|
for (const root of roots) {
|
|
2509
2512
|
const path4 = join13(root, "index.html");
|
|
2510
|
-
if (!
|
|
2513
|
+
if (!existsSync12(path4))
|
|
2511
2514
|
continue;
|
|
2512
2515
|
const index = readFileSync2(path4, "utf-8");
|
|
2513
2516
|
if (root === userRoot && index.includes("<!DOCTYPE")) {
|
|
@@ -2548,7 +2551,7 @@ async function setupKatex(roots) {
|
|
|
2548
2551
|
}
|
|
2549
2552
|
|
|
2550
2553
|
// node/setups/shiki.ts
|
|
2551
|
-
import
|
|
2554
|
+
import fs8 from "node:fs/promises";
|
|
2552
2555
|
import { bundledLanguages, createHighlighter } from "shiki";
|
|
2553
2556
|
var cachedRoots;
|
|
2554
2557
|
var cachedShiki;
|
|
@@ -2563,7 +2566,7 @@ async function setupShiki(roots) {
|
|
|
2563
2566
|
/** @deprecated */
|
|
2564
2567
|
async loadTheme(path4) {
|
|
2565
2568
|
console.warn("[slidev] `loadTheme` in `setup/shiki.ts` is deprecated. Pass directly the theme name it's supported by Shiki. For custom themes, load it manually via `JSON.parse(fs.readFileSync(path, 'utf-8'))` and pass the raw JSON object instead.");
|
|
2566
|
-
return JSON.parse(await
|
|
2569
|
+
return JSON.parse(await fs8.readFile(path4, "utf-8"));
|
|
2567
2570
|
}
|
|
2568
2571
|
}]
|
|
2569
2572
|
);
|
|
@@ -2645,7 +2648,7 @@ async function resolveOptions(entryOptions, mode) {
|
|
|
2645
2648
|
};
|
|
2646
2649
|
}
|
|
2647
2650
|
async function createDataUtils(resolved) {
|
|
2648
|
-
const monacoTypesIgnorePackagesMatches = (resolved.data.config.monacoTypesIgnorePackages || []).map((i) =>
|
|
2651
|
+
const monacoTypesIgnorePackagesMatches = (resolved.data.config.monacoTypesIgnorePackages || []).map((i) => pm.makeRe(i));
|
|
2649
2652
|
let _layouts_cache_time = 0;
|
|
2650
2653
|
let _layouts_cache = {};
|
|
2651
2654
|
return {
|
|
@@ -2654,7 +2657,7 @@ async function createDataUtils(resolved) {
|
|
|
2654
2657
|
indexHtml: setupIndexHtml(resolved),
|
|
2655
2658
|
define: getDefine(resolved),
|
|
2656
2659
|
iconsResolvePath: [resolved.clientRoot, ...resolved.roots].reverse(),
|
|
2657
|
-
isMonacoTypesIgnored: (pkg) => monacoTypesIgnorePackagesMatches.some((i) => i(pkg)),
|
|
2660
|
+
isMonacoTypesIgnored: (pkg) => monacoTypesIgnorePackagesMatches.some((i) => i.test(pkg)),
|
|
2658
2661
|
getLayouts: () => {
|
|
2659
2662
|
const now = Date.now();
|
|
2660
2663
|
if (now - _layouts_cache_time < 2e3)
|
|
@@ -5,8 +5,8 @@ import process from "node:process";
|
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { parseNi, run } from "@antfu/ni";
|
|
7
7
|
import { ensurePrefix, slash } from "@antfu/utils";
|
|
8
|
+
import { underline, yellow } from "ansis";
|
|
8
9
|
import globalDirs from "global-directory";
|
|
9
|
-
import { underline, yellow } from "kolorist";
|
|
10
10
|
import { resolvePath } from "mlly";
|
|
11
11
|
import prompts from "prompts";
|
|
12
12
|
import { resolveGlobal } from "resolve-global";
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LF5Q7I4U.js";
|
|
4
4
|
import {
|
|
5
5
|
getThemeMeta,
|
|
6
6
|
loadSetups,
|
|
@@ -9,24 +9,24 @@ import {
|
|
|
9
9
|
resolveOptions,
|
|
10
10
|
resolveTheme,
|
|
11
11
|
version
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BFQFB535.js";
|
|
13
13
|
import {
|
|
14
14
|
getRoots,
|
|
15
15
|
isInstalledGlobally,
|
|
16
16
|
resolveEntry
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TJFRPB4N.js";
|
|
18
18
|
|
|
19
19
|
// node/cli.ts
|
|
20
20
|
import { exec } from "node:child_process";
|
|
21
|
+
import fs from "node:fs/promises";
|
|
21
22
|
import os from "node:os";
|
|
22
23
|
import path from "node:path";
|
|
23
24
|
import process from "node:process";
|
|
24
25
|
import * as readline from "node:readline";
|
|
25
26
|
import { verifyConfig } from "@slidev/parser";
|
|
27
|
+
import { blue, bold, cyan, cyanBright, dim, gray, green, underline, yellow } from "ansis";
|
|
26
28
|
import equal from "fast-deep-equal";
|
|
27
|
-
import fs from "fs-extra";
|
|
28
29
|
import { getPort } from "get-port-please";
|
|
29
|
-
import { blue, bold, cyan, dim, gray, green, lightCyan, underline, yellow } from "kolorist";
|
|
30
30
|
import openBrowser from "open";
|
|
31
31
|
import yargs from "yargs";
|
|
32
32
|
|
|
@@ -337,7 +337,7 @@ cli.command(
|
|
|
337
337
|
}).strict().help(),
|
|
338
338
|
async (args) => {
|
|
339
339
|
const { entry, theme, base, download, out, inspect } = args;
|
|
340
|
-
const { build } = await import("./build-
|
|
340
|
+
const { build } = await import("./build-2QWDNCVK.js");
|
|
341
341
|
for (const entryFile of entry) {
|
|
342
342
|
const options = await resolveOptions({ entry: entryFile, theme, inspect, download, base }, "build");
|
|
343
343
|
printInfo(options);
|
|
@@ -392,9 +392,13 @@ cli.command(
|
|
|
392
392
|
process.exit(1);
|
|
393
393
|
}
|
|
394
394
|
const [name, root] = await resolveTheme(themeRaw, entry);
|
|
395
|
-
await fs.
|
|
396
|
-
|
|
397
|
-
|
|
395
|
+
await fs.cp(
|
|
396
|
+
root,
|
|
397
|
+
path.resolve(dir),
|
|
398
|
+
{
|
|
399
|
+
filter: (i) => !/node_modules|.git/.test(path.relative(root, i))
|
|
400
|
+
}
|
|
401
|
+
);
|
|
398
402
|
const dirPath = `./${dir}`;
|
|
399
403
|
const firstSlide = data.entry.slides[0];
|
|
400
404
|
firstSlide.frontmatter.theme = dirPath;
|
|
@@ -415,16 +419,16 @@ cli.command(
|
|
|
415
419
|
(args) => exportOptions(commonOptions(args)).strict().help(),
|
|
416
420
|
async (args) => {
|
|
417
421
|
const { entry, theme } = args;
|
|
418
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
422
|
+
const { exportSlides, getExportOptions } = await import("./export-VO32FL6K.js");
|
|
419
423
|
const port = await getPort(12445);
|
|
420
424
|
let warned = false;
|
|
421
425
|
for (const entryFile of entry) {
|
|
422
426
|
const options = await resolveOptions({ entry: entryFile, theme }, "export");
|
|
423
427
|
if (options.data.config.browserExporter !== false && !warned) {
|
|
424
428
|
warned = true;
|
|
425
|
-
console.log(
|
|
429
|
+
console.log(cyanBright("[Slidev] Try the new browser exporter!"));
|
|
426
430
|
console.log(
|
|
427
|
-
|
|
431
|
+
cyanBright("You can use the browser exporter instead by starting the dev server as normal and visit"),
|
|
428
432
|
`${blue("localhost:")}${dim("<port>")}${blue("/export")}
|
|
429
433
|
`
|
|
430
434
|
);
|
|
@@ -474,7 +478,7 @@ cli.command(
|
|
|
474
478
|
timeout,
|
|
475
479
|
wait
|
|
476
480
|
}) => {
|
|
477
|
-
const { exportNotes } = await import("./export-
|
|
481
|
+
const { exportNotes } = await import("./export-VO32FL6K.js");
|
|
478
482
|
const port = await getPort(12445);
|
|
479
483
|
for (const entryFile of entry) {
|
|
480
484
|
const options = await resolveOptions({ entry: entryFile }, "export");
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getRoots
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TJFRPB4N.js";
|
|
4
4
|
|
|
5
5
|
// node/commands/export.ts
|
|
6
6
|
import { Buffer } from "node:buffer";
|
|
7
|
+
import fs from "node:fs/promises";
|
|
7
8
|
import path from "node:path";
|
|
8
9
|
import process from "node:process";
|
|
9
10
|
import { clearUndefined, slash } from "@antfu/utils";
|
|
10
11
|
import { outlinePdfFactory } from "@lillallol/outline-pdf";
|
|
11
12
|
import { parseRangeString } from "@slidev/parser/core";
|
|
13
|
+
import { blue, cyan, dim, green, yellow } from "ansis";
|
|
12
14
|
import { Presets, SingleBar } from "cli-progress";
|
|
13
|
-
import fs from "fs-extra";
|
|
14
|
-
import { blue, cyan, dim, green, yellow } from "kolorist";
|
|
15
15
|
import { resolve } from "mlly";
|
|
16
16
|
import * as pdfLib from "pdf-lib";
|
|
17
17
|
import { PDFDocument } from "pdf-lib";
|
|
@@ -303,7 +303,8 @@ async function exportSlides({
|
|
|
303
303
|
async function genPagePngOnePiece(writeToDisk) {
|
|
304
304
|
const result = [];
|
|
305
305
|
await go("print");
|
|
306
|
-
await fs.
|
|
306
|
+
await fs.rm(output, { force: true, recursive: true });
|
|
307
|
+
await fs.mkdir(output, { recursive: true });
|
|
307
308
|
const slideContainers = page.locator(".print-slide-container");
|
|
308
309
|
const count = await slideContainers.count();
|
|
309
310
|
for (let i = 0; i < count; i++) {
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LF5Q7I4U.js";
|
|
4
4
|
import {
|
|
5
5
|
ViteSlidevPlugin,
|
|
6
6
|
createDataUtils,
|
|
7
7
|
parser,
|
|
8
8
|
resolveOptions
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-BFQFB535.js";
|
|
10
|
+
import "./chunk-TJFRPB4N.js";
|
|
11
11
|
export {
|
|
12
12
|
ViteSlidevPlugin,
|
|
13
13
|
createDataUtils,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "51.1
|
|
4
|
+
"version": "51.2.1",
|
|
5
5
|
"description": "Presentation slides for developers",
|
|
6
6
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -48,27 +48,26 @@
|
|
|
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": "^
|
|
52
|
-
"@shikijs/twoslash": "^
|
|
53
|
-
"@shikijs/vitepress-twoslash": "^
|
|
54
|
-
"@unocss/extractor-mdc": "^
|
|
55
|
-
"@unocss/reset": "^
|
|
51
|
+
"@shikijs/markdown-it": "^3.0.0",
|
|
52
|
+
"@shikijs/twoslash": "^3.0.0",
|
|
53
|
+
"@shikijs/vitepress-twoslash": "^3.0.0",
|
|
54
|
+
"@unocss/extractor-mdc": "^66.0.0",
|
|
55
|
+
"@unocss/reset": "^66.0.0",
|
|
56
56
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
57
57
|
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
|
58
|
+
"ansis": "^3.15.0",
|
|
58
59
|
"chokidar": "^4.0.3",
|
|
59
60
|
"cli-progress": "^3.12.0",
|
|
60
61
|
"connect": "^3.7.0",
|
|
61
62
|
"debug": "^4.4.0",
|
|
62
63
|
"fast-deep-equal": "^3.1.3",
|
|
63
64
|
"fast-glob": "^3.3.3",
|
|
64
|
-
"fs-extra": "^11.3.0",
|
|
65
65
|
"get-port-please": "^3.1.2",
|
|
66
66
|
"global-directory": "^4.0.1",
|
|
67
67
|
"htmlparser2": "^10.0.0",
|
|
68
68
|
"is-installed-globally": "^1.0.0",
|
|
69
69
|
"jiti": "^2.4.2",
|
|
70
70
|
"katex": "^0.16.21",
|
|
71
|
-
"kolorist": "^1.8.0",
|
|
72
71
|
"local-pkg": "^1.0.0",
|
|
73
72
|
"lz-string": "^1.5.0",
|
|
74
73
|
"magic-string": "^0.30.17",
|
|
@@ -76,11 +75,11 @@
|
|
|
76
75
|
"markdown-it": "^14.1.0",
|
|
77
76
|
"markdown-it-footnote": "^4.0.0",
|
|
78
77
|
"markdown-it-mdc": "^0.2.5",
|
|
79
|
-
"micromatch": "^4.0.8",
|
|
80
78
|
"mlly": "^1.7.4",
|
|
81
79
|
"monaco-editor": "0.51.0",
|
|
82
80
|
"open": "^10.1.0",
|
|
83
81
|
"pdf-lib": "^1.17.1",
|
|
82
|
+
"picomatch": "^4.0.2",
|
|
84
83
|
"plantuml-encoder": "^1.4.0",
|
|
85
84
|
"postcss-nested": "^7.0.2",
|
|
86
85
|
"pptxgenjs": "^3.12.0",
|
|
@@ -89,33 +88,33 @@
|
|
|
89
88
|
"resolve-from": "^5.0.0",
|
|
90
89
|
"resolve-global": "^2.0.0",
|
|
91
90
|
"semver": "^7.7.1",
|
|
92
|
-
"shiki": "^
|
|
93
|
-
"shiki-magic-move": "^1.0.
|
|
91
|
+
"shiki": "^3.0.0",
|
|
92
|
+
"shiki-magic-move": "^1.0.1",
|
|
94
93
|
"sirv": "^3.0.1",
|
|
95
94
|
"source-map-js": "^1.2.1",
|
|
96
95
|
"typescript": "^5.7.3",
|
|
97
|
-
"unocss": "^
|
|
98
|
-
"unplugin-icons": "^22.
|
|
96
|
+
"unocss": "^66.0.0",
|
|
97
|
+
"unplugin-icons": "^22.1.0",
|
|
99
98
|
"unplugin-vue-components": "^28.2.0",
|
|
100
|
-
"unplugin-vue-markdown": "^28.3.
|
|
99
|
+
"unplugin-vue-markdown": "^28.3.1",
|
|
101
100
|
"untun": "^0.1.3",
|
|
102
101
|
"uqr": "^0.1.2",
|
|
103
102
|
"vite": "^6.1.0",
|
|
104
103
|
"vite-plugin-inspect": "^10.2.1",
|
|
105
|
-
"vite-plugin-remote-assets": "^0.
|
|
104
|
+
"vite-plugin-remote-assets": "^1.0.0",
|
|
106
105
|
"vite-plugin-static-copy": "^2.2.0",
|
|
107
|
-
"vite-plugin-vue-server-ref": "^0.
|
|
106
|
+
"vite-plugin-vue-server-ref": "^1.0.0",
|
|
108
107
|
"vitefu": "^1.0.5",
|
|
109
108
|
"vue": "^3.5.13",
|
|
110
109
|
"yaml": "^2.7.0",
|
|
111
110
|
"yargs": "^17.7.2",
|
|
112
|
-
"@slidev/
|
|
113
|
-
"@slidev/types": "51.1
|
|
114
|
-
"@slidev/
|
|
111
|
+
"@slidev/client": "51.2.1",
|
|
112
|
+
"@slidev/types": "51.2.1",
|
|
113
|
+
"@slidev/parser": "51.2.1"
|
|
115
114
|
},
|
|
116
115
|
"devDependencies": {
|
|
117
116
|
"@hedgedoc/markdown-it-plugins": "^2.1.4",
|
|
118
|
-
"@types/
|
|
117
|
+
"@types/picomatch": "^3.0.2",
|
|
119
118
|
"@types/plantuml-encoder": "^1.4.2"
|
|
120
119
|
},
|
|
121
120
|
"scripts": {
|