@slidev/cli 0.42.10 → 0.43.0-beta.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.
- package/dist/{build-4XPJ27UV.mjs → build-C2GYF6EU.mjs} +7 -7
- package/dist/{build-E5AQPKXP.js → build-J2XECXHU.js} +8 -8
- package/dist/{chunk-B54ZYWFO.mjs → chunk-E3UONPQL.mjs} +37 -45
- package/dist/chunk-HA2YGJJG.mjs +4837 -0
- package/dist/{chunk-VPD6PH2L.mjs → chunk-HO75FTDI.mjs} +7 -7
- package/dist/{chunk-RSZHGGR3.js → chunk-J7PXWEZ7.js} +7 -7
- package/dist/{chunk-6XVZLT3I.mjs → chunk-JDHANZ37.mjs} +1 -1
- package/dist/{chunk-34SGGZ4P.js → chunk-JQHGZJGJ.js} +7 -10
- package/dist/{chunk-BFOSXE34.js → chunk-O7JFTQZ2.js} +86 -94
- package/dist/{chunk-KB3DQ2OE.mjs → chunk-QHOBBTS4.mjs} +1 -31
- package/dist/chunk-ROTHRPSW.js +4837 -0
- package/dist/{chunk-QDKRARRU.js → chunk-YUG22S6W.js} +1 -31
- package/dist/{chunk-MZBIET7Y.mjs → chunk-ZEKM4EGL.mjs} +3 -6
- package/dist/cli.js +36 -35
- package/dist/cli.mjs +17 -16
- package/dist/{export-6G7WYT32.mjs → export-I7B4PU6A.mjs} +17 -22
- package/dist/{export-BGMCS4F2.js → export-MCALG7XD.js} +18 -23
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/dist/{unocss-2T2KTWQ5.js → unocss-2DU67QXG.js} +6 -7
- package/dist/{unocss-ALFHEPHE.mjs → unocss-2UOAV4VT.mjs} +9 -10
- package/dist/windicss-FNELZNWD.js +9 -0
- package/dist/windicss-UVXCUIV4.mjs +9 -0
- package/package.json +8 -7
- package/template.md +1 -1
- package/dist/chunk-C6JRFTBY.js +0 -1651
- package/dist/chunk-XNFJHVPK.mjs +0 -1651
- package/dist/windicss-3HGYWXUJ.js +0 -9
- package/dist/windicss-TWSVDM4O.mjs +0 -9
|
@@ -30,39 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
31
|
mod
|
|
32
32
|
));
|
|
33
|
-
var __accessCheck = (obj, member, msg) => {
|
|
34
|
-
if (!member.has(obj))
|
|
35
|
-
throw TypeError("Cannot " + msg);
|
|
36
|
-
};
|
|
37
|
-
var __privateGet = (obj, member, getter) => {
|
|
38
|
-
__accessCheck(obj, member, "read from private field");
|
|
39
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
40
|
-
};
|
|
41
|
-
var __privateAdd = (obj, member, value) => {
|
|
42
|
-
if (member.has(obj))
|
|
43
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
44
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
45
|
-
};
|
|
46
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
47
|
-
__accessCheck(obj, member, "write to private field");
|
|
48
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
49
|
-
return value;
|
|
50
|
-
};
|
|
51
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
52
|
-
set _(value) {
|
|
53
|
-
__privateSet(obj, member, value, setter);
|
|
54
|
-
},
|
|
55
|
-
get _() {
|
|
56
|
-
return __privateGet(obj, member, getter);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
33
|
|
|
64
34
|
|
|
65
35
|
|
|
66
36
|
|
|
67
37
|
|
|
68
|
-
exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM;
|
|
38
|
+
exports.__require = __require; exports.__commonJS = __commonJS; exports.__toESM = __toESM;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__require
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QHOBBTS4.mjs";
|
|
4
4
|
|
|
5
5
|
// node/utils.ts
|
|
6
|
-
import { join } from "path";
|
|
6
|
+
import { join } from "node:path";
|
|
7
7
|
import { ensurePrefix, slash } from "@antfu/utils";
|
|
8
8
|
import isInstalledGlobally from "is-installed-globally";
|
|
9
9
|
import { sync as resolve } from "resolve";
|
|
@@ -49,10 +49,7 @@ function resolveGlobalImportPath(importName) {
|
|
|
49
49
|
}
|
|
50
50
|
function stringifyMarkdownTokens(tokens) {
|
|
51
51
|
return tokens.map(
|
|
52
|
-
(token) =>
|
|
53
|
-
var _a;
|
|
54
|
-
return (_a = token.children) == null ? void 0 : _a.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ");
|
|
55
|
-
}
|
|
52
|
+
(token) => token.children?.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ")
|
|
56
53
|
).filter(Boolean).join(" ");
|
|
57
54
|
}
|
|
58
55
|
function generateGoogleFontsUrl(options) {
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict"; function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
1
|
+
"use strict"; function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkO7JFTQZ2js = require('./chunk-O7JFTQZ2.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkROTHRPSWjs = require('./chunk-ROTHRPSW.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunkKKGXM3XLjs = require('./chunk-KKGXM3XL.js');
|
|
19
|
-
require('./chunk-
|
|
19
|
+
require('./chunk-JQHGZJGJ.js');
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunkYUG22S6Wjs = require('./chunk-YUG22S6W.js');
|
|
23
23
|
|
|
24
24
|
// node/cli.ts
|
|
25
|
-
var import_fast_deep_equal =
|
|
25
|
+
var import_fast_deep_equal = _chunkYUG22S6Wjs.__toESM.call(void 0, _chunkROTHRPSWjs.require_fast_deep_equal.call(void 0, ));
|
|
26
26
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
27
27
|
var _os = require('os'); var _os2 = _interopRequireDefault(_os);
|
|
28
28
|
var _child_process = require('child_process');
|
|
@@ -42,22 +42,23 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
42
42
|
"monaco",
|
|
43
43
|
"routerMode",
|
|
44
44
|
"fonts",
|
|
45
|
-
"css"
|
|
45
|
+
"css",
|
|
46
|
+
"mdc"
|
|
46
47
|
];
|
|
47
48
|
_fs.injectPreparserExtensionLoader.call(void 0, async (headmatter, filepath) => {
|
|
48
|
-
const addons = _nullishCoalesce((headmatter
|
|
49
|
+
const addons = _nullishCoalesce(_optionalChain([headmatter, 'optionalAccess', _ => _.addons]), () => ( []));
|
|
49
50
|
const roots = (
|
|
50
51
|
/* uniq */
|
|
51
52
|
[
|
|
52
|
-
|
|
53
|
-
...
|
|
54
|
-
|
|
53
|
+
_chunkO7JFTQZ2js.getUserRoot.call(void 0, {}).userRoot,
|
|
54
|
+
..._chunkO7JFTQZ2js.getAddonRoots.call(void 0, addons, ""),
|
|
55
|
+
_chunkO7JFTQZ2js.getClientRoot.call(void 0, )
|
|
55
56
|
]
|
|
56
57
|
);
|
|
57
58
|
const mergeArrays = (a, b) => a.concat(b);
|
|
58
59
|
return await _chunkKKGXM3XLjs.loadSetups.call(void 0, roots, "preparser.ts", { filepath, headmatter }, [], false, mergeArrays);
|
|
59
60
|
});
|
|
60
|
-
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(
|
|
61
|
+
var cli = _yargs2.default.scriptName("slidev").usage("$0 [args]").version(_chunkO7JFTQZ2js.version).strict().showHelpOnFail(false).alias("h", "help").alias("v", "version");
|
|
61
62
|
cli.command(
|
|
62
63
|
"* [entry]",
|
|
63
64
|
"Start a local server for Slidev",
|
|
@@ -113,9 +114,9 @@ cli.command(
|
|
|
113
114
|
async function initServer() {
|
|
114
115
|
if (server)
|
|
115
116
|
await server.close();
|
|
116
|
-
const options = await
|
|
117
|
+
const options = await _chunkO7JFTQZ2js.resolveOptions.call(void 0, { entry, remote, theme, inspect }, "dev");
|
|
117
118
|
port = userPort || await findFreePort(3030);
|
|
118
|
-
server = await
|
|
119
|
+
server = await _chunkO7JFTQZ2js.createServer.call(void 0,
|
|
119
120
|
options,
|
|
120
121
|
{
|
|
121
122
|
server: {
|
|
@@ -129,7 +130,7 @@ cli.command(
|
|
|
129
130
|
},
|
|
130
131
|
{
|
|
131
132
|
onDataReload(newData, data) {
|
|
132
|
-
if (!theme &&
|
|
133
|
+
if (!theme && _chunkO7JFTQZ2js.resolveThemeName.call(void 0, newData.config.theme) !== _chunkO7JFTQZ2js.resolveThemeName.call(void 0, data.config.theme)) {
|
|
133
134
|
console.log(_kolorist.yellow.call(void 0, "\n restarting on theme change\n"));
|
|
134
135
|
initServer();
|
|
135
136
|
} else if (CONFIG_RESTART_FIELDS.some((i) => !(0, import_fast_deep_equal.default)(newData.config[i], data.config[i]))) {
|
|
@@ -184,7 +185,7 @@ cli.command(
|
|
|
184
185
|
fullname: "quit",
|
|
185
186
|
action() {
|
|
186
187
|
try {
|
|
187
|
-
server
|
|
188
|
+
_optionalChain([server, 'optionalAccess', _2 => _2.close, 'call', _3 => _3()]);
|
|
188
189
|
} finally {
|
|
189
190
|
_process2.default.exit();
|
|
190
191
|
}
|
|
@@ -258,9 +259,9 @@ cli.command(
|
|
|
258
259
|
}).strict().help(),
|
|
259
260
|
async (args) => {
|
|
260
261
|
const { entry, theme, watch, base, download, out, inspect } = args;
|
|
261
|
-
const { build } = await Promise.resolve().then(() => require("./build-
|
|
262
|
+
const { build } = await Promise.resolve().then(() => require("./build-J2XECXHU.js"));
|
|
262
263
|
for (const entryFile of entry) {
|
|
263
|
-
const options = await
|
|
264
|
+
const options = await _chunkO7JFTQZ2js.resolveOptions.call(void 0, { entry: entryFile, theme, inspect }, "build");
|
|
264
265
|
if (download && !options.data.config.download)
|
|
265
266
|
options.data.config.download = download;
|
|
266
267
|
printInfo(options);
|
|
@@ -280,9 +281,9 @@ cli.command(
|
|
|
280
281
|
(args) => commonOptions(args).strict().help(),
|
|
281
282
|
async ({ entry }) => {
|
|
282
283
|
for (const entryFile of entry) {
|
|
283
|
-
const data = await
|
|
284
|
-
|
|
285
|
-
await
|
|
284
|
+
const data = await _chunkO7JFTQZ2js.parser.load(entryFile);
|
|
285
|
+
_chunkO7JFTQZ2js.parser.prettify(data);
|
|
286
|
+
await _chunkO7JFTQZ2js.parser.save(data);
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
289
|
);
|
|
@@ -298,17 +299,17 @@ cli.command(
|
|
|
298
299
|
default: "theme"
|
|
299
300
|
}),
|
|
300
301
|
async ({ entry, dir, theme: themeInput }) => {
|
|
301
|
-
const data = await
|
|
302
|
-
const theme =
|
|
302
|
+
const data = await _chunkO7JFTQZ2js.parser.load(entry);
|
|
303
|
+
const theme = _chunkO7JFTQZ2js.resolveThemeName.call(void 0, themeInput || data.config.theme);
|
|
303
304
|
if (theme === "none") {
|
|
304
305
|
console.error('Cannot eject theme "none"');
|
|
305
306
|
_process2.default.exit(1);
|
|
306
307
|
}
|
|
307
|
-
if (
|
|
308
|
+
if (_chunkO7JFTQZ2js.isPath.call(void 0, theme)) {
|
|
308
309
|
console.error("Theme is already ejected");
|
|
309
310
|
_process2.default.exit(1);
|
|
310
311
|
}
|
|
311
|
-
const roots =
|
|
312
|
+
const roots = _chunkO7JFTQZ2js.getThemeRoots.call(void 0, theme, entry);
|
|
312
313
|
if (!roots.length) {
|
|
313
314
|
console.error(`Could not find theme "${theme}"`);
|
|
314
315
|
_process2.default.exit(1);
|
|
@@ -320,7 +321,7 @@ cli.command(
|
|
|
320
321
|
const dirPath = `./${dir}`;
|
|
321
322
|
data.slides[0].frontmatter.theme = dirPath;
|
|
322
323
|
data.slides[0].raw = null;
|
|
323
|
-
await
|
|
324
|
+
await _chunkO7JFTQZ2js.parser.save(data);
|
|
324
325
|
console.log(`Theme "${theme}" ejected successfully to "${dirPath}"`);
|
|
325
326
|
}
|
|
326
327
|
);
|
|
@@ -337,11 +338,11 @@ cli.command(
|
|
|
337
338
|
async (args) => {
|
|
338
339
|
const { entry, theme } = args;
|
|
339
340
|
_process2.default.env.NODE_ENV = "production";
|
|
340
|
-
const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-
|
|
341
|
+
const { exportSlides, getExportOptions } = await Promise.resolve().then(() => require("./export-MCALG7XD.js"));
|
|
341
342
|
const port = await findFreePort(12445);
|
|
342
343
|
for (const entryFile of entry) {
|
|
343
|
-
const options = await
|
|
344
|
-
const server = await
|
|
344
|
+
const options = await _chunkO7JFTQZ2js.resolveOptions.call(void 0, { entry: entryFile, theme }, "export");
|
|
345
|
+
const server = await _chunkO7JFTQZ2js.createServer.call(void 0,
|
|
345
346
|
options,
|
|
346
347
|
{
|
|
347
348
|
server: { port },
|
|
@@ -350,7 +351,7 @@ cli.command(
|
|
|
350
351
|
);
|
|
351
352
|
await server.listen(port);
|
|
352
353
|
printInfo(options);
|
|
353
|
-
|
|
354
|
+
_chunkO7JFTQZ2js.parser.filterDisabled(options.data);
|
|
354
355
|
const result = await exportSlides({
|
|
355
356
|
port,
|
|
356
357
|
...getExportOptions({ ...args, entry: entryFile }, options)
|
|
@@ -383,11 +384,11 @@ cli.command(
|
|
|
383
384
|
timeout
|
|
384
385
|
}) => {
|
|
385
386
|
_process2.default.env.NODE_ENV = "production";
|
|
386
|
-
const { exportNotes } = await Promise.resolve().then(() => require("./export-
|
|
387
|
+
const { exportNotes } = await Promise.resolve().then(() => require("./export-MCALG7XD.js"));
|
|
387
388
|
const port = await findFreePort(12445);
|
|
388
389
|
for (const entryFile of entry) {
|
|
389
|
-
const options = await
|
|
390
|
-
const server = await
|
|
390
|
+
const options = await _chunkO7JFTQZ2js.resolveOptions.call(void 0, { entry: entryFile }, "export");
|
|
391
|
+
const server = await _chunkO7JFTQZ2js.createServer.call(void 0,
|
|
391
392
|
options,
|
|
392
393
|
{
|
|
393
394
|
server: { port },
|
|
@@ -396,7 +397,7 @@ cli.command(
|
|
|
396
397
|
);
|
|
397
398
|
await server.listen(port);
|
|
398
399
|
printInfo(options);
|
|
399
|
-
|
|
400
|
+
_chunkO7JFTQZ2js.parser.filterDisabled(options.data);
|
|
400
401
|
const result = await exportNotes({
|
|
401
402
|
port,
|
|
402
403
|
output: output || (options.data.config.exportFilename ? `${options.data.config.exportFilename}-notes` : `${_path2.default.basename(entryFile, ".md")}-export-notes`),
|
|
@@ -457,7 +458,7 @@ function printInfo(options, port, remote, tunnelUrl) {
|
|
|
457
458
|
console.log();
|
|
458
459
|
console.log();
|
|
459
460
|
console.log(` ${_kolorist.cyan.call(void 0, "\u25CF") + _kolorist.blue.call(void 0, "\u25A0") + _kolorist.yellow.call(void 0, "\u25B2")}`);
|
|
460
|
-
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${
|
|
461
|
+
console.log(`${_kolorist.bold.call(void 0, " Slidev")} ${_kolorist.blue.call(void 0, `v${_chunkO7JFTQZ2js.version}`)} ${_isinstalledglobally2.default ? _kolorist.yellow.call(void 0, "(global)") : ""}`);
|
|
461
462
|
console.log();
|
|
462
463
|
_parser.verifyConfig.call(void 0, options.data.config, options.data.themeMeta, (v) => console.warn(_kolorist.yellow.call(void 0, ` ! ${v}`)));
|
|
463
464
|
console.log(_kolorist.dim.call(void 0, " theme ") + (options.theme ? _kolorist.green.call(void 0, options.theme) : _kolorist.gray.call(void 0, "none")));
|
package/dist/cli.mjs
CHANGED
|
@@ -9,25 +9,25 @@ import {
|
|
|
9
9
|
resolveOptions,
|
|
10
10
|
resolveThemeName,
|
|
11
11
|
version
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-E3UONPQL.mjs";
|
|
13
13
|
import {
|
|
14
14
|
require_fast_deep_equal
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HA2YGJJG.mjs";
|
|
16
16
|
import {
|
|
17
17
|
loadSetups
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-JDHANZ37.mjs";
|
|
19
|
+
import "./chunk-ZEKM4EGL.mjs";
|
|
20
20
|
import {
|
|
21
21
|
__toESM
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QHOBBTS4.mjs";
|
|
23
23
|
|
|
24
24
|
// node/cli.ts
|
|
25
25
|
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
|
26
|
-
import path from "path";
|
|
27
|
-
import os from "os";
|
|
28
|
-
import { exec } from "child_process";
|
|
29
|
-
import * as readline from "readline";
|
|
30
|
-
import process from "process";
|
|
26
|
+
import path from "node:path";
|
|
27
|
+
import os from "node:os";
|
|
28
|
+
import { exec } from "node:child_process";
|
|
29
|
+
import * as readline from "node:readline";
|
|
30
|
+
import process from "node:process";
|
|
31
31
|
import fs from "fs-extra";
|
|
32
32
|
import openBrowser from "open";
|
|
33
33
|
import yargs from "yargs";
|
|
@@ -42,10 +42,11 @@ var CONFIG_RESTART_FIELDS = [
|
|
|
42
42
|
"monaco",
|
|
43
43
|
"routerMode",
|
|
44
44
|
"fonts",
|
|
45
|
-
"css"
|
|
45
|
+
"css",
|
|
46
|
+
"mdc"
|
|
46
47
|
];
|
|
47
48
|
injectPreparserExtensionLoader(async (headmatter, filepath) => {
|
|
48
|
-
const addons =
|
|
49
|
+
const addons = headmatter?.addons ?? [];
|
|
49
50
|
const roots = (
|
|
50
51
|
/* uniq */
|
|
51
52
|
[
|
|
@@ -184,7 +185,7 @@ cli.command(
|
|
|
184
185
|
fullname: "quit",
|
|
185
186
|
action() {
|
|
186
187
|
try {
|
|
187
|
-
server
|
|
188
|
+
server?.close();
|
|
188
189
|
} finally {
|
|
189
190
|
process.exit();
|
|
190
191
|
}
|
|
@@ -258,7 +259,7 @@ cli.command(
|
|
|
258
259
|
}).strict().help(),
|
|
259
260
|
async (args) => {
|
|
260
261
|
const { entry, theme, watch, base, download, out, inspect } = args;
|
|
261
|
-
const { build } = await import("./build-
|
|
262
|
+
const { build } = await import("./build-C2GYF6EU.mjs");
|
|
262
263
|
for (const entryFile of entry) {
|
|
263
264
|
const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
|
|
264
265
|
if (download && !options.data.config.download)
|
|
@@ -337,7 +338,7 @@ cli.command(
|
|
|
337
338
|
async (args) => {
|
|
338
339
|
const { entry, theme } = args;
|
|
339
340
|
process.env.NODE_ENV = "production";
|
|
340
|
-
const { exportSlides, getExportOptions } = await import("./export-
|
|
341
|
+
const { exportSlides, getExportOptions } = await import("./export-I7B4PU6A.mjs");
|
|
341
342
|
const port = await findFreePort(12445);
|
|
342
343
|
for (const entryFile of entry) {
|
|
343
344
|
const options = await resolveOptions({ entry: entryFile, theme }, "export");
|
|
@@ -383,7 +384,7 @@ cli.command(
|
|
|
383
384
|
timeout
|
|
384
385
|
}) => {
|
|
385
386
|
process.env.NODE_ENV = "production";
|
|
386
|
-
const { exportNotes } = await import("./export-
|
|
387
|
+
const { exportNotes } = await import("./export-I7B4PU6A.mjs");
|
|
387
388
|
const port = await findFreePort(12445);
|
|
388
389
|
for (const entryFile of entry) {
|
|
389
390
|
const options = await resolveOptions({ entry: entryFile }, "export");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
packageExists
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-ZEKM4EGL.mjs";
|
|
4
|
+
import "./chunk-QHOBBTS4.mjs";
|
|
5
5
|
|
|
6
6
|
// node/export.ts
|
|
7
|
-
import path from "path";
|
|
8
|
-
import { Buffer } from "buffer";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { Buffer } from "node:buffer";
|
|
9
9
|
import fs from "fs-extra";
|
|
10
10
|
import { blue, cyan, dim, green, yellow } from "kolorist";
|
|
11
11
|
import { Presets, SingleBar } from "cli-progress";
|
|
@@ -14,7 +14,6 @@ import { outlinePdfFactory } from "@lillallol/outline-pdf";
|
|
|
14
14
|
import * as pdfLib from "pdf-lib";
|
|
15
15
|
import { PDFDocument } from "pdf-lib";
|
|
16
16
|
function addToTree(tree, info, slideIndexes, level = 1) {
|
|
17
|
-
var _a;
|
|
18
17
|
const titleLevel = info.level;
|
|
19
18
|
if (titleLevel && titleLevel > level && tree.length > 0) {
|
|
20
19
|
addToTree(tree[tree.length - 1].children, info, slideIndexes, level + 1);
|
|
@@ -23,7 +22,7 @@ function addToTree(tree, info, slideIndexes, level = 1) {
|
|
|
23
22
|
children: [],
|
|
24
23
|
level,
|
|
25
24
|
path: String(slideIndexes[info.index + 1]),
|
|
26
|
-
hideInToc: Boolean(
|
|
25
|
+
hideInToc: Boolean(info.frontmatter?.hideInToc),
|
|
27
26
|
title: info.title
|
|
28
27
|
});
|
|
29
28
|
}
|
|
@@ -170,15 +169,13 @@ async function exportSlides({
|
|
|
170
169
|
clicksBySlide[path2] = (clicksBySlide[path2] || 0) + 1;
|
|
171
170
|
}
|
|
172
171
|
const slideIndexes = Object.fromEntries(Object.entries(clicksBySlide).reduce((acc, [path2, clicks], i) => {
|
|
173
|
-
|
|
174
|
-
acc.push([path2, clicks + (((_a = acc[i - 1]) == null ? void 0 : _a[1]) ?? 0)]);
|
|
172
|
+
acc.push([path2, clicks + (acc[i - 1]?.[1] ?? 0)]);
|
|
175
173
|
return acc;
|
|
176
174
|
}, []));
|
|
177
175
|
return slideIndexes;
|
|
178
176
|
}
|
|
179
177
|
function getClicksFromUrl(url) {
|
|
180
|
-
|
|
181
|
-
return (_a = url.match(/clicks=([1-9][0-9]*)/)) == null ? void 0 : _a[1];
|
|
178
|
+
return url.match(/clicks=([1-9][0-9]*)/)?.[1];
|
|
182
179
|
}
|
|
183
180
|
async function genPageWithClicks(fn, i, clicks) {
|
|
184
181
|
await fn(i, clicks);
|
|
@@ -225,7 +222,6 @@ async function exportSlides({
|
|
|
225
222
|
await fs.writeFile(output, buffer);
|
|
226
223
|
}
|
|
227
224
|
async function genPagePdfOnePiece() {
|
|
228
|
-
var _a, _b, _c, _d, _e, _f;
|
|
229
225
|
await go("print");
|
|
230
226
|
const slideIndexes = await getSlidesIndex();
|
|
231
227
|
await page.pdf({
|
|
@@ -244,17 +240,17 @@ async function exportSlides({
|
|
|
244
240
|
let pdfData = await fs.readFile(output);
|
|
245
241
|
let pdf = await PDFDocument.load(pdfData);
|
|
246
242
|
const titleSlide = slides[0];
|
|
247
|
-
if (titleSlide
|
|
243
|
+
if (titleSlide?.title)
|
|
248
244
|
pdf.setTitle(titleSlide.title);
|
|
249
|
-
if (
|
|
245
|
+
if (titleSlide?.frontmatter?.info)
|
|
250
246
|
pdf.setSubject(titleSlide.frontmatter.info);
|
|
251
|
-
if (
|
|
247
|
+
if (titleSlide?.frontmatter?.author)
|
|
252
248
|
pdf.setAuthor(titleSlide.frontmatter.author);
|
|
253
|
-
if (
|
|
254
|
-
if (Array.isArray(
|
|
255
|
-
pdf.setKeywords(
|
|
249
|
+
if (titleSlide?.frontmatter?.keywords) {
|
|
250
|
+
if (Array.isArray(titleSlide?.frontmatter?.keywords))
|
|
251
|
+
pdf.setKeywords(titleSlide?.frontmatter?.keywords);
|
|
256
252
|
else
|
|
257
|
-
pdf.setKeywords(
|
|
253
|
+
pdf.setKeywords(titleSlide?.frontmatter?.keywords.split(","));
|
|
258
254
|
}
|
|
259
255
|
if (withToc) {
|
|
260
256
|
const outlinePdf = outlinePdfFactory(pdfLib);
|
|
@@ -306,13 +302,12 @@ async function exportSlides({
|
|
|
306
302
|
async function genPageMd(slides2) {
|
|
307
303
|
const files = await fs.readdir(output);
|
|
308
304
|
const mds = files.map((file, i, files2) => {
|
|
309
|
-
var _a, _b, _c;
|
|
310
305
|
const slideIndex = getSlideIndex(file);
|
|
311
|
-
const mdImg = `![${
|
|
306
|
+
const mdImg = `![${slides2[slideIndex]?.title}](./${path.join(output, file)})
|
|
312
307
|
|
|
313
308
|
`;
|
|
314
|
-
if ((i + 1 === files2.length || getSlideIndex(files2[i + 1]) !== slideIndex) &&
|
|
315
|
-
return `${mdImg}${
|
|
309
|
+
if ((i + 1 === files2.length || getSlideIndex(files2[i + 1]) !== slideIndex) && slides2[slideIndex]?.note)
|
|
310
|
+
return `${mdImg}${slides2[slideIndex]?.note}
|
|
316
311
|
|
|
317
312
|
`;
|
|
318
313
|
return mdImg;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkJQHGZJGJjs = require('./chunk-JQHGZJGJ.js');
|
|
4
|
+
require('./chunk-YUG22S6W.js');
|
|
5
5
|
|
|
6
6
|
// node/export.ts
|
|
7
7
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
@@ -14,7 +14,6 @@ var _outlinepdf = require('@lillallol/outline-pdf');
|
|
|
14
14
|
var _pdflib = require('pdf-lib'); var pdfLib = _interopRequireWildcard(_pdflib);
|
|
15
15
|
|
|
16
16
|
function addToTree(tree, info, slideIndexes, level = 1) {
|
|
17
|
-
var _a;
|
|
18
17
|
const titleLevel = info.level;
|
|
19
18
|
if (titleLevel && titleLevel > level && tree.length > 0) {
|
|
20
19
|
addToTree(tree[tree.length - 1].children, info, slideIndexes, level + 1);
|
|
@@ -23,7 +22,7 @@ function addToTree(tree, info, slideIndexes, level = 1) {
|
|
|
23
22
|
children: [],
|
|
24
23
|
level,
|
|
25
24
|
path: String(slideIndexes[info.index + 1]),
|
|
26
|
-
hideInToc: Boolean((
|
|
25
|
+
hideInToc: Boolean(_optionalChain([info, 'access', _ => _.frontmatter, 'optionalAccess', _2 => _2.hideInToc])),
|
|
27
26
|
title: info.title
|
|
28
27
|
});
|
|
29
28
|
}
|
|
@@ -77,7 +76,7 @@ async function exportNotes({
|
|
|
77
76
|
output = "notes",
|
|
78
77
|
timeout = 3e4
|
|
79
78
|
}) {
|
|
80
|
-
if (!
|
|
79
|
+
if (!_chunkJQHGZJGJjs.packageExists.call(void 0, "playwright-chromium"))
|
|
81
80
|
throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
|
|
82
81
|
const { chromium } = await Promise.resolve().then(() => require("playwright-chromium"));
|
|
83
82
|
const browser = await chromium.launch();
|
|
@@ -123,7 +122,7 @@ async function exportSlides({
|
|
|
123
122
|
withToc = false,
|
|
124
123
|
perSlide = false
|
|
125
124
|
}) {
|
|
126
|
-
if (!
|
|
125
|
+
if (!_chunkJQHGZJGJjs.packageExists.call(void 0, "playwright-chromium"))
|
|
127
126
|
throw new Error("The exporting for Slidev is powered by Playwright, please install it via `npm i -D playwright-chromium`");
|
|
128
127
|
const pages = _core.parseRangeString.call(void 0, total, range);
|
|
129
128
|
const { chromium } = await Promise.resolve().then(() => require("playwright-chromium"));
|
|
@@ -170,15 +169,13 @@ async function exportSlides({
|
|
|
170
169
|
clicksBySlide[path2] = (clicksBySlide[path2] || 0) + 1;
|
|
171
170
|
}
|
|
172
171
|
const slideIndexes = Object.fromEntries(Object.entries(clicksBySlide).reduce((acc, [path2, clicks], i) => {
|
|
173
|
-
|
|
174
|
-
acc.push([path2, clicks + (_nullishCoalesce(((_a = acc[i - 1]) == null ? void 0 : _a[1]), () => ( 0)))]);
|
|
172
|
+
acc.push([path2, clicks + (_nullishCoalesce(_optionalChain([acc, 'access', _3 => _3[i - 1], 'optionalAccess', _4 => _4[1]]), () => ( 0)))]);
|
|
175
173
|
return acc;
|
|
176
174
|
}, []));
|
|
177
175
|
return slideIndexes;
|
|
178
176
|
}
|
|
179
177
|
function getClicksFromUrl(url) {
|
|
180
|
-
|
|
181
|
-
return (_a = url.match(/clicks=([1-9][0-9]*)/)) == null ? void 0 : _a[1];
|
|
178
|
+
return _optionalChain([url, 'access', _5 => _5.match, 'call', _6 => _6(/clicks=([1-9][0-9]*)/), 'optionalAccess', _7 => _7[1]]);
|
|
182
179
|
}
|
|
183
180
|
async function genPageWithClicks(fn, i, clicks) {
|
|
184
181
|
await fn(i, clicks);
|
|
@@ -225,7 +222,6 @@ async function exportSlides({
|
|
|
225
222
|
await _fsextra2.default.writeFile(output, buffer);
|
|
226
223
|
}
|
|
227
224
|
async function genPagePdfOnePiece() {
|
|
228
|
-
var _a, _b, _c, _d, _e, _f;
|
|
229
225
|
await go("print");
|
|
230
226
|
const slideIndexes = await getSlidesIndex();
|
|
231
227
|
await page.pdf({
|
|
@@ -244,17 +240,17 @@ async function exportSlides({
|
|
|
244
240
|
let pdfData = await _fsextra2.default.readFile(output);
|
|
245
241
|
let pdf = await _pdflib.PDFDocument.load(pdfData);
|
|
246
242
|
const titleSlide = slides[0];
|
|
247
|
-
if (titleSlide
|
|
243
|
+
if (_optionalChain([titleSlide, 'optionalAccess', _8 => _8.title]))
|
|
248
244
|
pdf.setTitle(titleSlide.title);
|
|
249
|
-
if ((
|
|
245
|
+
if (_optionalChain([titleSlide, 'optionalAccess', _9 => _9.frontmatter, 'optionalAccess', _10 => _10.info]))
|
|
250
246
|
pdf.setSubject(titleSlide.frontmatter.info);
|
|
251
|
-
if ((
|
|
247
|
+
if (_optionalChain([titleSlide, 'optionalAccess', _11 => _11.frontmatter, 'optionalAccess', _12 => _12.author]))
|
|
252
248
|
pdf.setAuthor(titleSlide.frontmatter.author);
|
|
253
|
-
if ((
|
|
254
|
-
if (Array.isArray((
|
|
255
|
-
pdf.setKeywords((
|
|
249
|
+
if (_optionalChain([titleSlide, 'optionalAccess', _13 => _13.frontmatter, 'optionalAccess', _14 => _14.keywords])) {
|
|
250
|
+
if (Array.isArray(_optionalChain([titleSlide, 'optionalAccess', _15 => _15.frontmatter, 'optionalAccess', _16 => _16.keywords])))
|
|
251
|
+
pdf.setKeywords(_optionalChain([titleSlide, 'optionalAccess', _17 => _17.frontmatter, 'optionalAccess', _18 => _18.keywords]));
|
|
256
252
|
else
|
|
257
|
-
pdf.setKeywords((
|
|
253
|
+
pdf.setKeywords(_optionalChain([titleSlide, 'optionalAccess', _19 => _19.frontmatter, 'optionalAccess', _20 => _20.keywords, 'access', _21 => _21.split, 'call', _22 => _22(",")]));
|
|
258
254
|
}
|
|
259
255
|
if (withToc) {
|
|
260
256
|
const outlinePdf = _outlinepdf.outlinePdfFactory.call(void 0, pdfLib);
|
|
@@ -306,13 +302,12 @@ async function exportSlides({
|
|
|
306
302
|
async function genPageMd(slides2) {
|
|
307
303
|
const files = await _fsextra2.default.readdir(output);
|
|
308
304
|
const mds = files.map((file, i, files2) => {
|
|
309
|
-
var _a, _b, _c;
|
|
310
305
|
const slideIndex = getSlideIndex(file);
|
|
311
|
-
const mdImg = `![${(
|
|
306
|
+
const mdImg = `![${_optionalChain([slides2, 'access', _23 => _23[slideIndex], 'optionalAccess', _24 => _24.title])}](./${_path2.default.join(output, file)})
|
|
312
307
|
|
|
313
308
|
`;
|
|
314
|
-
if ((i + 1 === files2.length || getSlideIndex(files2[i + 1]) !== slideIndex) && (
|
|
315
|
-
return `${mdImg}${(
|
|
309
|
+
if ((i + 1 === files2.length || getSlideIndex(files2[i + 1]) !== slideIndex) && _optionalChain([slides2, 'access', _25 => _25[slideIndex], 'optionalAccess', _26 => _26.note]))
|
|
310
|
+
return `${mdImg}${_optionalChain([slides2, 'access', _27 => _27[slideIndex], 'optionalAccess', _28 => _28.note])}
|
|
316
311
|
|
|
317
312
|
`;
|
|
318
313
|
return mdImg;
|
package/dist/index.js
CHANGED
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkO7JFTQZ2js = require('./chunk-O7JFTQZ2.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkJ7PXWEZ7js = require('./chunk-J7PXWEZ7.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkROTHRPSWjs = require('./chunk-ROTHRPSW.js');
|
|
19
19
|
require('./chunk-KKGXM3XL.js');
|
|
20
|
-
require('./chunk-
|
|
21
|
-
require('./chunk-
|
|
20
|
+
require('./chunk-JQHGZJGJ.js');
|
|
21
|
+
require('./chunk-YUG22S6W.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -32,4 +32,4 @@ require('./chunk-QDKRARRU.js');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
exports.ViteSlidevPlugin =
|
|
35
|
+
exports.ViteSlidevPlugin = _chunkROTHRPSWjs.ViteSlidevPlugin; exports.createServer = _chunkO7JFTQZ2js.createServer; exports.createWindiCSSPlugin = _chunkJ7PXWEZ7js.createWindiCSSPlugin; exports.getAddonRoots = _chunkO7JFTQZ2js.getAddonRoots; exports.getCLIRoot = _chunkO7JFTQZ2js.getCLIRoot; exports.getClientRoot = _chunkO7JFTQZ2js.getClientRoot; exports.getRoot = _chunkO7JFTQZ2js.getRoot; exports.getThemeRoots = _chunkO7JFTQZ2js.getThemeRoots; exports.getUserRoot = _chunkO7JFTQZ2js.getUserRoot; exports.isPath = _chunkO7JFTQZ2js.isPath; exports.parser = _chunkO7JFTQZ2js.parser; exports.resolveOptions = _chunkO7JFTQZ2js.resolveOptions;
|
package/dist/index.mjs
CHANGED
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
isPath,
|
|
10
10
|
parser,
|
|
11
11
|
resolveOptions
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-E3UONPQL.mjs";
|
|
13
13
|
import {
|
|
14
14
|
createWindiCSSPlugin
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HO75FTDI.mjs";
|
|
16
16
|
import {
|
|
17
17
|
ViteSlidevPlugin
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-HA2YGJJG.mjs";
|
|
19
|
+
import "./chunk-JDHANZ37.mjs";
|
|
20
|
+
import "./chunk-ZEKM4EGL.mjs";
|
|
21
|
+
import "./chunk-QHOBBTS4.mjs";
|
|
22
22
|
export {
|
|
23
23
|
ViteSlidevPlugin,
|
|
24
24
|
createServer,
|