@slidev/cli 0.48.0-beta.2 → 0.48.0-beta.20
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-BVDM4ZAC.mjs → build-5AFXNUEB.mjs} +5 -41
- package/dist/chunk-CV7OWJOF.mjs +185 -0
- package/dist/chunk-KNY3KC45.mjs +151 -0
- package/dist/{chunk-FIXL4WBO.mjs → chunk-O56CS6WQ.mjs} +1653 -1461
- package/dist/{chunk-CTBVOVLQ.mjs → chunk-O6TYYGU6.mjs} +4 -16
- package/dist/cli.mjs +73 -74
- package/dist/{export-MLH55TH5.mjs → export-65BQ7S5F.mjs} +20 -13
- package/dist/index.d.mts +21 -25
- package/dist/index.mjs +4 -19
- package/dist/{unocss-6IVIFJMZ.mjs → unocss-M5KPNI4Z.mjs} +3 -4
- package/package.json +18 -18
- package/template.md +133 -26
- package/dist/chunk-BXO7ZPPU.mjs +0 -30
- package/dist/chunk-DWXI5WEO.mjs +0 -72
- package/dist/chunk-PDMXU2K7.mjs +0 -8135
|
@@ -2,29 +2,17 @@
|
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import fs from "fs-extra";
|
|
5
|
-
import {
|
|
5
|
+
import { deepMergeWithArray } from "@antfu/utils";
|
|
6
6
|
import jiti from "jiti";
|
|
7
|
-
function
|
|
8
|
-
a = { ...a };
|
|
9
|
-
Object.keys(b).forEach((key) => {
|
|
10
|
-
if (isObject(a[key]))
|
|
11
|
-
a[key] = deepMerge(a[key], b[key], rootPath ? `${rootPath}.${key}` : key);
|
|
12
|
-
else if (Array.isArray(a[key]))
|
|
13
|
-
a[key] = [...a[key], ...b[key]];
|
|
14
|
-
else
|
|
15
|
-
a[key] = b[key];
|
|
16
|
-
});
|
|
17
|
-
return a;
|
|
18
|
-
}
|
|
19
|
-
async function loadSetups(roots, name, arg, initial, merge = true) {
|
|
7
|
+
async function loadSetups(clientRoot, roots, name, arg, initial, merge = true) {
|
|
20
8
|
let returns = initial;
|
|
21
|
-
for (const root of roots) {
|
|
9
|
+
for (const root of [clientRoot, ...roots].reverse()) {
|
|
22
10
|
const path = resolve(root, "setup", name);
|
|
23
11
|
if (fs.existsSync(path)) {
|
|
24
12
|
const { default: setup } = jiti(fileURLToPath(import.meta.url))(path);
|
|
25
13
|
const result = await setup(arg);
|
|
26
14
|
if (result !== null) {
|
|
27
|
-
returns = typeof merge === "function" ? merge(returns, result) : merge ?
|
|
15
|
+
returns = typeof merge === "function" ? merge(returns, result) : merge ? deepMergeWithArray(returns, result) : result;
|
|
28
16
|
}
|
|
29
17
|
}
|
|
30
18
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer,
|
|
3
|
-
|
|
4
|
-
getClientRoot,
|
|
5
|
-
getThemeRoots,
|
|
6
|
-
getUserRoot,
|
|
7
|
-
isPath,
|
|
3
|
+
getThemeMeta,
|
|
8
4
|
parser,
|
|
5
|
+
resolveAddons,
|
|
9
6
|
resolveOptions,
|
|
10
|
-
|
|
7
|
+
resolveTheme
|
|
8
|
+
} from "./chunk-KNY3KC45.mjs";
|
|
9
|
+
import {
|
|
11
10
|
version
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-FIXL4WBO.mjs";
|
|
11
|
+
} from "./chunk-O56CS6WQ.mjs";
|
|
14
12
|
import {
|
|
15
13
|
loadSetups
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import
|
|
18
|
-
|
|
14
|
+
} from "./chunk-O6TYYGU6.mjs";
|
|
15
|
+
import {
|
|
16
|
+
getRoots
|
|
17
|
+
} from "./chunk-CV7OWJOF.mjs";
|
|
19
18
|
|
|
20
19
|
// node/cli.ts
|
|
21
20
|
import path from "node:path";
|
|
@@ -26,13 +25,13 @@ import process from "node:process";
|
|
|
26
25
|
import fs from "fs-extra";
|
|
27
26
|
import openBrowser from "open";
|
|
28
27
|
import yargs from "yargs";
|
|
29
|
-
import prompts from "prompts";
|
|
30
28
|
import { blue, bold, cyan, dim, gray, green, underline, yellow } from "kolorist";
|
|
31
29
|
import isInstalledGlobally from "is-installed-globally";
|
|
32
30
|
import equal from "fast-deep-equal";
|
|
33
31
|
import { verifyConfig } from "@slidev/parser";
|
|
34
32
|
import { injectPreparserExtensionLoader } from "@slidev/parser/fs";
|
|
35
|
-
import {
|
|
33
|
+
import { uniq } from "@antfu/utils";
|
|
34
|
+
import { getPort } from "get-port-please";
|
|
36
35
|
var CONFIG_RESTART_FIELDS = [
|
|
37
36
|
"highlighter",
|
|
38
37
|
"monaco",
|
|
@@ -40,20 +39,19 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
40
39
|
"fonts",
|
|
41
40
|
"css",
|
|
42
41
|
"mdc",
|
|
43
|
-
"editor"
|
|
42
|
+
"editor",
|
|
43
|
+
"theme"
|
|
44
44
|
];
|
|
45
|
-
injectPreparserExtensionLoader(async (headmatter, filepath) => {
|
|
45
|
+
injectPreparserExtensionLoader(async (headmatter, filepath, mode) => {
|
|
46
46
|
const addons = headmatter?.addons ?? [];
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
]
|
|
54
|
-
);
|
|
47
|
+
const { clientRoot, userRoot } = await getRoots();
|
|
48
|
+
const roots = uniq([
|
|
49
|
+
clientRoot,
|
|
50
|
+
userRoot,
|
|
51
|
+
...await resolveAddons(addons)
|
|
52
|
+
]);
|
|
55
53
|
const mergeArrays = (a, b) => a.concat(b);
|
|
56
|
-
return await loadSetups(roots, "preparser.ts", { filepath, headmatter }, [], mergeArrays);
|
|
54
|
+
return await loadSetups(clientRoot, roots, "preparser.ts", { filepath, headmatter, mode }, [], mergeArrays);
|
|
57
55
|
});
|
|
58
56
|
var cli = yargs(process.argv.slice(2)).scriptName("slidev").usage("$0 [args]").version(version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
|
|
59
57
|
cli.command(
|
|
@@ -89,22 +87,12 @@ cli.command(
|
|
|
89
87
|
default: false,
|
|
90
88
|
type: "boolean",
|
|
91
89
|
describe: "force the optimizer to ignore the cache and re-bundle "
|
|
90
|
+
}).option("bind", {
|
|
91
|
+
type: "string",
|
|
92
|
+
default: "0.0.0.0",
|
|
93
|
+
describe: "specify which IP addresses the server should listen on in remote mode"
|
|
92
94
|
}).strict().help(),
|
|
93
|
-
async ({ entry, theme, port: userPort, open, log, remote, tunnel, force, inspect }) => {
|
|
94
|
-
if (!fs.existsSync(entry) && !entry.endsWith(".md"))
|
|
95
|
-
entry = `${entry}.md`;
|
|
96
|
-
if (!fs.existsSync(entry)) {
|
|
97
|
-
const { create } = await prompts({
|
|
98
|
-
name: "create",
|
|
99
|
-
type: "confirm",
|
|
100
|
-
initial: "Y",
|
|
101
|
-
message: `Entry file ${yellow(`"${entry}"`)} does not exist, do you want to create it?`
|
|
102
|
-
});
|
|
103
|
-
if (create)
|
|
104
|
-
await fs.copyFile(new URL("../template.md", import.meta.url), entry);
|
|
105
|
-
else
|
|
106
|
-
process.exit(0);
|
|
107
|
-
}
|
|
95
|
+
async ({ entry, theme, port: userPort, open, log, remote, tunnel, force, inspect, bind }) => {
|
|
108
96
|
let server;
|
|
109
97
|
let port = 3030;
|
|
110
98
|
let lastRemoteUrl;
|
|
@@ -112,7 +100,13 @@ cli.command(
|
|
|
112
100
|
if (server)
|
|
113
101
|
await server.close();
|
|
114
102
|
const options = await resolveOptions({ entry, remote, theme, inspect }, "dev");
|
|
115
|
-
|
|
103
|
+
const host = remote !== void 0 ? bind : "localhost";
|
|
104
|
+
port = userPort || await getPort({
|
|
105
|
+
port: 3030,
|
|
106
|
+
random: false,
|
|
107
|
+
portRange: [3030, 4e3],
|
|
108
|
+
host
|
|
109
|
+
});
|
|
116
110
|
server = await createServer(
|
|
117
111
|
options,
|
|
118
112
|
{
|
|
@@ -120,7 +114,7 @@ cli.command(
|
|
|
120
114
|
port,
|
|
121
115
|
strictPort: true,
|
|
122
116
|
open,
|
|
123
|
-
host
|
|
117
|
+
host,
|
|
124
118
|
// @ts-expect-error Vite <= 4
|
|
125
119
|
force
|
|
126
120
|
},
|
|
@@ -131,14 +125,27 @@ cli.command(
|
|
|
131
125
|
logLevel: log
|
|
132
126
|
},
|
|
133
127
|
{
|
|
134
|
-
async
|
|
135
|
-
|
|
128
|
+
async loadData() {
|
|
129
|
+
const { data: oldData, entry: entry2 } = options;
|
|
130
|
+
const loaded = await parser.load(options.userRoot, entry2, void 0, "dev");
|
|
131
|
+
const themeRaw = theme || loaded.headmatter.theme || "default";
|
|
132
|
+
if (options.themeRaw !== themeRaw) {
|
|
136
133
|
console.log(yellow("\n restarting on theme change\n"));
|
|
137
134
|
initServer();
|
|
138
|
-
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const themeMeta = options.themeRoots[0] ? await getThemeMeta(themeRaw, options.themeRoots[0]) : void 0;
|
|
138
|
+
const newData = {
|
|
139
|
+
...loaded,
|
|
140
|
+
themeMeta,
|
|
141
|
+
config: parser.resolveConfig(loaded.headmatter, themeMeta, entry2)
|
|
142
|
+
};
|
|
143
|
+
if (CONFIG_RESTART_FIELDS.some((i) => !equal(newData.config[i], oldData.config[i]))) {
|
|
139
144
|
console.log(yellow("\n restarting on config change\n"));
|
|
140
145
|
initServer();
|
|
146
|
+
return false;
|
|
141
147
|
}
|
|
148
|
+
return newData;
|
|
142
149
|
}
|
|
143
150
|
}
|
|
144
151
|
);
|
|
@@ -269,7 +276,7 @@ cli.command(
|
|
|
269
276
|
}).strict().help(),
|
|
270
277
|
async (args) => {
|
|
271
278
|
const { entry, theme, watch, base, download, out, inspect } = args;
|
|
272
|
-
const { build } = await import("./build-
|
|
279
|
+
const { build } = await import("./build-5AFXNUEB.mjs");
|
|
273
280
|
for (const entryFile of entry) {
|
|
274
281
|
const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
|
|
275
282
|
if (download && !options.data.config.download)
|
|
@@ -291,9 +298,9 @@ cli.command(
|
|
|
291
298
|
(args) => commonOptions(args).strict().help(),
|
|
292
299
|
async ({ entry }) => {
|
|
293
300
|
for (const entryFile of entry) {
|
|
294
|
-
const
|
|
295
|
-
parser.prettify(
|
|
296
|
-
await parser.save(
|
|
301
|
+
const md = await parser.parse(await fs.readFile(entryFile, "utf-8"), entryFile);
|
|
302
|
+
parser.prettify(md);
|
|
303
|
+
await parser.save(md);
|
|
297
304
|
}
|
|
298
305
|
}
|
|
299
306
|
);
|
|
@@ -309,30 +316,27 @@ cli.command(
|
|
|
309
316
|
default: "theme"
|
|
310
317
|
}),
|
|
311
318
|
async ({ entry, dir, theme: themeInput }) => {
|
|
312
|
-
const
|
|
313
|
-
const
|
|
314
|
-
|
|
319
|
+
const roots = await getRoots();
|
|
320
|
+
const data = await parser.load(roots.userRoot, entry);
|
|
321
|
+
const themeRaw = themeInput || data.headmatter.theme || "default";
|
|
322
|
+
if (themeRaw === "none") {
|
|
315
323
|
console.error('Cannot eject theme "none"');
|
|
316
324
|
process.exit(1);
|
|
317
325
|
}
|
|
318
|
-
if (
|
|
326
|
+
if ("/.".includes(themeRaw[0]) || themeRaw[0] !== "@" && themeRaw.includes("/")) {
|
|
319
327
|
console.error("Theme is already ejected");
|
|
320
328
|
process.exit(1);
|
|
321
329
|
}
|
|
322
|
-
const
|
|
323
|
-
if (!roots.length) {
|
|
324
|
-
console.error(`Could not find theme "${theme}"`);
|
|
325
|
-
process.exit(1);
|
|
326
|
-
}
|
|
327
|
-
const root = roots[0];
|
|
330
|
+
const [name, root] = await resolveTheme(themeRaw, entry);
|
|
328
331
|
await fs.copy(root, path.resolve(dir), {
|
|
329
332
|
filter: (i) => !/node_modules|.git/.test(path.relative(root, i))
|
|
330
333
|
});
|
|
331
334
|
const dirPath = `./${dir}`;
|
|
332
|
-
data.slides[0]
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
335
|
+
const firstSlide = data.entry.slides[0];
|
|
336
|
+
firstSlide.frontmatter.theme = dirPath;
|
|
337
|
+
parser.prettifySlide(firstSlide);
|
|
338
|
+
await parser.save(data.entry);
|
|
339
|
+
console.log(`Theme "${name}" ejected successfully to "${dirPath}"`);
|
|
336
340
|
}
|
|
337
341
|
);
|
|
338
342
|
},
|
|
@@ -347,8 +351,8 @@ cli.command(
|
|
|
347
351
|
(args) => exportOptions(commonOptions(args)).strict().help(),
|
|
348
352
|
async (args) => {
|
|
349
353
|
const { entry, theme } = args;
|
|
350
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
351
|
-
const port = await
|
|
354
|
+
const { exportSlides, getExportOptions } = await import("./export-65BQ7S5F.mjs");
|
|
355
|
+
const port = await getPort(12445);
|
|
352
356
|
for (const entryFile of entry) {
|
|
353
357
|
const options = await resolveOptions({ entry: entryFile, theme }, "export");
|
|
354
358
|
const server = await createServer(
|
|
@@ -360,7 +364,6 @@ cli.command(
|
|
|
360
364
|
);
|
|
361
365
|
await server.listen(port);
|
|
362
366
|
printInfo(options);
|
|
363
|
-
parser.filterDisabled(options.data);
|
|
364
367
|
const result = await exportSlides({
|
|
365
368
|
port,
|
|
366
369
|
...getExportOptions({ ...args, entry: entryFile }, options)
|
|
@@ -392,8 +395,8 @@ cli.command(
|
|
|
392
395
|
output,
|
|
393
396
|
timeout
|
|
394
397
|
}) => {
|
|
395
|
-
const { exportNotes } = await import("./export-
|
|
396
|
-
const port = await
|
|
398
|
+
const { exportNotes } = await import("./export-65BQ7S5F.mjs");
|
|
399
|
+
const port = await getPort(12445);
|
|
397
400
|
for (const entryFile of entry) {
|
|
398
401
|
const options = await resolveOptions({ entry: entryFile }, "export");
|
|
399
402
|
const server = await createServer(
|
|
@@ -405,7 +408,6 @@ cli.command(
|
|
|
405
408
|
);
|
|
406
409
|
await server.listen(port);
|
|
407
410
|
printInfo(options);
|
|
408
|
-
parser.filterDisabled(options.data);
|
|
409
411
|
const result = await exportNotes({
|
|
410
412
|
port,
|
|
411
413
|
output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${path.basename(entryFile, ".md")}-export-notes`),
|
|
@@ -479,13 +481,15 @@ function printInfo(options, port, remote, tunnelUrl, publicIp) {
|
|
|
479
481
|
const query = remote ? `?password=${remote}` : "";
|
|
480
482
|
const presenterPath = `${options.data.config.routerMode === "hash" ? "/#/" : "/"}presenter/${query}`;
|
|
481
483
|
const entryPath = `${options.data.config.routerMode === "hash" ? "/#/" : "/"}entry${query}/`;
|
|
484
|
+
const overviewPath = `${options.data.config.routerMode === "hash" ? "/#/" : "/"}overview${query}/`;
|
|
482
485
|
console.log();
|
|
483
486
|
console.log(`${dim(" public slide show ")} > ${cyan(`http://localhost:${bold(port)}/`)}`);
|
|
484
487
|
if (query)
|
|
485
488
|
console.log(`${dim(" private slide show ")} > ${cyan(`http://localhost:${bold(port)}/${query}`)}`);
|
|
486
489
|
console.log(`${dim(" presenter mode ")} > ${blue(`http://localhost:${bold(port)}${presenterPath}`)}`);
|
|
490
|
+
console.log(`${dim(" slides overview ")} > ${blue(`http://localhost:${bold(port)}${overviewPath}`)}`);
|
|
487
491
|
if (options.inspect)
|
|
488
|
-
console.log(`${dim(" inspector")}
|
|
492
|
+
console.log(`${dim(" vite inspector")} > ${yellow(`http://localhost:${bold(port)}/__inspect/`)}`);
|
|
489
493
|
let lastRemoteUrl = "";
|
|
490
494
|
if (remote !== void 0) {
|
|
491
495
|
Object.values(os.networkInterfaces()).forEach((v) => (v || []).filter((details) => String(details.family).slice(-1) === "4" && !details.address.includes("127.0.0.1")).forEach(({ address }) => {
|
|
@@ -508,8 +512,3 @@ function printInfo(options, port, remote, tunnelUrl, publicIp) {
|
|
|
508
512
|
return lastRemoteUrl;
|
|
509
513
|
}
|
|
510
514
|
}
|
|
511
|
-
async function findFreePort(start) {
|
|
512
|
-
if (await checkPort(start) !== false)
|
|
513
|
-
return start;
|
|
514
|
-
return findFreePort(start + 1);
|
|
515
|
-
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-DWXI5WEO.mjs";
|
|
5
|
-
import "./chunk-BXO7ZPPU.mjs";
|
|
2
|
+
getRoots
|
|
3
|
+
} from "./chunk-CV7OWJOF.mjs";
|
|
6
4
|
|
|
7
5
|
// node/export.ts
|
|
8
6
|
import path from "node:path";
|
|
@@ -14,7 +12,7 @@ import { parseRangeString } from "@slidev/parser/core";
|
|
|
14
12
|
import { outlinePdfFactory } from "@lillallol/outline-pdf";
|
|
15
13
|
import * as pdfLib from "pdf-lib";
|
|
16
14
|
import { PDFDocument } from "pdf-lib";
|
|
17
|
-
import
|
|
15
|
+
import { resolve } from "mlly";
|
|
18
16
|
function addToTree(tree, info, slideIndexes, level = 1) {
|
|
19
17
|
const titleLevel = info.level;
|
|
20
18
|
if (titleLevel && titleLevel > level && tree.length > 0) {
|
|
@@ -384,18 +382,27 @@ function getExportOptions(args, options, outDir, outFilename) {
|
|
|
384
382
|
};
|
|
385
383
|
}
|
|
386
384
|
async function importPlaywright() {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
385
|
+
const { userRoot, userWorkspaceRoot } = await getRoots();
|
|
386
|
+
try {
|
|
387
|
+
return await import(await resolve("playwright-chromium", { url: userRoot }));
|
|
388
|
+
} catch {
|
|
389
|
+
}
|
|
390
|
+
if (userWorkspaceRoot !== userRoot) {
|
|
391
|
+
try {
|
|
392
|
+
return await import(await resolve("playwright-chromium", { url: userWorkspaceRoot }));
|
|
393
|
+
} catch {
|
|
394
|
+
}
|
|
395
|
+
}
|
|
392
396
|
const { resolveGlobal } = await import("resolve-global");
|
|
393
397
|
try {
|
|
394
|
-
|
|
398
|
+
const imported = await import(resolveGlobal("playwright-chromium"));
|
|
399
|
+
return imported.default ?? imported;
|
|
400
|
+
} catch {
|
|
401
|
+
}
|
|
402
|
+
try {
|
|
403
|
+
return await import("playwright-chromium");
|
|
395
404
|
} catch {
|
|
396
405
|
}
|
|
397
|
-
if (globalPath)
|
|
398
|
-
return await import(globalPath);
|
|
399
406
|
throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
|
|
400
407
|
}
|
|
401
408
|
export {
|
package/dist/index.d.mts
CHANGED
|
@@ -7,12 +7,20 @@ import { VitePluginConfig } from 'unocss/vite';
|
|
|
7
7
|
import RemoteAssets from 'vite-plugin-remote-assets';
|
|
8
8
|
import ServerRef from 'vite-plugin-vue-server-ref';
|
|
9
9
|
import { ArgumentsType } from '@antfu/utils';
|
|
10
|
-
import {
|
|
10
|
+
import { SlidevData } from '@slidev/types';
|
|
11
11
|
import * as vite from 'vite';
|
|
12
12
|
import { InlineConfig, Plugin } from 'vite';
|
|
13
13
|
import * as fs from '@slidev/parser/fs';
|
|
14
14
|
export { fs as parser };
|
|
15
15
|
|
|
16
|
+
interface RootsInfo {
|
|
17
|
+
cliRoot: string;
|
|
18
|
+
clientRoot: string;
|
|
19
|
+
userRoot: string;
|
|
20
|
+
userPkgJson: Record<string, any>;
|
|
21
|
+
userWorkspaceRoot: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
interface SlidevEntryOptions {
|
|
17
25
|
/**
|
|
18
26
|
* Markdown entry
|
|
@@ -28,26 +36,21 @@ interface SlidevEntryOptions {
|
|
|
28
36
|
* Remote password
|
|
29
37
|
*/
|
|
30
38
|
remote?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Root path
|
|
33
|
-
*
|
|
34
|
-
* @default process.cwd()
|
|
35
|
-
*/
|
|
36
|
-
userRoot?: string;
|
|
37
39
|
/**
|
|
38
40
|
* Enable inspect plugin
|
|
39
41
|
*/
|
|
40
42
|
inspect?: boolean;
|
|
41
43
|
}
|
|
42
|
-
interface ResolvedSlidevOptions {
|
|
43
|
-
data:
|
|
44
|
+
interface ResolvedSlidevOptions extends RootsInfo {
|
|
45
|
+
data: SlidevData;
|
|
44
46
|
entry: string;
|
|
45
|
-
|
|
46
|
-
cliRoot: string;
|
|
47
|
-
clientRoot: string;
|
|
47
|
+
themeRaw: string;
|
|
48
48
|
theme: string;
|
|
49
49
|
themeRoots: string[];
|
|
50
50
|
addonRoots: string[];
|
|
51
|
+
/**
|
|
52
|
+
* =`[...themeRoots, ...addonRoots, userRoot]` (`clientRoot` excluded)
|
|
53
|
+
*/
|
|
51
54
|
roots: string[];
|
|
52
55
|
mode: 'dev' | 'build' | 'export';
|
|
53
56
|
remote?: string;
|
|
@@ -64,19 +67,12 @@ interface SlidevPluginOptions extends SlidevEntryOptions {
|
|
|
64
67
|
unocss?: VitePluginConfig;
|
|
65
68
|
}
|
|
66
69
|
interface SlidevServerOptions {
|
|
67
|
-
|
|
70
|
+
/**
|
|
71
|
+
* @returns `false` if server should be restarted
|
|
72
|
+
*/
|
|
73
|
+
loadData?: () => Promise<SlidevData | false>;
|
|
68
74
|
}
|
|
69
|
-
declare function
|
|
70
|
-
declare function getCLIRoot(): string;
|
|
71
|
-
declare function isPath(name: string): boolean;
|
|
72
|
-
declare function getThemeRoots(name: string, entry: string): Promise<string[]>;
|
|
73
|
-
declare function getAddonRoots(addons: string[], entry: string): Promise<string[]>;
|
|
74
|
-
declare function getRoot(name: string, entry: string): Promise<string>;
|
|
75
|
-
declare function getUserRoot(options: SlidevEntryOptions): {
|
|
76
|
-
entry: string;
|
|
77
|
-
userRoot: string;
|
|
78
|
-
};
|
|
79
|
-
declare function resolveOptions(options: SlidevEntryOptions, mode: ResolvedSlidevOptions['mode'], promptForInstallation?: boolean): Promise<ResolvedSlidevOptions>;
|
|
75
|
+
declare function resolveOptions(options: SlidevEntryOptions, mode: ResolvedSlidevOptions['mode']): Promise<ResolvedSlidevOptions>;
|
|
80
76
|
|
|
81
77
|
declare module 'vite' {
|
|
82
78
|
interface UserConfig {
|
|
@@ -93,4 +89,4 @@ declare function createServer(options: ResolvedSlidevOptions, viteConfig?: Inlin
|
|
|
93
89
|
|
|
94
90
|
declare function ViteSlidevPlugin(options: ResolvedSlidevOptions, pluginOptions: SlidevPluginOptions, serverOptions?: SlidevServerOptions): Promise<Plugin[]>;
|
|
95
91
|
|
|
96
|
-
export { type ResolvedSlidevOptions, type SlidevEntryOptions, type SlidevPluginOptions, type SlidevServerOptions, ViteSlidevPlugin, createServer,
|
|
92
|
+
export { type ResolvedSlidevOptions, type SlidevEntryOptions, type SlidevPluginOptions, type SlidevServerOptions, ViteSlidevPlugin, createServer, resolveOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer,
|
|
3
|
-
getAddonRoots,
|
|
4
|
-
getCLIRoot,
|
|
5
|
-
getClientRoot,
|
|
6
|
-
getRoot,
|
|
7
|
-
getThemeRoots,
|
|
8
|
-
getUserRoot,
|
|
9
|
-
isPath,
|
|
10
3
|
parser,
|
|
11
4
|
resolveOptions
|
|
12
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KNY3KC45.mjs";
|
|
13
6
|
import {
|
|
14
7
|
ViteSlidevPlugin
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-BXO7ZPPU.mjs";
|
|
8
|
+
} from "./chunk-O56CS6WQ.mjs";
|
|
9
|
+
import "./chunk-O6TYYGU6.mjs";
|
|
10
|
+
import "./chunk-CV7OWJOF.mjs";
|
|
19
11
|
export {
|
|
20
12
|
ViteSlidevPlugin,
|
|
21
13
|
createServer,
|
|
22
|
-
getAddonRoots,
|
|
23
|
-
getCLIRoot,
|
|
24
|
-
getClientRoot,
|
|
25
|
-
getRoot,
|
|
26
|
-
getThemeRoots,
|
|
27
|
-
getUserRoot,
|
|
28
|
-
isPath,
|
|
29
14
|
parser,
|
|
30
15
|
resolveOptions
|
|
31
16
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadSetups
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-BXO7ZPPU.mjs";
|
|
3
|
+
} from "./chunk-O6TYYGU6.mjs";
|
|
5
4
|
|
|
6
5
|
// node/plugins/unocss.ts
|
|
7
6
|
import { resolve } from "node:path";
|
|
@@ -11,7 +10,7 @@ import { uniq } from "@antfu/utils";
|
|
|
11
10
|
import { mergeConfigs } from "unocss";
|
|
12
11
|
import jiti from "jiti";
|
|
13
12
|
import UnoCSS from "unocss/vite";
|
|
14
|
-
async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots,
|
|
13
|
+
async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, data, userRoot }, { unocss: unoOptions = {} }) {
|
|
15
14
|
const configFiles = uniq([
|
|
16
15
|
resolve(userRoot, "uno.config.ts"),
|
|
17
16
|
resolve(userRoot, "unocss.config.ts"),
|
|
@@ -29,7 +28,7 @@ async function createUnocssPlugin({ themeRoots, addonRoots, clientRoot, roots, u
|
|
|
29
28
|
}).filter(Boolean);
|
|
30
29
|
configs.reverse();
|
|
31
30
|
let config = mergeConfigs([...configs, unoOptions]);
|
|
32
|
-
config = await loadSetups(roots, "unocss.ts", {}, config, (a, b) => mergeConfigs([a, b]));
|
|
31
|
+
config = await loadSetups(clientRoot, roots, "unocss.ts", {}, config, (a, b) => mergeConfigs([a, b]));
|
|
33
32
|
config.theme ||= {};
|
|
34
33
|
config.theme.fontFamily ||= {};
|
|
35
34
|
config.theme.fontFamily.sans ||= data.config.fonts.sans.join(",");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/cli",
|
|
3
|
-
"version": "0.48.0-beta.
|
|
3
|
+
"version": "0.48.0-beta.20",
|
|
4
4
|
"description": "Presentation slides for developers",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,14 +42,15 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
+
"@antfu/ni": "^0.21.12",
|
|
45
46
|
"@antfu/utils": "^0.7.7",
|
|
46
47
|
"@iconify-json/carbon": "^1.1.30",
|
|
47
48
|
"@iconify-json/ph": "^1.1.11",
|
|
48
49
|
"@lillallol/outline-pdf": "^4.0.0",
|
|
49
50
|
"@mrdrogdrog/optional": "^1.2.1",
|
|
50
|
-
"@shikijs/markdown-it": "^1.1.
|
|
51
|
-
"@shikijs/twoslash": "^1.1.
|
|
52
|
-
"@shikijs/vitepress-twoslash": "^1.1.
|
|
51
|
+
"@shikijs/markdown-it": "^1.1.7",
|
|
52
|
+
"@shikijs/twoslash": "^1.1.7",
|
|
53
|
+
"@shikijs/vitepress-twoslash": "^1.1.7",
|
|
53
54
|
"@unocss/extractor-mdc": "^0.58.5",
|
|
54
55
|
"@unocss/reset": "^0.58.5",
|
|
55
56
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
@@ -66,28 +67,28 @@
|
|
|
66
67
|
"htmlparser2": "^9.1.0",
|
|
67
68
|
"is-installed-globally": "^1.0.0",
|
|
68
69
|
"jiti": "^1.21.0",
|
|
69
|
-
"js-base64": "^3.7.6",
|
|
70
70
|
"katex": "^0.16.9",
|
|
71
71
|
"kolorist": "^1.8.0",
|
|
72
72
|
"local-pkg": "^0.5.0",
|
|
73
|
+
"lz-string": "^1.5.0",
|
|
73
74
|
"markdown-it": "^14.0.0",
|
|
74
75
|
"markdown-it-footnote": "^4.0.0",
|
|
75
76
|
"markdown-it-link-attributes": "^4.0.1",
|
|
76
77
|
"markdown-it-mdc": "^0.2.3",
|
|
77
|
-
"mlly": "^1.
|
|
78
|
-
"monaco-editor": "^0.
|
|
79
|
-
"
|
|
80
|
-
"open": "^10.0.3",
|
|
78
|
+
"mlly": "^1.6.1",
|
|
79
|
+
"monaco-editor": "^0.46.0",
|
|
80
|
+
"open": "^10.0.4",
|
|
81
81
|
"pdf-lib": "^1.17.1",
|
|
82
82
|
"plantuml-encoder": "^1.4.0",
|
|
83
83
|
"postcss-nested": "^6.0.1",
|
|
84
84
|
"prismjs": "^1.29.0",
|
|
85
85
|
"prompts": "^2.4.2",
|
|
86
86
|
"public-ip": "^6.0.1",
|
|
87
|
-
"resolve": "^1.22.8",
|
|
88
87
|
"resolve-from": "^5.0.0",
|
|
89
88
|
"resolve-global": "^2.0.0",
|
|
90
|
-
"
|
|
89
|
+
"semver": "^7.6.0",
|
|
90
|
+
"shiki": "^1.1.7",
|
|
91
|
+
"shiki-magic-move": "^0.1.0",
|
|
91
92
|
"sirv": "^2.0.4",
|
|
92
93
|
"typescript": "^5.3.3",
|
|
93
94
|
"unocss": "^0.58.5",
|
|
@@ -96,22 +97,21 @@
|
|
|
96
97
|
"unplugin-vue-markdown": "^0.26.0",
|
|
97
98
|
"untun": "^0.1.3",
|
|
98
99
|
"uqr": "^0.1.2",
|
|
99
|
-
"vite": "^5.1.
|
|
100
|
+
"vite": "^5.1.4",
|
|
100
101
|
"vite-plugin-inspect": "^0.8.3",
|
|
101
102
|
"vite-plugin-remote-assets": "^0.4.1",
|
|
102
103
|
"vite-plugin-static-copy": "^1.0.1",
|
|
103
104
|
"vite-plugin-vue-server-ref": "^0.4.2",
|
|
104
105
|
"vitefu": "^0.2.5",
|
|
105
|
-
"vue": "^3.4.
|
|
106
|
+
"vue": "^3.4.20",
|
|
106
107
|
"yargs": "^17.7.2",
|
|
107
|
-
"@slidev/client": "0.48.0-beta.
|
|
108
|
-
"@slidev/
|
|
109
|
-
"@slidev/
|
|
108
|
+
"@slidev/client": "0.48.0-beta.20",
|
|
109
|
+
"@slidev/parser": "0.48.0-beta.20",
|
|
110
|
+
"@slidev/types": "0.48.0-beta.20"
|
|
110
111
|
},
|
|
111
112
|
"devDependencies": {
|
|
112
113
|
"@hedgedoc/markdown-it-plugins": "^2.1.4",
|
|
113
|
-
"@types/plantuml-encoder": "^1.4.2"
|
|
114
|
-
"semver": "^7.6.0"
|
|
114
|
+
"@types/plantuml-encoder": "^1.4.2"
|
|
115
115
|
},
|
|
116
116
|
"scripts": {
|
|
117
117
|
"build": "rimraf dist && tsup node/index.ts node/cli.ts",
|